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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (322) hide show
  1. package/CHANGELOG.md +327 -319
  2. package/LICENSE.md +9 -9
  3. package/README.md +11 -11
  4. package/lib/cjs/imodel-components-react/UiIModelComponents.d.ts.map +1 -1
  5. package/lib/cjs/imodel-components-react/UiIModelComponents.js +11 -6
  6. package/lib/cjs/imodel-components-react/UiIModelComponents.js.map +1 -1
  7. package/lib/cjs/imodel-components-react/color/AlphaSlider.d.ts.map +1 -1
  8. package/lib/cjs/imodel-components-react/color/AlphaSlider.js +23 -17
  9. package/lib/cjs/imodel-components-react/color/AlphaSlider.js.map +1 -1
  10. package/lib/cjs/imodel-components-react/color/AlphaSlider.scss +15 -7
  11. package/lib/cjs/imodel-components-react/color/ColorPickerButton.d.ts +1 -1
  12. package/lib/cjs/imodel-components-react/color/ColorPickerButton.d.ts.map +1 -1
  13. package/lib/cjs/imodel-components-react/color/ColorPickerButton.js +10 -8
  14. package/lib/cjs/imodel-components-react/color/ColorPickerButton.js.map +1 -1
  15. package/lib/cjs/imodel-components-react/color/ColorPickerDialog.d.ts +1 -1
  16. package/lib/cjs/imodel-components-react/color/ColorPickerDialog.d.ts.map +1 -1
  17. package/lib/cjs/imodel-components-react/color/ColorPickerDialog.js +6 -8
  18. package/lib/cjs/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
  19. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.d.ts +1 -1
  20. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.d.ts.map +1 -1
  21. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.js +11 -12
  22. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
  23. package/lib/cjs/imodel-components-react/color/HueSlider.d.ts +1 -1
  24. package/lib/cjs/imodel-components-react/color/HueSlider.d.ts.map +1 -1
  25. package/lib/cjs/imodel-components-react/color/HueSlider.js +32 -15
  26. package/lib/cjs/imodel-components-react/color/HueSlider.js.map +1 -1
  27. package/lib/cjs/imodel-components-react/color/HueSlider.scss +27 -10
  28. package/lib/cjs/imodel-components-react/color/SaturationPicker.d.ts +1 -1
  29. package/lib/cjs/imodel-components-react/color/SaturationPicker.d.ts.map +1 -1
  30. package/lib/cjs/imodel-components-react/color/SaturationPicker.js +14 -11
  31. package/lib/cjs/imodel-components-react/color/SaturationPicker.js.map +1 -1
  32. package/lib/cjs/imodel-components-react/color/SaturationPicker.scss +5 -4
  33. package/lib/cjs/imodel-components-react/color/Swatch.d.ts.map +1 -1
  34. package/lib/cjs/imodel-components-react/color/Swatch.js +5 -8
  35. package/lib/cjs/imodel-components-react/color/Swatch.js.map +1 -1
  36. package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.d.ts.map +1 -1
  37. package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.js +3 -3
  38. package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.js.map +1 -1
  39. package/lib/cjs/imodel-components-react/editors/ColorEditor.d.ts.map +1 -1
  40. package/lib/cjs/imodel-components-react/editors/ColorEditor.js +17 -9
  41. package/lib/cjs/imodel-components-react/editors/ColorEditor.js.map +1 -1
  42. package/lib/cjs/imodel-components-react/editors/WeightEditor.d.ts.map +1 -1
  43. package/lib/cjs/imodel-components-react/editors/WeightEditor.js +8 -6
  44. package/lib/cjs/imodel-components-react/editors/WeightEditor.js.map +1 -1
  45. package/lib/cjs/imodel-components-react/inputs/QuantityInput.d.ts +1 -1
  46. package/lib/cjs/imodel-components-react/inputs/QuantityInput.d.ts.map +1 -1
  47. package/lib/cjs/imodel-components-react/inputs/QuantityInput.js +18 -12
  48. package/lib/cjs/imodel-components-react/inputs/QuantityInput.js.map +1 -1
  49. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.d.ts +1 -1
  50. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.d.ts.map +1 -1
  51. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js +35 -21
  52. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
  53. package/lib/cjs/imodel-components-react/lineweight/Swatch.d.ts.map +1 -1
  54. package/lib/cjs/imodel-components-react/lineweight/Swatch.js +12 -16
  55. package/lib/cjs/imodel-components-react/lineweight/Swatch.js.map +1 -1
  56. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.d.ts.map +1 -1
  57. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.js +14 -10
  58. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
  59. package/lib/cjs/imodel-components-react/navigationaids/Cube.d.ts.map +1 -1
  60. package/lib/cjs/imodel-components-react/navigationaids/Cube.js +31 -11
  61. package/lib/cjs/imodel-components-react/navigationaids/Cube.js.map +1 -1
  62. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.d.ts.map +1 -1
  63. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js +98 -39
  64. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
  65. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts.map +1 -1
  66. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.js +171 -66
  67. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
  68. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.d.ts.map +1 -1
  69. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js +19 -12
  70. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
  71. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.d.ts.map +1 -1
  72. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js +4 -6
  73. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
  74. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.d.ts.map +1 -1
  75. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js +12 -8
  76. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
  77. package/lib/cjs/imodel-components-react/quantityformat/FormatType.d.ts.map +1 -1
  78. package/lib/cjs/imodel-components-react/quantityformat/FormatType.js +31 -10
  79. package/lib/cjs/imodel-components-react/quantityformat/FormatType.js.map +1 -1
  80. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.d.ts.map +1 -1
  81. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js +15 -8
  82. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
  83. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.d.ts.map +1 -1
  84. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js +34 -22
  85. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
  86. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.d.ts.map +1 -1
  87. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js +61 -38
  88. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
  89. package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts.map +1 -1
  90. package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.js +8 -7
  91. package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.js.map +1 -1
  92. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.d.ts.map +1 -1
  93. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.js +55 -16
  94. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.js.map +1 -1
  95. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.d.ts.map +1 -1
  96. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.js +11 -5
  97. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.js.map +1 -1
  98. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.d.ts.map +1 -1
  99. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.js +39 -12
  100. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.js.map +1 -1
  101. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.d.ts.map +1 -1
  102. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.js +11 -5
  103. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.js.map +1 -1
  104. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.d.ts.map +1 -1
  105. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.js +19 -7
  106. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.js.map +1 -1
  107. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.d.ts.map +1 -1
  108. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js +21 -8
  109. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js.map +1 -1
  110. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.d.ts.map +1 -1
  111. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.js +11 -5
  112. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.js.map +1 -1
  113. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.d.ts.map +1 -1
  114. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.js +13 -6
  115. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.js.map +1 -1
  116. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts.map +1 -1
  117. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +21 -10
  118. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
  119. package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.d.ts.map +1 -1
  120. package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.js +30 -13
  121. package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.js.map +1 -1
  122. package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.d.ts.map +1 -1
  123. package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.js +15 -7
  124. package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.js.map +1 -1
  125. package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.d.ts.map +1 -1
  126. package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.js +11 -9
  127. package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.js.map +1 -1
  128. package/lib/cjs/imodel-components-react/timeline/InlineEdit.d.ts.map +1 -1
  129. package/lib/cjs/imodel-components-react/timeline/InlineEdit.js +7 -4
  130. package/lib/cjs/imodel-components-react/timeline/InlineEdit.js.map +1 -1
  131. package/lib/cjs/imodel-components-react/timeline/InlineEdit.scss +4 -4
  132. package/lib/cjs/imodel-components-react/timeline/PlayerButton.d.ts.map +1 -1
  133. package/lib/cjs/imodel-components-react/timeline/PlayerButton.js +3 -3
  134. package/lib/cjs/imodel-components-react/timeline/PlayerButton.js.map +1 -1
  135. package/lib/cjs/imodel-components-react/timeline/Scrubber.d.ts +1 -1
  136. package/lib/cjs/imodel-components-react/timeline/Scrubber.d.ts.map +1 -1
  137. package/lib/cjs/imodel-components-react/timeline/Scrubber.js +32 -17
  138. package/lib/cjs/imodel-components-react/timeline/Scrubber.js.map +1 -1
  139. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.d.ts.map +1 -1
  140. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.js +61 -27
  141. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
  142. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.d.ts.map +1 -1
  143. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.js +4 -5
  144. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.js.map +1 -1
  145. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.scss +4 -4
  146. package/lib/cjs/imodel-components-react/timeline/Timeline.scss +124 -124
  147. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.d.ts.map +1 -1
  148. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js +56 -29
  149. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
  150. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.scss +4 -4
  151. package/lib/cjs/imodel-components-react/timeline/interfaces.d.ts.map +1 -1
  152. package/lib/cjs/imodel-components-react/timeline/interfaces.js +3 -3
  153. package/lib/cjs/imodel-components-react/timeline/interfaces.js.map +1 -1
  154. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.d.ts +2 -2
  155. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.d.ts.map +1 -1
  156. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js +40 -26
  157. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
  158. package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.d.ts.map +1 -1
  159. package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.js +5 -4
  160. package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.js.map +1 -1
  161. package/lib/cjs/imodel-components-react.js +3 -3
  162. package/lib/cjs/imodel-components-react.js.map +1 -1
  163. package/lib/esm/imodel-components-react/UiIModelComponents.d.ts.map +1 -1
  164. package/lib/esm/imodel-components-react/UiIModelComponents.js +11 -6
  165. package/lib/esm/imodel-components-react/UiIModelComponents.js.map +1 -1
  166. package/lib/esm/imodel-components-react/color/AlphaSlider.d.ts.map +1 -1
  167. package/lib/esm/imodel-components-react/color/AlphaSlider.js +23 -17
  168. package/lib/esm/imodel-components-react/color/AlphaSlider.js.map +1 -1
  169. package/lib/esm/imodel-components-react/color/AlphaSlider.scss +15 -7
  170. package/lib/esm/imodel-components-react/color/ColorPickerButton.d.ts +1 -1
  171. package/lib/esm/imodel-components-react/color/ColorPickerButton.d.ts.map +1 -1
  172. package/lib/esm/imodel-components-react/color/ColorPickerButton.js +10 -8
  173. package/lib/esm/imodel-components-react/color/ColorPickerButton.js.map +1 -1
  174. package/lib/esm/imodel-components-react/color/ColorPickerDialog.d.ts +1 -1
  175. package/lib/esm/imodel-components-react/color/ColorPickerDialog.d.ts.map +1 -1
  176. package/lib/esm/imodel-components-react/color/ColorPickerDialog.js +7 -9
  177. package/lib/esm/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
  178. package/lib/esm/imodel-components-react/color/ColorPickerPopup.d.ts +1 -1
  179. package/lib/esm/imodel-components-react/color/ColorPickerPopup.d.ts.map +1 -1
  180. package/lib/esm/imodel-components-react/color/ColorPickerPopup.js +13 -14
  181. package/lib/esm/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
  182. package/lib/esm/imodel-components-react/color/HueSlider.d.ts +1 -1
  183. package/lib/esm/imodel-components-react/color/HueSlider.d.ts.map +1 -1
  184. package/lib/esm/imodel-components-react/color/HueSlider.js +32 -15
  185. package/lib/esm/imodel-components-react/color/HueSlider.js.map +1 -1
  186. package/lib/esm/imodel-components-react/color/HueSlider.scss +27 -10
  187. package/lib/esm/imodel-components-react/color/SaturationPicker.d.ts +1 -1
  188. package/lib/esm/imodel-components-react/color/SaturationPicker.d.ts.map +1 -1
  189. package/lib/esm/imodel-components-react/color/SaturationPicker.js +14 -11
  190. package/lib/esm/imodel-components-react/color/SaturationPicker.js.map +1 -1
  191. package/lib/esm/imodel-components-react/color/SaturationPicker.scss +5 -4
  192. package/lib/esm/imodel-components-react/color/Swatch.d.ts.map +1 -1
  193. package/lib/esm/imodel-components-react/color/Swatch.js +5 -8
  194. package/lib/esm/imodel-components-react/color/Swatch.js.map +1 -1
  195. package/lib/esm/imodel-components-react/color/getCSSColorFromDef.d.ts.map +1 -1
  196. package/lib/esm/imodel-components-react/color/getCSSColorFromDef.js +3 -3
  197. package/lib/esm/imodel-components-react/color/getCSSColorFromDef.js.map +1 -1
  198. package/lib/esm/imodel-components-react/editors/ColorEditor.d.ts.map +1 -1
  199. package/lib/esm/imodel-components-react/editors/ColorEditor.js +18 -10
  200. package/lib/esm/imodel-components-react/editors/ColorEditor.js.map +1 -1
  201. package/lib/esm/imodel-components-react/editors/WeightEditor.d.ts.map +1 -1
  202. package/lib/esm/imodel-components-react/editors/WeightEditor.js +10 -8
  203. package/lib/esm/imodel-components-react/editors/WeightEditor.js.map +1 -1
  204. package/lib/esm/imodel-components-react/inputs/QuantityInput.d.ts +1 -1
  205. package/lib/esm/imodel-components-react/inputs/QuantityInput.d.ts.map +1 -1
  206. package/lib/esm/imodel-components-react/inputs/QuantityInput.js +18 -12
  207. package/lib/esm/imodel-components-react/inputs/QuantityInput.js.map +1 -1
  208. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.d.ts +1 -1
  209. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.d.ts.map +1 -1
  210. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js +37 -23
  211. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
  212. package/lib/esm/imodel-components-react/lineweight/Swatch.d.ts.map +1 -1
  213. package/lib/esm/imodel-components-react/lineweight/Swatch.js +12 -16
  214. package/lib/esm/imodel-components-react/lineweight/Swatch.js.map +1 -1
  215. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.d.ts.map +1 -1
  216. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.js +14 -10
  217. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
  218. package/lib/esm/imodel-components-react/navigationaids/Cube.d.ts.map +1 -1
  219. package/lib/esm/imodel-components-react/navigationaids/Cube.js +31 -11
  220. package/lib/esm/imodel-components-react/navigationaids/Cube.js.map +1 -1
  221. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.d.ts.map +1 -1
  222. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js +100 -41
  223. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
  224. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts.map +1 -1
  225. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.js +173 -68
  226. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
  227. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.d.ts.map +1 -1
  228. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js +19 -12
  229. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
  230. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.d.ts.map +1 -1
  231. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js +4 -6
  232. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
  233. package/lib/esm/imodel-components-react/quantityformat/FormatSample.d.ts.map +1 -1
  234. package/lib/esm/imodel-components-react/quantityformat/FormatSample.js +12 -8
  235. package/lib/esm/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
  236. package/lib/esm/imodel-components-react/quantityformat/FormatType.d.ts.map +1 -1
  237. package/lib/esm/imodel-components-react/quantityformat/FormatType.js +31 -10
  238. package/lib/esm/imodel-components-react/quantityformat/FormatType.js.map +1 -1
  239. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.d.ts.map +1 -1
  240. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js +15 -8
  241. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
  242. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.d.ts.map +1 -1
  243. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js +34 -22
  244. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
  245. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.d.ts.map +1 -1
  246. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js +61 -38
  247. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
  248. package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts.map +1 -1
  249. package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.js +8 -7
  250. package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.js.map +1 -1
  251. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.d.ts.map +1 -1
  252. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.js +55 -16
  253. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.js.map +1 -1
  254. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.d.ts.map +1 -1
  255. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.js +11 -5
  256. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.js.map +1 -1
  257. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.d.ts.map +1 -1
  258. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.js +39 -12
  259. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.js.map +1 -1
  260. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.d.ts.map +1 -1
  261. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.js +11 -5
  262. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.js.map +1 -1
  263. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.d.ts.map +1 -1
  264. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.js +19 -7
  265. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.js.map +1 -1
  266. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.d.ts.map +1 -1
  267. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js +21 -8
  268. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js.map +1 -1
  269. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.d.ts.map +1 -1
  270. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.js +11 -5
  271. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.js.map +1 -1
  272. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.d.ts.map +1 -1
  273. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.js +13 -6
  274. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.js.map +1 -1
  275. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts.map +1 -1
  276. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +21 -10
  277. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
  278. package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.d.ts.map +1 -1
  279. package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.js +30 -13
  280. package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.js.map +1 -1
  281. package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.d.ts.map +1 -1
  282. package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.js +16 -8
  283. package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.js.map +1 -1
  284. package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.d.ts.map +1 -1
  285. package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.js +11 -9
  286. package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.js.map +1 -1
  287. package/lib/esm/imodel-components-react/timeline/InlineEdit.d.ts.map +1 -1
  288. package/lib/esm/imodel-components-react/timeline/InlineEdit.js +7 -4
  289. package/lib/esm/imodel-components-react/timeline/InlineEdit.js.map +1 -1
  290. package/lib/esm/imodel-components-react/timeline/InlineEdit.scss +4 -4
  291. package/lib/esm/imodel-components-react/timeline/PlayerButton.d.ts.map +1 -1
  292. package/lib/esm/imodel-components-react/timeline/PlayerButton.js +3 -3
  293. package/lib/esm/imodel-components-react/timeline/PlayerButton.js.map +1 -1
  294. package/lib/esm/imodel-components-react/timeline/Scrubber.d.ts +1 -1
  295. package/lib/esm/imodel-components-react/timeline/Scrubber.d.ts.map +1 -1
  296. package/lib/esm/imodel-components-react/timeline/Scrubber.js +32 -17
  297. package/lib/esm/imodel-components-react/timeline/Scrubber.js.map +1 -1
  298. package/lib/esm/imodel-components-react/timeline/SolarTimeline.d.ts.map +1 -1
  299. package/lib/esm/imodel-components-react/timeline/SolarTimeline.js +63 -29
  300. package/lib/esm/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
  301. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.d.ts.map +1 -1
  302. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.js +4 -5
  303. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.js.map +1 -1
  304. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.scss +4 -4
  305. package/lib/esm/imodel-components-react/timeline/Timeline.scss +124 -124
  306. package/lib/esm/imodel-components-react/timeline/TimelineComponent.d.ts.map +1 -1
  307. package/lib/esm/imodel-components-react/timeline/TimelineComponent.js +58 -31
  308. package/lib/esm/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
  309. package/lib/esm/imodel-components-react/timeline/TimelineComponent.scss +4 -4
  310. package/lib/esm/imodel-components-react/timeline/interfaces.d.ts.map +1 -1
  311. package/lib/esm/imodel-components-react/timeline/interfaces.js +3 -3
  312. package/lib/esm/imodel-components-react/timeline/interfaces.js.map +1 -1
  313. package/lib/esm/imodel-components-react/viewport/ViewportComponent.d.ts +2 -2
  314. package/lib/esm/imodel-components-react/viewport/ViewportComponent.d.ts.map +1 -1
  315. package/lib/esm/imodel-components-react/viewport/ViewportComponent.js +42 -28
  316. package/lib/esm/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
  317. package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.d.ts.map +1 -1
  318. package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.js +5 -4
  319. package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.js.map +1 -1
  320. package/lib/esm/imodel-components-react.js +3 -3
  321. package/lib/esm/imodel-components-react.js.map +1 -1
  322. package/package.json +15 -24
@@ -1 +1 @@
1
- {"version":3,"file":"Swatch.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/color/Swatch.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,yBAAuB;AACvB,4DAAoC;AACpC,6CAA+B;AAG/B,6DAA0D;AAc1D;;GAEG;AACH,SAAgB,WAAW,CAAC,KAAuB;IACjD,MAAM,UAAU,GAAG,IAAA,uCAAkB,EAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACtD,MAAM,UAAU,GAAwB;QACtC,eAAe,EAAE,UAAU;QAC3B,GAAG,KAAK,CAAC,KAAK;KACf,CAAC;IAEF,MAAM,WAAW,GAAG,CAAC,CAAmB,EAAE,EAAE;QAC1C,uBAAuB;QACvB,IAAI,KAAK,IAAI,KAAK,CAAC,WAAW;YAC5B,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IACzC,CAAC,CAAC;IAEF,MAAM,OAAO,GAAG,IAAA,oBAAU,EACxB,yBAAyB,EACzB,KAAK,CAAC,KAAK,IAAI,OAAO,EACtB,KAAK,CAAC,SAAS,CAChB,CAAC;IAEF,MAAM;IACJ,6DAA6D;IAC7D,WAAW,EAAE,QAAQ,EAAE,KAAK,EAAE,6CAA6C;IAC3E,wCAAwC;IACxC,GAAG,UAAU,CAAC,qBAAqB;MACpC,GAAG,KAAK,CAAC;IAEV,OAAO,mCAAY,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,GAAI,CAAC;AACjG,CAAC;AA3BD,kCA2BC","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 \"./Swatch.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { ColorDef } from \"@itwin/core-common\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { getCSSColorFromDef } from \"./getCSSColorFromDef\";\n\n/** Properties for the [[ColorSwatch]] React component\n * @beta\n */\nexport interface ColorSwatchProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, CommonProps {\n /** color specification */\n colorDef: ColorDef;\n /** function to run when user selects color swatch */\n onColorPick?: ((color: ColorDef, e: React.MouseEvent) => void) | undefined;\n /** Show swatches as squares unless round is set to true */\n round?: boolean;\n}\n\n/** ColorSwatch Functional component displays a color swatch in a button\n * @beta\n */\nexport function ColorSwatch(props: ColorSwatchProps) {\n const rgbaString = getCSSColorFromDef(props.colorDef);\n const colorStyle: React.CSSProperties = {\n backgroundColor: rgbaString,\n ...props.style,\n };\n\n const handleClick = (e: React.MouseEvent) => {\n // istanbul ignore else\n if (props && props.onColorPick)\n props.onColorPick(props.colorDef, e);\n };\n\n const classes = classnames(\n \"components-color-swatch\",\n props.round && \"round\",\n props.className,\n );\n\n const {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n onColorPick, colorDef, round, // do not pass on color swatch specific props\n // eslint-disable-next-line comma-dangle\n ...otherProps // pass-through props\n } = props;\n\n return <button {...otherProps} style={colorStyle} className={classes} onClick={handleClick} />;\n}\n"]}
1
+ {"version":3,"file":"Swatch.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/color/Swatch.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,yBAAuB;AACvB,4DAAoC;AACpC,6CAA+B;AAG/B,6DAA0D;AAgB1D;;GAEG;AACH,SAAgB,WAAW,CAAC,KAAuB;IACjD,MAAM,UAAU,GAAG,IAAA,uCAAkB,EAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACtD,MAAM,UAAU,GAAwB;QACtC,eAAe,EAAE,UAAU;QAC3B,GAAG,KAAK,CAAC,KAAK;KACf,CAAC;IAEF,MAAM,WAAW,GAAG,CAAC,CAAmB,EAAE,EAAE;QAC1C,uBAAuB;QACvB,IAAI,KAAK,IAAI,KAAK,CAAC,WAAW;YAAE,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IACvE,CAAC,CAAC;IAEF,MAAM,OAAO,GAAG,IAAA,oBAAU,EACxB,yBAAyB,EACzB,KAAK,CAAC,KAAK,IAAI,OAAO,EACtB,KAAK,CAAC,SAAS,CAChB,CAAC;IAEF,MAAM,EACJ,WAAW,EACX,QAAQ,EACR,KAAK,EAAE,6CAA6C;IACpD,GAAG,UAAU,CAAC,qBAAqB;MACpC,GAAG,KAAK,CAAC;IAEV,OAAO,CACL,mCACM,UAAU,EACd,KAAK,EAAE,UAAU,EACjB,SAAS,EAAE,OAAO,EAClB,OAAO,EAAE,WAAW,GACpB,CACH,CAAC;AACJ,CAAC;AAjCD,kCAiCC","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 \"./Swatch.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { ColorDef } from \"@itwin/core-common\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { getCSSColorFromDef } from \"./getCSSColorFromDef\";\n\n/** Properties for the [[ColorSwatch]] React component\n * @beta\n */\nexport interface ColorSwatchProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n CommonProps {\n /** color specification */\n colorDef: ColorDef;\n /** function to run when user selects color swatch */\n onColorPick?: ((color: ColorDef, e: React.MouseEvent) => void) | undefined;\n /** Show swatches as squares unless round is set to true */\n round?: boolean;\n}\n\n/** ColorSwatch Functional component displays a color swatch in a button\n * @beta\n */\nexport function ColorSwatch(props: ColorSwatchProps) {\n const rgbaString = getCSSColorFromDef(props.colorDef);\n const colorStyle: React.CSSProperties = {\n backgroundColor: rgbaString,\n ...props.style,\n };\n\n const handleClick = (e: React.MouseEvent) => {\n // istanbul ignore else\n if (props && props.onColorPick) props.onColorPick(props.colorDef, e);\n };\n\n const classes = classnames(\n \"components-color-swatch\",\n props.round && \"round\",\n props.className\n );\n\n const {\n onColorPick,\n colorDef,\n round, // do not pass on color swatch specific props\n ...otherProps // pass-through props\n } = props;\n\n return (\n <button\n {...otherProps}\n style={colorStyle}\n className={classes}\n onClick={handleClick}\n />\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"getCSSColorFromDef.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/color/getCSSColorFromDef.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnD,gBAAgB;AAChB,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAU7D"}
1
+ {"version":3,"file":"getCSSColorFromDef.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/color/getCSSColorFromDef.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnD,gBAAgB;AAChB,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAS7D"}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
6
  /** @packageDocumentation
7
7
  * @module Color
8
8
  */
@@ -1 +1 @@
1
- {"version":3,"file":"getCSSColorFromDef.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/color/getCSSColorFromDef.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAIH,gBAAgB;AAChB,SAAgB,kBAAkB,CAAC,QAAkB;IACnD,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC;IACvC,IAAI,UAAU,GAAG,EAAE,CAAC;IACpB,IAAI,CAAC,KAAK,CAAC;QACT,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;SAChC;QACH,MAAM,KAAK,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAC3C,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,GAAG,CAAC;KAC9C;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAVD,gDAUC","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 type { ColorDef } from \"@itwin/core-common\";\n\n/** @internal */\nexport function getCSSColorFromDef(colorDef: ColorDef): string {\n const { b, g, r, t } = colorDef.colors;\n let rgbaString = \"\";\n if (t === 0)\n rgbaString = `rgb(${r},${g},${b})`;\n else {\n const alpha = ((255 - t) / 255).toFixed(2);\n rgbaString = `rgba(${r},${g},${b},${alpha})`;\n }\n return rgbaString;\n}\n"]}
1
+ {"version":3,"file":"getCSSColorFromDef.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/color/getCSSColorFromDef.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAIH,gBAAgB;AAChB,SAAgB,kBAAkB,CAAC,QAAkB;IACnD,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC;IACvC,IAAI,UAAU,GAAG,EAAE,CAAC;IACpB,IAAI,CAAC,KAAK,CAAC;QAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;SAC3C;QACH,MAAM,KAAK,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAC3C,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,GAAG,CAAC;KAC9C;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AATD,gDASC","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 type { ColorDef } from \"@itwin/core-common\";\n\n/** @internal */\nexport function getCSSColorFromDef(colorDef: ColorDef): string {\n const { b, g, r, t } = colorDef.colors;\n let rgbaString = \"\";\n if (t === 0) rgbaString = `rgb(${r},${g},${b})`;\n else {\n const alpha = ((255 - t) / 255).toFixed(2);\n rgbaString = `rgba(${r},${g},${b},${alpha})`;\n }\n return rgbaString;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ColorEditor.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/editors/ColorEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAE5B,OAAO,KAAK,KAAK,MAAM,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AAoB,CAAC;AAE5B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,EAIV,aAAa,EACd,MAAM,uBAAuB,CAAC;AAO/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EACL,kBAAkB,EAEnB,MAAM,yBAAyB,CAAC;AAGjC,gBAAgB;AAChB,UAAU,gBAAgB;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,QAAQ,EAAE,CAAC;CAC7B;AAED;;GAEG;AACH,qBAAa,WACX,SAAQ,KAAK,CAAC,aAAa,CAAC,mBAAmB,EAAE,gBAAgB,CACjE,YAAW,UAAU;IAErB,OAAO,CAAC,cAAc,CACF;IAEpB,gBAAgB;IAChB,SAAyB,KAAK,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAKxD;IAEW,gBAAgB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IAgBnE,IAAW,WAAW,IAAI,WAAW,GAAG,IAAI,CAE3C;IAED,IAAW,QAAQ,IAAI,OAAO,CAE7B;IAED,OAAO,CAAC,QAAQ;IAWhB,OAAO,CAAC,YAAY,CAkBlB;IAEF,gBAAgB;IACA,iBAAiB;IAIjC,gBAAgB;IACA,kBAAkB,CAAC,SAAS,EAAE,mBAAmB;YAMnD,iBAAiB;IAyC/B,gBAAgB;IACA,MAAM;CAwBvB;AAED;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,kBAAkB;IACzD,IAAW,SAAS,IAAI,KAAK,CAAC,SAAS,CAEtC;CACF"}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
6
  /** @packageDocumentation
7
7
  * @module PropertyEditors
8
8
  */
@@ -92,18 +92,20 @@ class ColorEditor extends React.PureComponent {
92
92
  }
93
93
  setFocus() {
94
94
  // istanbul ignore else
95
- if (this._buttonElement && this._buttonElement.current && !this.state.isDisabled) {
95
+ if (this._buttonElement &&
96
+ this._buttonElement.current &&
97
+ !this.state.isDisabled) {
96
98
  this._buttonElement.current.focus();
97
99
  }
98
100
  }
99
101
  /** @internal */
100
102
  componentDidMount() {
101
- this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises
103
+ void this.setStateFromProps();
102
104
  }
103
105
  /** @internal */
104
106
  componentDidUpdate(prevProps) {
105
107
  if (this.props.propertyRecord !== prevProps.propertyRecord) {
106
- this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises
108
+ void this.setStateFromProps();
107
109
  }
108
110
  }
109
111
  async setStateFromProps() {
@@ -113,8 +115,12 @@ class ColorEditor extends React.PureComponent {
113
115
  const colorValue = record.value.value;
114
116
  let numColumns = 4;
115
117
  const availableColors = new Array();
116
- const readonly = record && undefined !== record.isReadonly ? record.isReadonly : /* istanbul ignore next */ false;
117
- const isDisabled = record ? record.isDisabled : /* istanbul ignore next */ undefined;
118
+ const readonly = record && undefined !== record.isReadonly
119
+ ? record.isReadonly
120
+ : /* istanbul ignore next */ false;
121
+ const isDisabled = record
122
+ ? record.isDisabled
123
+ : /* istanbul ignore next */ undefined;
118
124
  if (record.property.editor && record.property.editor.params) {
119
125
  const colorParams = record.property.editor.params.find((param) => param.type === appui_abstract_1.PropertyEditorParamTypes.ColorData);
120
126
  // istanbul ignore else
@@ -138,7 +144,9 @@ class ColorEditor extends React.PureComponent {
138
144
  render() {
139
145
  const colorDef = core_common_1.ColorDef.create(this.state.colorValue);
140
146
  return (React.createElement("div", { className: (0, classnames_1.default)("components-color-editor", this.props.className), style: this.props.style },
141
- React.createElement(ColorPickerButton_1.ColorPickerButton, { ref: this._buttonElement, initialColor: colorDef, colorDefs: this.state.availableColors.length > 0 ? this.state.availableColors : [colorDef], numColumns: this.state.numColumns, disabled: this.state.isDisabled ? true : false, readonly: this.state.readonly, onColorPick: this._onColorPick, "data-testid": "components-color-editor" })));
147
+ React.createElement(ColorPickerButton_1.ColorPickerButton, { ref: this._buttonElement, initialColor: colorDef, colorDefs: this.state.availableColors.length > 0
148
+ ? this.state.availableColors
149
+ : [colorDef], numColumns: this.state.numColumns, disabled: this.state.isDisabled ? true : false, readonly: this.state.readonly, onColorPick: this._onColorPick, "data-testid": "components-color-editor" })));
142
150
  }
143
151
  }
144
152
  exports.ColorEditor = ColorEditor;
@@ -1 +1 @@
1
- {"version":3,"file":"ColorEditor.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/editors/ColorEditor.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,8BAA4B;AAC5B,4DAAoC;AACpC,6CAA+B;AAC/B,oDAA8C;AAG9C,0DAE+B;AAE/B,8DAAoF;AACpF,kEAA+D;AAW/D;;GAEG;AACH,MAAa,WAAY,SAAQ,KAAK,CAAC,aAAoD;IAA3F;;QACU,mBAAc,GAAuC,KAAK,CAAC,SAAS,EAAE,CAAC;QAE/E,gBAAgB;QACS,UAAK,GAA+B;YAC3D,UAAU,EAAE,CAAC;YACb,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,CAAC;YACb,eAAe,EAAE,EAAE;SACpB,CAAC;QAiCM,iBAAY,GAAG,CAAC,KAAe,EAAE,EAAE;YACzC,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,cAAgC,CAAC;YAEnE,IAAI,CAAC,QAAQ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YAAY,iBAClB,yBAAyB,GAAG,CACtC,CACP,CAAC;IACJ,CAAC;CACF;AAzHD,kCAyHC;AAED;;;GAGG;AACH,MAAa,mBAAoB,SAAQ,qCAAkB;IACzD,IAAW,SAAS;QAClB,OAAO,oBAAC,WAAW,OAAG,CAAC;IACzB,CAAC;CACF;AAJD,kDAIC;AAED,wCAAqB,CAAC,cAAc,CAAC,kCAAiB,CAAC,MAAM,EAAE,mBAAmB,EAAE,oCAAmB,CAAC,WAAW,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./ColorEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { ColorDef } from \"@itwin/core-common\";\nimport type {\n ColorEditorParams, PropertyEditorParams, PropertyRecord, PropertyValue} from \"@itwin/appui-abstract\";\nimport { PropertyEditorParamTypes, PropertyValueFormat,\n StandardEditorNames, StandardTypeNames,\n} from \"@itwin/appui-abstract\";\nimport type { PropertyEditorProps, TypeEditor } from \"@itwin/components-react\";\nimport { PropertyEditorBase, PropertyEditorManager } from \"@itwin/components-react\";\nimport { ColorPickerButton } from \"../color/ColorPickerButton\";\n\n/** @internal */\ninterface ColorEditorState {\n colorValue: number;\n readonly: boolean;\n isDisabled?: boolean;\n numColumns: number;\n availableColors: ColorDef[];\n}\n\n/** ColorEditor React component that is a property editor with text input\n * @beta\n */\nexport class ColorEditor extends React.PureComponent<PropertyEditorProps, ColorEditorState> implements TypeEditor {\n private _buttonElement: React.RefObject<HTMLButtonElement> = React.createRef();\n\n /** @internal */\n public override readonly state: Readonly<ColorEditorState> = {\n colorValue: 0,\n readonly: false,\n numColumns: 4,\n availableColors: [],\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.colorValue,\n displayValue: \"\",\n };\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._buttonElement.current;\n }\n\n public get hasFocus(): boolean {\n return document.activeElement === this._buttonElement.current;\n }\n\n private setFocus(): void {\n // istanbul ignore else\n if (this._buttonElement && this._buttonElement.current && !this.state.isDisabled) {\n this._buttonElement.current.focus();\n }\n }\n\n private _onColorPick = (color: ColorDef) => {\n const propertyRecord = this.props.propertyRecord as PropertyRecord;\n\n this.setState({\n colorValue: color.tbgr,\n }, async () => {\n // istanbul ignore else\n if (propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (propertyValue !== undefined) {\n this.props.onCommit({ propertyRecord, newValue: propertyValue });\n }\n }\n });\n };\n\n /** @internal */\n public override componentDidMount() {\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\n }\n }\n\n private async setStateFromProps() {\n const record = this.props.propertyRecord;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n const colorValue = record.value.value as number;\n let numColumns = 4;\n const availableColors = new Array<ColorDef>();\n const readonly = record && undefined !== record.isReadonly ? record.isReadonly : /* istanbul ignore next */ false;\n const isDisabled = record ? record.isDisabled : /* istanbul ignore next */ undefined;\n\n if (record.property.editor && record.property.editor.params) {\n const colorParams = record.property.editor.params.find((param: PropertyEditorParams) => param.type === PropertyEditorParamTypes.ColorData) as ColorEditorParams;\n // istanbul ignore else\n if (colorParams) {\n colorParams.colorValues.forEach((colorNumber: number) => {\n availableColors.push(ColorDef.create(colorNumber));\n });\n // istanbul ignore else\n if (colorParams.numColumns)\n numColumns = colorParams.numColumns;\n }\n }\n this.setState(\n { colorValue, readonly, isDisabled, numColumns, availableColors },\n () => {\n if (this.props.setFocus) {\n this.setFocus();\n }\n },\n );\n }\n }\n\n /** @internal */\n public override render() {\n const colorDef = ColorDef.create(this.state.colorValue);\n return (\n <div className={classnames(\"components-color-editor\", this.props.className)} style={this.props.style}>\n <ColorPickerButton ref={this._buttonElement}\n initialColor={colorDef}\n colorDefs={this.state.availableColors.length > 0 ? this.state.availableColors : [colorDef]}\n numColumns={this.state.numColumns}\n disabled={this.state.isDisabled ? true : false}\n readonly={this.state.readonly}\n onColorPick={this._onColorPick}\n data-testid=\"components-color-editor\" />\n </div>\n );\n }\n}\n\n/** Color Property Editor registered for the \"number\" type name and \"color-picker\" editor name.\n * It uses the [[ColorEditor]] React component.\n * @beta\n */\nexport class ColorPropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <ColorEditor />;\n }\n}\n\nPropertyEditorManager.registerEditor(StandardTypeNames.Number, ColorPropertyEditor, StandardEditorNames.ColorPicker);\n"]}
1
+ {"version":3,"file":"ColorEditor.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/editors/ColorEditor.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,8BAA4B;AAC5B,4DAAoC;AACpC,6CAA+B;AAC/B,oDAA8C;AAO9C,0DAK+B;AAE/B,8DAGiC;AACjC,kEAA+D;AAW/D;;GAEG;AACH,MAAa,WACX,SAAQ,KAAK,CAAC,aAAoD;IADpE;;QAIU,mBAAc,GACpB,KAAK,CAAC,SAAS,EAAE,CAAC;QAEpB,gBAAgB;QACS,UAAK,GAA+B;YAC3D,UAAU,EAAE,CAAC;YACb,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,CAAC;YACb,eAAe,EAAE,EAAE;SACpB,CAAC;QAqCM,iBAAY,GAAG,CA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AC,KAAK,EAC9C,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAC7B,WAAW,EAAE,IAAI,CAAC,YAAY,iBAClB,yBAAyB,GACrC,CACE,CACP,CAAC;IACJ,CAAC;CACF;AApJD,kCAoJC;AAED;;;GAGG;AACH,MAAa,mBAAoB,SAAQ,qCAAkB;IACzD,IAAW,SAAS;QAClB,OAAO,oBAAC,WAAW,OAAG,CAAC;IACzB,CAAC;CACF;AAJD,kDAIC;AAED,wCAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,MAAM,EACxB,mBAAmB,EACnB,oCAAmB,CAAC,WAAW,CAChC,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 PropertyEditors\n */\n\nimport \"./ColorEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { ColorDef } from \"@itwin/core-common\";\nimport type {\n ColorEditorParams,\n PropertyEditorParams,\n PropertyRecord,\n PropertyValue,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyEditorParamTypes,\n PropertyValueFormat,\n StandardEditorNames,\n StandardTypeNames,\n} from \"@itwin/appui-abstract\";\nimport type { PropertyEditorProps, TypeEditor } from \"@itwin/components-react\";\nimport {\n PropertyEditorBase,\n PropertyEditorManager,\n} from \"@itwin/components-react\";\nimport { ColorPickerButton } from \"../color/ColorPickerButton\";\n\n/** @internal */\ninterface ColorEditorState {\n colorValue: number;\n readonly: boolean;\n isDisabled?: boolean;\n numColumns: number;\n availableColors: ColorDef[];\n}\n\n/** ColorEditor React component that is a property editor with text input\n * @beta\n */\nexport class ColorEditor\n extends React.PureComponent<PropertyEditorProps, ColorEditorState>\n implements TypeEditor\n{\n private _buttonElement: React.RefObject<HTMLButtonElement> =\n React.createRef();\n\n /** @internal */\n public override readonly state: Readonly<ColorEditorState> = {\n colorValue: 0,\n readonly: false,\n numColumns: 4,\n availableColors: [],\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.colorValue,\n displayValue: \"\",\n };\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._buttonElement.current;\n }\n\n public get hasFocus(): boolean {\n return document.activeElement === this._buttonElement.current;\n }\n\n private setFocus(): void {\n // istanbul ignore else\n if (\n this._buttonElement &&\n this._buttonElement.current &&\n !this.state.isDisabled\n ) {\n this._buttonElement.current.focus();\n }\n }\n\n private _onColorPick = (color: ColorDef) => {\n const propertyRecord = this.props.propertyRecord as PropertyRecord;\n\n this.setState(\n {\n colorValue: color.tbgr,\n },\n async () => {\n // istanbul ignore else\n if (propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (propertyValue !== undefined) {\n this.props.onCommit({ propertyRecord, newValue: propertyValue });\n }\n }\n }\n );\n };\n\n /** @internal */\n public override componentDidMount() {\n void this.setStateFromProps();\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n void this.setStateFromProps();\n }\n }\n\n private async setStateFromProps() {\n const record = this.props.propertyRecord;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n const colorValue = record.value.value as number;\n let numColumns = 4;\n const availableColors = new Array<ColorDef>();\n const readonly =\n record && undefined !== record.isReadonly\n ? record.isReadonly\n : /* istanbul ignore next */ false;\n const isDisabled = record\n ? record.isDisabled\n : /* istanbul ignore next */ undefined;\n\n if (record.property.editor && record.property.editor.params) {\n const colorParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.ColorData\n ) as ColorEditorParams;\n // istanbul ignore else\n if (colorParams) {\n colorParams.colorValues.forEach((colorNumber: number) => {\n availableColors.push(ColorDef.create(colorNumber));\n });\n // istanbul ignore else\n if (colorParams.numColumns) numColumns = colorParams.numColumns;\n }\n }\n this.setState(\n { colorValue, readonly, isDisabled, numColumns, availableColors },\n () => {\n if (this.props.setFocus) {\n this.setFocus();\n }\n }\n );\n }\n }\n\n /** @internal */\n public override render() {\n const colorDef = ColorDef.create(this.state.colorValue);\n return (\n <div\n className={classnames(\"components-color-editor\", this.props.className)}\n style={this.props.style}\n >\n <ColorPickerButton\n ref={this._buttonElement}\n initialColor={colorDef}\n colorDefs={\n this.state.availableColors.length > 0\n ? this.state.availableColors\n : [colorDef]\n }\n numColumns={this.state.numColumns}\n disabled={this.state.isDisabled ? true : false}\n readonly={this.state.readonly}\n onColorPick={this._onColorPick}\n data-testid=\"components-color-editor\"\n />\n </div>\n );\n }\n}\n\n/** Color Property Editor registered for the \"number\" type name and \"color-picker\" editor name.\n * It uses the [[ColorEditor]] React component.\n * @beta\n */\nexport class ColorPropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <ColorEditor />;\n }\n}\n\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Number,\n ColorPropertyEditor,\n StandardEditorNames.ColorPicker\n);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"WeightEditor.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/editors/WeightEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,qBAAqB,CAAC;AAE7B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAkB,aAAa,EAAC,MAAM,uBAAuB,CAAC;AAE1E,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAyB,MAAM,yBAAyB,CAAC;AAKpF,gBAAgB;AAChB,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C;AAC/E,OAAO,EACL,kBAAkB,EAEnB,MAAM,yBAAyB,CAAC;AAKjC,gBAAgB;AAChB,UAAU,iBAAiB;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,qBAAa,YACX,SAAQ,KAAK,CAAC,aAAa,CAAC,mBAAmB,EAAE,iBAAiB,CAClE,YAAW,UAAU;IAErB,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,iBAAiB,CAAgB;IACzC,OAAO,CAAC,WAAW,CAAqC;IAExD,gBAAgB;IAChB,SAAyB,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAGzD;gBAEU,KAAK,EAAE,mBAAmB;IAgBzB,gBAAgB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IAgBnE,IAAW,WAAW,IAAI,WAAW,GAAG,IAAI,CAE3C;IAED,IAAW,QAAQ,IAAI,OAAO,CAM7B;IAED,OAAO,CAAC,QAAQ;IAOhB,OAAO,CAAC,iBAAiB,CAkBvB;IAEF,gBAAgB;IACA,iBAAiB;IAKjC,gBAAgB;IACA,oBAAoB;IAIpC,gBAAgB;IACA,kBAAkB,CAAC,SAAS,EAAE,mBAAmB;YAMnD,iBAAiB;IAsB/B,gBAAgB;IACA,MAAM;CAuBvB;AAED;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,kBAAkB;IAE1D,IAAW,SAAS,IAAI,KAAK,CAAC,SAAS,CAEtC;CACF"}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
6
  /** @packageDocumentation
7
7
  * @module PropertyEditors
8
8
  */
@@ -114,7 +114,7 @@ class WeightEditor extends React.PureComponent {
114
114
  /** @internal */
115
115
  componentDidMount() {
116
116
  this._isMounted = true;
117
- this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises
117
+ void this.setStateFromProps();
118
118
  }
119
119
  /** @internal */
120
120
  componentWillUnmount() {
@@ -123,7 +123,7 @@ class WeightEditor extends React.PureComponent {
123
123
  /** @internal */
124
124
  componentDidUpdate(prevProps) {
125
125
  if (this.props.propertyRecord !== prevProps.propertyRecord) {
126
- this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises
126
+ void this.setStateFromProps();
127
127
  }
128
128
  }
129
129
  async setStateFromProps() {
@@ -146,7 +146,9 @@ class WeightEditor extends React.PureComponent {
146
146
  /** @internal */
147
147
  render() {
148
148
  return (React.createElement("div", { className: (0, classnames_1.default)("components-weight-editor", this.props.className), style: this.props.style, ref: this._divElement },
149
- React.createElement(WeightPickerButton_1.WeightPickerButton, { ref: (control) => this._control = control, activeWeight: this.state.weightValue, weights: this._availableWeights.length > 0 ? /* istanbul ignore next */ this._availableWeights : undefined, disabled: this.state.isDisabled ? true : false, readonly: this.state.readonly, onLineWeightPick: this._onLineWeightPick, "data-testid": "components-weight-editor" })));
149
+ React.createElement(WeightPickerButton_1.WeightPickerButton, { ref: (control) => (this._control = control), activeWeight: this.state.weightValue, weights: this._availableWeights.length > 0
150
+ ? /* istanbul ignore next */ this._availableWeights
151
+ : undefined, disabled: this.state.isDisabled ? true : false, readonly: this.state.readonly, onLineWeightPick: this._onLineWeightPick, "data-testid": "components-weight-editor" })));
150
152
  }
151
153
  }
152
154
  exports.WeightEditor = WeightEditor;
@@ -1 +1 @@
1
- {"version":3,"file":"WeightEditor.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/editors/WeightEditor.tsx"],"names":[],"mappings":";AAAA;;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IAAI,CAAC,iBAAiB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,0BAA0B,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS,EAC1G,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EAC9C,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAC7B,gBAAgB,EAAE,IAAI,CAAC,iBAAiB,iBAC5B,0BAA0B,GAAG,CACvC,CACP,CAAC;IACJ,CAAC;CACF;AAxID,oCAwIC;AAED;;;GAGG;AACH,MAAa,oBAAqB,SAAQ,qCAAkB;IAC1D,uBAAuB;IACvB,IAAW,SAAS;QAClB,OAAO,oBAAC,YAAY,OAAG,CAAC;IAC1B,CAAC;CACF;AALD,oDAKC;AAED,wCAAqB,CAAC,cAAc,CAAC,kCAAiB,CAAC,MAAM,EAAE,oBAAoB,EAAE,oCAAmB,CAAC,YAAY,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./WeightEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { PropertyRecord, PropertyValue} from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat, StandardEditorNames, StandardTypeNames } from \"@itwin/appui-abstract\";\nimport type { PropertyEditorProps, TypeEditor } from \"@itwin/components-react\";\nimport { PropertyEditorBase, PropertyEditorManager } from \"@itwin/components-react\";\nimport { WeightPickerButton } from \"../lineweight/WeightPickerButton\";\n\n// cspell:ignore lineweight\n\n/** @internal */\ninterface WeightEditorState {\n weightValue: number;\n readonly: boolean;\n isDisabled?: boolean;\n}\n\n/** WeightEditor React component that is a property editor for picking a weight using a [[WeightPickerButton]] component\n * @public\n */\nexport class WeightEditor extends React.PureComponent<PropertyEditorProps, WeightEditorState> implements TypeEditor {\n private _control: any | null = null;\n private _isMounted = false;\n private _availableWeights: number[] = [];\n private _divElement = React.createRef<HTMLDivElement>();\n\n /** @internal */\n public override readonly state: Readonly<WeightEditorState> = {\n weightValue: 0,\n readonly: false,\n };\n\n constructor(props: PropertyEditorProps) {\n super(props);\n\n // TODO: add support for following if we need to specify set of weights to display\n // const record = this.props.propertyRecord;\n // if (record && record.property && record.property.editor && record.property.editor.params) {\n // const weightParams = record.property.editor.params.find((param: PropertyEditorParams) => param.type === PropertyEditorParamTypes.ColorData) as WeightEditorParams;\n // // istanbul ignore else\n // if (weightParams) {\n // weightParams.weightValues.forEach((weight: number) => {\n // this._availableWeights.push(weight);\n // });\n // }\n // }\n }\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.weightValue,\n displayValue: \"\",\n };\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._divElement.current;\n }\n\n public get hasFocus(): boolean {\n let containsFocus = false;\n // istanbul ignore else\n if (this._divElement.current)\n containsFocus = this._divElement.current.contains(document.activeElement);\n return containsFocus;\n }\n\n private setFocus(): void {\n // istanbul ignore else\n if (this._control && !this.state.isDisabled) {\n this._control.setFocus();\n }\n }\n\n private _onLineWeightPick = (weight: number) => {\n const propertyRecord = this.props.propertyRecord as PropertyRecord;\n\n this.setState({\n weightValue: weight,\n }, async () => {\n // istanbul ignore else\n if (propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (propertyValue !== undefined) {\n this.props.onCommit({ propertyRecord, newValue: propertyValue });\n }\n }\n });\n };\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\n }\n\n /** @internal */\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\n }\n }\n\n private async setStateFromProps() {\n const record = this.props.propertyRecord;\n let initialValue = 0;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n initialValue = record.value.value as number;\n }\n\n const readonly = record && undefined !== record.isReadonly ? record.isReadonly : false;\n const isDisabled = record ? record.isDisabled : undefined;\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState(\n { weightValue: initialValue, readonly, isDisabled },\n () => {\n if (this.props.setFocus) {\n this.setFocus();\n }\n },\n );\n }\n\n /** @internal */\n public override render() {\n return (\n <div className={classnames(\"components-weight-editor\", this.props.className)} style={this.props.style} ref={this._divElement}>\n <WeightPickerButton ref={(control) => this._control = control}\n activeWeight={this.state.weightValue}\n weights={this._availableWeights.length > 0 ? /* istanbul ignore next */ this._availableWeights : undefined}\n disabled={this.state.isDisabled ? true : false}\n readonly={this.state.readonly}\n onLineWeightPick={this._onLineWeightPick}\n data-testid=\"components-weight-editor\" />\n </div>\n );\n }\n}\n\n/** Weight Property Editor registered for the \"number\" type name and \"weight-picker\" editor name.\n * It uses the [[WeightEditor]] React component.\n * @public\n */\nexport class WeightPropertyEditor extends PropertyEditorBase {\n // istanbul ignore next\n public get reactNode(): React.ReactNode {\n return <WeightEditor />;\n }\n}\n\nPropertyEditorManager.registerEditor(StandardTypeNames.Number, WeightPropertyEditor, StandardEditorNames.WeightPicker);\n"]}
1
+ {"version":3,"file":"WeightEditor.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/editors/WeightEditor.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,+B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C,IAAI,CAAC,iBAAiB;oBACnD,CAAC,CAAC,SAAS,EAEf,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EAC9C,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAC7B,gBAAgB,EAAE,IAAI,CAAC,iBAAiB,iBAC5B,0BAA0B,GACtC,CACE,CACP,CAAC;IACJ,CAAC;CACF;AAtJD,oCAsJC;AAED;;;GAGG;AACH,MAAa,oBAAqB,SAAQ,qCAAkB;IAC1D,uBAAuB;IACvB,IAAW,SAAS;QAClB,OAAO,oBAAC,YAAY,OAAG,CAAC;IAC1B,CAAC;CACF;AALD,oDAKC;AAED,wCAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,MAAM,EACxB,oBAAoB,EACpB,oCAAmB,CAAC,YAAY,CACjC,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 PropertyEditors\n */\n\nimport \"./WeightEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { PropertyRecord, PropertyValue } from \"@itwin/appui-abstract\";\nimport {\n PropertyValueFormat,\n StandardEditorNames,\n StandardTypeNames,\n} from \"@itwin/appui-abstract\";\nimport type { PropertyEditorProps, TypeEditor } from \"@itwin/components-react\";\nimport {\n PropertyEditorBase,\n PropertyEditorManager,\n} from \"@itwin/components-react\";\nimport { WeightPickerButton } from \"../lineweight/WeightPickerButton\";\n\n// cspell:ignore lineweight\n\n/** @internal */\ninterface WeightEditorState {\n weightValue: number;\n readonly: boolean;\n isDisabled?: boolean;\n}\n\n/** WeightEditor React component that is a property editor for picking a weight using a [[WeightPickerButton]] component\n * @public\n */\nexport class WeightEditor\n extends React.PureComponent<PropertyEditorProps, WeightEditorState>\n implements TypeEditor\n{\n private _control: any | null = null;\n private _isMounted = false;\n private _availableWeights: number[] = [];\n private _divElement = React.createRef<HTMLDivElement>();\n\n /** @internal */\n public override readonly state: Readonly<WeightEditorState> = {\n weightValue: 0,\n readonly: false,\n };\n\n constructor(props: PropertyEditorProps) {\n super(props);\n\n // TODO: add support for following if we need to specify set of weights to display\n // const record = this.props.propertyRecord;\n // if (record && record.property && record.property.editor && record.property.editor.params) {\n // const weightParams = record.property.editor.params.find((param: PropertyEditorParams) => param.type === PropertyEditorParamTypes.ColorData) as WeightEditorParams;\n // // istanbul ignore else\n // if (weightParams) {\n // weightParams.weightValues.forEach((weight: number) => {\n // this._availableWeights.push(weight);\n // });\n // }\n // }\n }\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.weightValue,\n displayValue: \"\",\n };\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._divElement.current;\n }\n\n public get hasFocus(): boolean {\n let containsFocus = false;\n // istanbul ignore else\n if (this._divElement.current)\n containsFocus = this._divElement.current.contains(document.activeElement);\n return containsFocus;\n }\n\n private setFocus(): void {\n // istanbul ignore else\n if (this._control && !this.state.isDisabled) {\n this._control.setFocus();\n }\n }\n\n private _onLineWeightPick = (weight: number) => {\n const propertyRecord = this.props.propertyRecord as PropertyRecord;\n\n this.setState(\n {\n weightValue: weight,\n },\n async () => {\n // istanbul ignore else\n if (propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (propertyValue !== undefined) {\n this.props.onCommit({ propertyRecord, newValue: propertyValue });\n }\n }\n }\n );\n };\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n void this.setStateFromProps();\n }\n\n /** @internal */\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n void this.setStateFromProps();\n }\n }\n\n private async setStateFromProps() {\n const record = this.props.propertyRecord;\n let initialValue = 0;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n initialValue = record.value.value as number;\n }\n\n const readonly =\n record && undefined !== record.isReadonly ? record.isReadonly : false;\n const isDisabled = record ? record.isDisabled : undefined;\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({ weightValue: initialValue, readonly, isDisabled }, () => {\n if (this.props.setFocus) {\n this.setFocus();\n }\n });\n }\n\n /** @internal */\n public override render() {\n return (\n <div\n className={classnames(\"components-weight-editor\", this.props.className)}\n style={this.props.style}\n ref={this._divElement}\n >\n <WeightPickerButton\n ref={(control) => (this._control = control)}\n activeWeight={this.state.weightValue}\n weights={\n this._availableWeights.length > 0\n ? /* istanbul ignore next */ this._availableWeights\n : undefined\n }\n disabled={this.state.isDisabled ? true : false}\n readonly={this.state.readonly}\n onLineWeightPick={this._onLineWeightPick}\n data-testid=\"components-weight-editor\"\n />\n </div>\n );\n }\n}\n\n/** Weight Property Editor registered for the \"number\" type name and \"weight-picker\" editor name.\n * It uses the [[WeightEditor]] React component.\n * @public\n */\nexport class WeightPropertyEditor extends PropertyEditorBase {\n // istanbul ignore next\n public get reactNode(): React.ReactNode {\n return <WeightEditor />;\n }\n}\n\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Number,\n WeightPropertyEditor,\n StandardEditorNames.WeightPicker\n);\n"]}
@@ -22,5 +22,5 @@ export interface QuantityProps extends CommonProps {
22
22
  /** Input control that allows users to input a quantity and show the formatted string that represents the value.
23
23
  * @beta
24
24
  */
25
- export declare function QuantityInput({ initialValue, quantityType, readonly, className, style, onQuantityChange, ref }: QuantityProps): JSX.Element;
25
+ export declare function QuantityInput({ initialValue, quantityType, readonly, className, style, onQuantityChange, ref, }: QuantityProps): JSX.Element;
26
26
  //# sourceMappingURL=QuantityInput.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"QuantityInput.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/inputs/QuantityInput.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAA8B,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAIxF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD;;GAEG;AACH,MAAM,WAAW,aAAc,SAAQ,WAAW;IAChD,8HAA8H;IAC9H,YAAY,EAAE,MAAM,CAAC;IACrB,oCAAoC;IACpC,YAAY,EAAE,eAAe,CAAC;IAC9B,4GAA4G;IAC5G,gBAAgB,EAAE,CAAC,gBAAgB,EAAE,MAAM,KAAK,IAAI,CAAC;IACrD,iDAAiD;IACjD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+DAA+D;IAC/D,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;CACnC;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,gBAAgB,EAAE,GAAG,EAAE,EAAE,aAAa,eA6D7H"}
1
+ {"version":3,"file":"QuantityInput.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/inputs/QuantityInput.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAEV,eAAe,EAChB,MAAM,sBAAsB,CAAC;AAI9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD;;GAEG;AACH,MAAM,WAAW,aAAc,SAAQ,WAAW;IAChD,8HAA8H;IAC9H,YAAY,EAAE,MAAM,CAAC;IACrB,oCAAoC;IACpC,YAAY,EAAE,eAAe,CAAC;IAC9B,4GAA4G;IAC5G,gBAAgB,EAAE,CAAC,gBAAgB,EAAE,MAAM,KAAK,IAAI,CAAC;IACrD,iDAAiD;IACjD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+DAA+D;IAC/D,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;CACnC;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAC5B,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,KAAK,EACL,gBAAgB,EAChB,GAAG,GACJ,EAAE,aAAa,eAsHf"}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
6
  /** @packageDocumentation
7
7
  * @module Inputs
8
8
  */
@@ -43,7 +43,7 @@ const components_react_1 = require("@itwin/components-react");
43
43
  /** Input control that allows users to input a quantity and show the formatted string that represents the value.
44
44
  * @beta
45
45
  */
46
- function QuantityInput({ initialValue, quantityType, readonly, className, style, onQuantityChange, ref }) {
46
+ function QuantityInput({ initialValue, quantityType, readonly, className, style, onQuantityChange, ref, }) {
47
47
  const [formatterSpec, setFormatterSpec] = React.useState(() => core_frontend_1.IModelApp.quantityFormatter.findFormatterSpecByQuantityType(quantityType));
48
48
  const [parserSpec, setParserSpec] = React.useState(() => core_frontend_1.IModelApp.quantityFormatter.findParserSpecByQuantityType(quantityType));
49
49
  const formatValue = React.useCallback((value) => {
@@ -63,39 +63,45 @@ function QuantityInput({ initialValue, quantityType, readonly, className, style,
63
63
  return { value: parseResult.value };
64
64
  }
65
65
  else {
66
- const statusId = core_quantity_1.Parser.isParseError(parseResult) ? parseResult.error.toString() : "Unknown";
67
- return { parseError: `${UiIModelComponents_1.UiIModelComponents.translate("QuantityInput.NoParserDefined")}${statusId}` };
66
+ const statusId = core_quantity_1.Parser.isParseError(parseResult)
67
+ ? parseResult.error.toString()
68
+ : "Unknown";
69
+ return {
70
+ parseError: `${UiIModelComponents_1.UiIModelComponents.translate("QuantityInput.NoParserDefined")}${statusId}`,
71
+ };
68
72
  }
69
73
  }
70
74
  // istanbul ignore next
71
- return { parseError: UiIModelComponents_1.UiIModelComponents.translate("QuantityInput.NoParserDefined") };
75
+ return {
76
+ parseError: UiIModelComponents_1.UiIModelComponents.translate("QuantityInput.NoParserDefined"),
77
+ };
72
78
  }, [parserSpec]);
73
79
  const classNames = (0, classnames_1.default)(className, "components-quantity-input");
74
80
  React.useEffect(() => {
75
- const handleUnitSystemChanged = (() => {
81
+ const handleUnitSystemChanged = () => {
76
82
  setFormatterSpec(core_frontend_1.IModelApp.quantityFormatter.findFormatterSpecByQuantityType(quantityType));
77
83
  setParserSpec(core_frontend_1.IModelApp.quantityFormatter.findParserSpecByQuantityType(quantityType));
78
- });
84
+ };
79
85
  core_frontend_1.IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.addListener(handleUnitSystemChanged);
80
86
  return () => {
81
87
  core_frontend_1.IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.removeListener(handleUnitSystemChanged);
82
88
  };
83
89
  }, [quantityType]);
84
90
  React.useEffect(() => {
85
- const handleUnitSystemChanged = ((args) => {
91
+ const handleUnitSystemChanged = (args) => {
86
92
  const quantityKey = core_frontend_1.IModelApp.quantityFormatter.getQuantityTypeKey(quantityType);
87
93
  // istanbul ignore else
88
94
  if (args.quantityType === quantityKey) {
89
95
  setFormatterSpec(core_frontend_1.IModelApp.quantityFormatter.findFormatterSpecByQuantityType(quantityType));
90
96
  setParserSpec(core_frontend_1.IModelApp.quantityFormatter.findParserSpecByQuantityType(quantityType));
91
97
  }
92
- });
98
+ };
93
99
  core_frontend_1.IModelApp.quantityFormatter.onQuantityFormatsChanged.addListener(handleUnitSystemChanged);
94
100
  return () => {
95
101
  core_frontend_1.IModelApp.quantityFormatter.onQuantityFormatsChanged.removeListener(handleUnitSystemChanged);
96
102
  };
97
103
  }, [quantityType]);
98
- return React.createElement(components_react_1.ParsedInput, { "data-testid": "components-quantity-input", ref: ref, style: style, className: classNames, onChange: onQuantityChange, initialValue: initialValue, readonly: readonly, formatValue: formatValue, parseString: parseString });
104
+ return (React.createElement(components_react_1.ParsedInput, { "data-testid": "components-quantity-input", ref: ref, style: style, className: classNames, onChange: onQuantityChange, initialValue: initialValue, readonly: readonly, formatValue: formatValue, parseString: parseString }));
99
105
  }
100
106
  exports.QuantityInput = QuantityInput;
101
107
  //# sourceMappingURL=QuantityInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"QuantityInput.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/inputs/QuantityInput.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4DAAoC;AACpC,6CAA+B;AAE/B,wDAAiD;AACjD,wDAA8C;AAG9C,8DAA2D;AAC3D,8DAAsD;AAkBtD;;GAEG;AACH,SAAgB,aAAa,CAAC,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,gBAAgB,EAAE,GAAG,EAAiB;IAC5H,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,yBAAS,CAAC,iBAAiB,CAAC,+BAA+B,CAAC,YAAY,CAAC,CAAC,CAAC;IAC1I,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,yBAAS,CAAC,iBAAiB,CAAC,4BAA4B,CAAC,YAAY,CAAC,CAAC,CAAC;IAEjI,M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EAAE,SAAS,EAAE,UAAU,EACvG,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,GAAI,CAAC;AACvI,CAAC;AA7DD,sCA6DC","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 Inputs\n */\n\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { QuantityFormatsChangedArgs, QuantityTypeArg } from \"@itwin/core-frontend\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { Parser } from \"@itwin/core-quantity\";\nimport type { ParseResults } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { UiIModelComponents } from \"../UiIModelComponents\";\nimport { ParsedInput } from \"@itwin/components-react\";\n\n/** Props for [[QuantityInput]] control\n * @beta\n */\nexport interface QuantityProps extends CommonProps {\n /** Initial magnitude in 'persistence' units. See `getPersistenceUnitByQuantityType` in [QuantityFormatter]($core-frontend) */\n initialValue: number;\n /** Type of quantity being input. */\n quantityType: QuantityTypeArg;\n /** Function to call in the quantity value is changed. The value returned will be in 'persistence' units. */\n onQuantityChange: (newQuantityValue: number) => void;\n /** Set to `true` if value is for display only */\n readonly?: boolean;\n /** Provides ability to return reference to HTMLInputElement */\n ref?: React.Ref<HTMLInputElement>;\n}\n\n/** Input control that allows users to input a quantity and show the formatted string that represents the value.\n * @beta\n */\nexport function QuantityInput({ initialValue, quantityType, readonly, className, style, onQuantityChange, ref }: QuantityProps) {\n const [formatterSpec, setFormatterSpec] = React.useState(() => IModelApp.quantityFormatter.findFormatterSpecByQuantityType(quantityType));\n const [parserSpec, setParserSpec] = React.useState(() => IModelApp.quantityFormatter.findParserSpecByQuantityType(quantityType));\n\n const formatValue = React.useCallback((value: number) => {\n // istanbul ignore else\n if (formatterSpec) {\n return formatterSpec.applyFormatting(value);\n }\n // istanbul ignore next\n return value.toFixed(2);\n }, [formatterSpec]);\n\n const parseString = React.useCallback((userInput: string): ParseResults => {\n // istanbul ignore else\n if (parserSpec) {\n const parseResult = IModelApp.quantityFormatter.parseToQuantityValue(userInput, parserSpec);\n // istanbul ignore else\n if (Parser.isParsedQuantity(parseResult)) {\n return { value: parseResult.value };\n } else {\n const statusId = Parser.isParseError(parseResult) ? parseResult.error.toString() : \"Unknown\";\n return { parseError: `${UiIModelComponents.translate(\"QuantityInput.NoParserDefined\")}${statusId}` };\n }\n }\n // istanbul ignore next\n return { parseError: UiIModelComponents.translate(\"QuantityInput.NoParserDefined\") };\n }, [parserSpec]);\n\n const classNames = classnames(className, \"components-quantity-input\");\n\n React.useEffect(() => {\n const handleUnitSystemChanged = ((): void => {\n setFormatterSpec(IModelApp.quantityFormatter.findFormatterSpecByQuantityType(quantityType));\n setParserSpec(IModelApp.quantityFormatter.findParserSpecByQuantityType(quantityType));\n });\n\n IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.addListener(handleUnitSystemChanged);\n return () => {\n IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.removeListener(handleUnitSystemChanged);\n };\n }, [quantityType]);\n\n React.useEffect(() => {\n const handleUnitSystemChanged = ((args: QuantityFormatsChangedArgs): void => {\n const quantityKey = IModelApp.quantityFormatter.getQuantityTypeKey(quantityType);\n // istanbul ignore else\n if (args.quantityType === quantityKey) {\n setFormatterSpec(IModelApp.quantityFormatter.findFormatterSpecByQuantityType(quantityType));\n setParserSpec(IModelApp.quantityFormatter.findParserSpecByQuantityType(quantityType));\n }\n });\n\n IModelApp.quantityFormatter.onQuantityFormatsChanged.addListener(handleUnitSystemChanged);\n return () => {\n IModelApp.quantityFormatter.onQuantityFormatsChanged.removeListener(handleUnitSystemChanged);\n };\n }, [quantityType]);\n\n return <ParsedInput data-testid=\"components-quantity-input\" ref={ref} style={style} className={classNames}\n onChange={onQuantityChange} initialValue={initialValue} readonly={readonly} formatValue={formatValue} parseString={parseString} />;\n}\n"]}
1
+ {"version":3,"file":"QuantityInput.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/inputs/QuantityInput.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4DAAoC;AACpC,6CAA+B;AAK/B,wDAAiD;AACjD,wDAA8C;AAG9C,8DAA2D;AAC3D,8DAAsD;AAkBtD;;GAEG;AACH,SAAgB,aAAa,CAAC,EAC5B,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,KAAK,EACL,gBAAgB,EAChB,GAAG,GACW;IACd,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,CAC5D,yBAAS,CAAC,iBAAiB,CAAC,+BAA+B,CAAC,YAAY,CAAC,CAC1E,CAAC;IACF,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,CACtD,yBAAS,CAAC,iBAAiB,CAAC,4BAA4B,CAAC,YAAY,CAAC,CACvE,CAAC;IAEF,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CACnC,CAAC,KAAa,EAAE,EAAE;QAChB,uBAAuB;QACvB,IAAI,aAAa,EAAE;YACjB,OAAO,aAAa,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;SAC7C;QACD,uBAAuB;QACvB,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC,EACD,CAAC,aAAa,CAAC,CAChB,CAAC;IAEF,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CACnC,CAAC,SAAiB,EAAgB,EAAE;QAClC,uBAAuB;QACvB,IAAI,UAAU,EAAE;YACd,MAAM,WAAW,GAAG,yBAAS,CAAC,iBAAiB,CAAC,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QACnB,MAAM,uBAAuB,GAAG,CAC9B,IAAgC,EAC1B,EAAE;YACR,MAAM,WAAW,GACf,yBAAS,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;YAC/D,uBAAuB;YACvB,IAAI,IAAI,CAAC,YAAY,KAAK,WAAW,EAAE;gBACrC,gBAAgB,CACd,yBAAS,CAAC,iBAAiB,CAAC,+BAA+B,CACzD,YAAY,CACb,CACF,CAAC;gBACF,aAAa,CACX,yBAAS,CAAC,iBAAiB,CAAC,4BAA4B,CAAC,YAAY,CAAC,CACvE,CAAC;aACH;QACH,CAAC,CAAC;QAEF,yBAAS,CAAC,iBAAiB,CAAC,wBAAwB,CAAC,WAAW,CAC9D,uBAAuB,CACxB,CAAC;QACF,OAAO,GAAG,EAAE;YACV,yBAAS,CAAC,iBAAiB,CAAC,wBAAwB,CAAC,cAAc,CACjE,uBAAuB,CACxB,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAEnB,OAAO,CACL,oBAAC,8BAAW,mBACE,2BAA2B,EACvC,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,UAAU,EACrB,QAAQ,EAAE,gBAAgB,EAC1B,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,GACxB,CACH,CAAC;AACJ,CAAC;AA9HD,sCA8HC","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 Inputs\n */\n\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n QuantityFormatsChangedArgs,\n QuantityTypeArg,\n} from \"@itwin/core-frontend\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { Parser } from \"@itwin/core-quantity\";\nimport type { ParseResults } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { UiIModelComponents } from \"../UiIModelComponents\";\nimport { ParsedInput } from \"@itwin/components-react\";\n\n/** Props for [[QuantityInput]] control\n * @beta\n */\nexport interface QuantityProps extends CommonProps {\n /** Initial magnitude in 'persistence' units. See `getPersistenceUnitByQuantityType` in [QuantityFormatter]($core-frontend) */\n initialValue: number;\n /** Type of quantity being input. */\n quantityType: QuantityTypeArg;\n /** Function to call in the quantity value is changed. The value returned will be in 'persistence' units. */\n onQuantityChange: (newQuantityValue: number) => void;\n /** Set to `true` if value is for display only */\n readonly?: boolean;\n /** Provides ability to return reference to HTMLInputElement */\n ref?: React.Ref<HTMLInputElement>;\n}\n\n/** Input control that allows users to input a quantity and show the formatted string that represents the value.\n * @beta\n */\nexport function QuantityInput({\n initialValue,\n quantityType,\n readonly,\n className,\n style,\n onQuantityChange,\n ref,\n}: QuantityProps) {\n const [formatterSpec, setFormatterSpec] = React.useState(() =>\n IModelApp.quantityFormatter.findFormatterSpecByQuantityType(quantityType)\n );\n const [parserSpec, setParserSpec] = React.useState(() =>\n IModelApp.quantityFormatter.findParserSpecByQuantityType(quantityType)\n );\n\n const formatValue = React.useCallback(\n (value: number) => {\n // istanbul ignore else\n if (formatterSpec) {\n return formatterSpec.applyFormatting(value);\n }\n // istanbul ignore next\n return value.toFixed(2);\n },\n [formatterSpec]\n );\n\n const parseString = React.useCallback(\n (userInput: string): ParseResults => {\n // istanbul ignore else\n if (parserSpec) {\n const parseResult = IModelApp.quantityFormatter.parseToQuantityValue(\n userInput,\n parserSpec\n );\n // istanbul ignore else\n if (Parser.isParsedQuantity(parseResult)) {\n return { value: parseResult.value };\n } else {\n const statusId = Parser.isParseError(parseResult)\n ? parseResult.error.toString()\n : \"Unknown\";\n return {\n parseError: `${UiIModelComponents.translate(\n \"QuantityInput.NoParserDefined\"\n )}${statusId}`,\n };\n }\n }\n // istanbul ignore next\n return {\n parseError: UiIModelComponents.translate(\n \"QuantityInput.NoParserDefined\"\n ),\n };\n },\n [parserSpec]\n );\n\n const classNames = classnames(className, \"components-quantity-input\");\n\n React.useEffect(() => {\n const handleUnitSystemChanged = (): void => {\n setFormatterSpec(\n IModelApp.quantityFormatter.findFormatterSpecByQuantityType(\n quantityType\n )\n );\n setParserSpec(\n IModelApp.quantityFormatter.findParserSpecByQuantityType(quantityType)\n );\n };\n\n IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.addListener(\n handleUnitSystemChanged\n );\n return () => {\n IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.removeListener(\n handleUnitSystemChanged\n );\n };\n }, [quantityType]);\n\n React.useEffect(() => {\n const handleUnitSystemChanged = (\n args: QuantityFormatsChangedArgs\n ): void => {\n const quantityKey =\n IModelApp.quantityFormatter.getQuantityTypeKey(quantityType);\n // istanbul ignore else\n if (args.quantityType === quantityKey) {\n setFormatterSpec(\n IModelApp.quantityFormatter.findFormatterSpecByQuantityType(\n quantityType\n )\n );\n setParserSpec(\n IModelApp.quantityFormatter.findParserSpecByQuantityType(quantityType)\n );\n }\n };\n\n IModelApp.quantityFormatter.onQuantityFormatsChanged.addListener(\n handleUnitSystemChanged\n );\n return () => {\n IModelApp.quantityFormatter.onQuantityFormatsChanged.removeListener(\n handleUnitSystemChanged\n );\n };\n }, [quantityType]);\n\n return (\n <ParsedInput\n data-testid=\"components-quantity-input\"\n ref={ref}\n style={style}\n className={classNames}\n onChange={onQuantityChange}\n initialValue={initialValue}\n readonly={readonly}\n formatValue={formatValue}\n parseString={parseString}\n />\n );\n}\n"]}
@@ -41,5 +41,5 @@ export interface QuantityNumberInputProps extends Omit<InputProps, "value" | "mi
41
41
  * units that can be stored in the iModel.
42
42
  * @beta
43
43
  */
44
- export declare const QuantityNumberInput: (props: QuantityNumberInputProps) => JSX.Element | null;
44
+ export declare const QuantityNumberInput: (props: QuantityNumberInputProps) => React.ReactElement | null;
45
45
  //# sourceMappingURL=QuantityNumberInput.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"QuantityNumberInput.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/inputs/QuantityNumberInput.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,4BAA4B,CAAC;AAEpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAA8B,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAIxF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAIvD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,CAAC,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC,CAAC;AAEpF;;GAEG;AACH,MAAM,WAAW,wBAAyB,SAAQ,IAAI,CAAC,UAAU,EAAE,OAAO,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,CAAC;IAC3H;qDACiD;IACjD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,yEAAyE;IACzE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iDAAiD;IACjD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,6DAA6D;IAC7D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,kHAAkH;IAClH,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,0HAA0H;IAC1H,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,8GAA8G;IAC9G,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,gEAAgE;IAChE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,+DAA+D;IAC/D,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAClC,oCAAoC;IACpC,YAAY,EAAE,eAAe,CAAC;CAC/B;AAkRD;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,EAAE,CAAC,KAAK,EAAE,wBAAwB,KAAK,GAAG,CAAC,OAAO,GAAG,IAAoC,CAAC"}
1
+ {"version":3,"file":"QuantityNumberInput.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/inputs/QuantityNumberInput.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,4BAA4B,CAAC;AAEpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAEV,eAAe,EAChB,MAAM,sBAAsB,CAAC;AAc9B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AASvD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GACxB,MAAM,GACN,CAAC,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,wBACf,SAAQ,IAAI,CACV,UAAU,EACV,OAAO,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,CAC1D;IACD;qDACiD;IACjD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,yEAAyE;IACzE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iDAAiD;IACjD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,6DAA6D;IAC7D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,kHAAkH;IAClH,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,0HAA0H;IAC1H,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,8GAA8G;IAC9G,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,gEAAgE;IAChE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,+DAA+D;IAC/D,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAClC,oCAAoC;IACpC,YAAY,EAAE,eAAe,CAAC;CAC/B;AAwZD;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,EAAE,CAChC,KAAK,EAAE,wBAAwB,KAC5B,KAAK,CAAC,YAAY,GAAG,IAAoC,CAAC"}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
6
  /** @packageDocumentation
7
7
  * @module Inputs
8
8
  */
@@ -53,7 +53,9 @@ function adjustFormatterSpec(formatterSpec) {
53
53
  showOnlyPrimaryUnit: true,
54
54
  traits: formatterSpec.format.formatTraits & ~core_quantity_1.FormatTraits.ShowUnitLabel,
55
55
  type: core_quantity_1.FormatType.Decimal,
56
- precision: core_quantity_1.FormatType.Decimal !== formatterSpec.format.type ? core_quantity_1.DecimalPrecision.Four : formatterSpec.format.precision,
56
+ precision: core_quantity_1.FormatType.Decimal !== formatterSpec.format.type
57
+ ? core_quantity_1.DecimalPrecision.Four
58
+ : formatterSpec.format.precision,
57
59
  });
58
60
  return new core_quantity_1.FormatterSpec("single-value", newFormat, singleUnitConversion, formatterSpec.persistenceUnit);
59
61
  }
@@ -65,7 +67,7 @@ function convertValueFromDisplayToPersistence(value, unitConversions, unit) {
65
67
  // istanbul ignore next
66
68
  if (!unitConversion)
67
69
  return value;
68
- const convertedValue = (value * unitConversion.conversion.factor) + unitConversion.conversion.offset;
70
+ const convertedValue = value * unitConversion.conversion.factor + unitConversion.conversion.offset;
69
71
  return convertedValue;
70
72
  }
71
73
  function getUnitLabel(parserSpec) {
@@ -97,24 +99,24 @@ const ForwardRefQuantityNumberInput = React.forwardRef(function ForwardRefQuanti
97
99
  const lastFormattedValueRef = React.useRef(formatValue(persistenceValue));
98
100
  const [formattedValue, setFormattedValue] = React.useState(() => lastFormattedValueRef.current);
99
101
  React.useEffect(() => {
100
- const handleUnitSystemChanged = (() => {
102
+ const handleUnitSystemChanged = () => {
101
103
  setFormatterSpec(adjustFormatterSpec(core_frontend_1.IModelApp.quantityFormatter.findFormatterSpecByQuantityType(quantityType)));
102
104
  setParserSpec(core_frontend_1.IModelApp.quantityFormatter.findParserSpecByQuantityType(quantityType));
103
- });
105
+ };
104
106
  core_frontend_1.IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.addListener(handleUnitSystemChanged);
105
107
  return () => {
106
108
  core_frontend_1.IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.removeListener(handleUnitSystemChanged);
107
109
  };
108
110
  }, [quantityType]);
109
111
  React.useEffect(() => {
110
- const handleUnitSystemChanged = ((args) => {
112
+ const handleUnitSystemChanged = (args) => {
111
113
  const quantityKey = core_frontend_1.IModelApp.quantityFormatter.getQuantityTypeKey(quantityType);
112
114
  // istanbul ignore else
113
115
  if (args.quantityType === quantityKey) {
114
116
  setFormatterSpec(adjustFormatterSpec(core_frontend_1.IModelApp.quantityFormatter.findFormatterSpecByQuantityType(quantityType)));
115
117
  setParserSpec(core_frontend_1.IModelApp.quantityFormatter.findParserSpecByQuantityType(quantityType));
116
118
  }
117
- });
119
+ };
118
120
  core_frontend_1.IModelApp.quantityFormatter.onQuantityFormatsChanged.addListener(handleUnitSystemChanged);
119
121
  return () => {
120
122
  core_frontend_1.IModelApp.quantityFormatter.onQuantityFormatsChanged.removeListener(handleUnitSystemChanged);
@@ -136,7 +138,9 @@ const ForwardRefQuantityNumberInput = React.forwardRef(function ForwardRefQuanti
136
138
  // istanbul ignore else
137
139
  if (parserSpec) {
138
140
  // convert value from display unit to persistence unit
139
- const [unit] = parserSpec.format.units ? parserSpec.format.units[0] : /* istanbul ignore next */ [parserSpec.outUnit];
141
+ const [unit] = parserSpec.format.units
142
+ ? parserSpec.format.units[0]
143
+ : /* istanbul ignore next */ [parserSpec.outUnit];
140
144
  persistedValue = convertValueFromDisplayToPersistence(newValue, parserSpec.unitConversions, unit);
141
145
  rawValueRef.current = persistedValue;
142
146
  }
@@ -145,12 +149,12 @@ const ForwardRefQuantityNumberInput = React.forwardRef(function ForwardRefQuanti
145
149
  setFormattedValue(newFormattedVal);
146
150
  }, [formatValue, onChange, parserSpec]);
147
151
  /**
148
- * Used internally to parse the argument x to it's numeric representation.
149
- * If the argument cannot be converted to finite number returns 0; If a
150
- * "precision" prop is specified uses it round the number with that
151
- * precision (no fixed precision here because the return value is float, not
152
- * string).
153
- */
152
+ * Used internally to parse the argument x to it's numeric representation.
153
+ * If the argument cannot be converted to finite number returns 0; If a
154
+ * "precision" prop is specified uses it round the number with that
155
+ * precision (no fixed precision here because the return value is float, not
156
+ * string).
157
+ */
154
158
  const parseInternal = React.useCallback((x) => {
155
159
  if (!x)
156
160
  return 0;
@@ -179,7 +183,8 @@ const ForwardRefQuantityNumberInput = React.forwardRef(function ForwardRefQuanti
179
183
  }
180
184
  else {
181
185
  // istanbul ignore else
182
- if (rawValueRef.current) { // restore last known good value
186
+ if (rawValueRef.current) {
187
+ // restore last known good value
183
188
  const lastKnownFormattedVal = formatValue(rawValueRef.current);
184
189
  setFormattedValue(lastKnownFormattedVal);
185
190
  return;
@@ -204,11 +209,12 @@ const ForwardRefQuantityNumberInput = React.forwardRef(function ForwardRefQuanti
204
209
  return !step ? 1 : step;
205
210
  }, [step]);
206
211
  /**
207
- * The internal method that actually sets the new value on the input
208
- */
212
+ * The internal method that actually sets the new value on the input
213
+ */
209
214
  const applyStep = React.useCallback((increment) => {
210
215
  const incrementValue = getIncrementValue(increment);
211
- let num = parseInternal(formattedValue) + (increment ? incrementValue : -incrementValue);
216
+ let num = parseInternal(formattedValue) +
217
+ (increment ? incrementValue : -incrementValue);
212
218
  if (snap) {
213
219
  num = Math.round(num / incrementValue) * incrementValue;
214
220
  }
@@ -216,7 +222,15 @@ const ForwardRefQuantityNumberInput = React.forwardRef(function ForwardRefQuanti
216
222
  const localMax = undefined === max ? Number.MAX_SAFE_INTEGER : max;
217
223
  num = Math.min(Math.max(num, localMin), localMax);
218
224
  updateValue(num);
219
- }, [formattedValue, getIncrementValue, max, min, parseInternal, snap, updateValue]);
225
+ }, [
226
+ formattedValue,
227
+ getIncrementValue,
228
+ max,
229
+ min,
230
+ parseInternal,
231
+ snap,
232
+ updateValue,
233
+ ]);
220
234
  const handleKeyDown = React.useCallback((event) => {
221
235
  // istanbul ignore else
222
236
  if (event.key === appui_abstract_1.SpecialKey.Enter) {