@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,OAAO,eAAe,CAAC;AACvB,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAc1D;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,KAAuB;IACjD,MAAM,UAAU,GAAG,kBAAkB,CAAC,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,UAAU,CACxB,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","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,OAAO,eAAe,CAAC;AACvB,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAgB1D;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,KAAuB;IACjD,MAAM,UAAU,GAAG,kBAAkB,CAAC,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,UAAU,CACxB,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","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,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  /** @packageDocumentation
6
6
  * @module Color
7
7
  */
@@ -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,MAAM,UAAU,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","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,MAAM,UAAU,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","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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------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  /** @packageDocumentation
6
6
  * @module PropertyEditors
7
7
  */
@@ -10,7 +10,7 @@ import classnames from "classnames";
10
10
  import * as React from "react";
11
11
  import { ColorDef } from "@itwin/core-common";
12
12
  import { PropertyEditorParamTypes, PropertyValueFormat, StandardEditorNames, StandardTypeNames, } from "@itwin/appui-abstract";
13
- import { PropertyEditorBase, PropertyEditorManager } from "@itwin/components-react";
13
+ import { PropertyEditorBase, PropertyEditorManager, } from "@itwin/components-react";
14
14
  import { ColorPickerButton } from "../color/ColorPickerButton";
15
15
  /** ColorEditor React component that is a property editor with text input
16
16
  * @beta
@@ -63,18 +63,20 @@ export class ColorEditor extends React.PureComponent {
63
63
  }
64
64
  setFocus() {
65
65
  // istanbul ignore else
66
- if (this._buttonElement && this._buttonElement.current && !this.state.isDisabled) {
66
+ if (this._buttonElement &&
67
+ this._buttonElement.current &&
68
+ !this.state.isDisabled) {
67
69
  this._buttonElement.current.focus();
68
70
  }
69
71
  }
70
72
  /** @internal */
71
73
  componentDidMount() {
72
- this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises
74
+ void this.setStateFromProps();
73
75
  }
74
76
  /** @internal */
75
77
  componentDidUpdate(prevProps) {
76
78
  if (this.props.propertyRecord !== prevProps.propertyRecord) {
77
- this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises
79
+ void this.setStateFromProps();
78
80
  }
79
81
  }
80
82
  async setStateFromProps() {
@@ -84,8 +86,12 @@ export class ColorEditor extends React.PureComponent {
84
86
  const colorValue = record.value.value;
85
87
  let numColumns = 4;
86
88
  const availableColors = new Array();
87
- const readonly = record && undefined !== record.isReadonly ? record.isReadonly : /* istanbul ignore next */ false;
88
- const isDisabled = record ? record.isDisabled : /* istanbul ignore next */ undefined;
89
+ const readonly = record && undefined !== record.isReadonly
90
+ ? record.isReadonly
91
+ : /* istanbul ignore next */ false;
92
+ const isDisabled = record
93
+ ? record.isDisabled
94
+ : /* istanbul ignore next */ undefined;
89
95
  if (record.property.editor && record.property.editor.params) {
90
96
  const colorParams = record.property.editor.params.find((param) => param.type === PropertyEditorParamTypes.ColorData);
91
97
  // istanbul ignore else
@@ -109,7 +115,9 @@ export class ColorEditor extends React.PureComponent {
109
115
  render() {
110
116
  const colorDef = ColorDef.create(this.state.colorValue);
111
117
  return (React.createElement("div", { className: classnames("components-color-editor", this.props.className), style: this.props.style },
112
- React.createElement(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" })));
118
+ React.createElement(ColorPickerButton, { ref: this._buttonElement, initialColor: colorDef, colorDefs: this.state.availableColors.length > 0
119
+ ? this.state.availableColors
120
+ : [colorDef], numColumns: this.state.numColumns, disabled: this.state.isDisabled ? true : false, readonly: this.state.readonly, onColorPick: this._onColorPick, "data-testid": "components-color-editor" })));
113
121
  }
114
122
  }
115
123
  /** Color Property Editor registered for the "number" type name and "color-picker" editor name.
@@ -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,OAAO,oBAAoB,CAAC;AAC5B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAG9C,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,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AAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK;YAClG,oBAAC,iBAAiB,IAAC,GAAG,EAAE,IAAI,CAAC,cAAc,EACzC,YAAY,EAAE,QAAQ,EACtB,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAC1F,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,EACjC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EAC9C,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAC7B,WAAW,EAAE,IAAI,CAAC,YAAY,iBAClB,yBAAyB,GAAG,CACtC,CACP,CAAC;IACJ,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,mBAAoB,SAAQ,kBAAkB;IACzD,IAAW,SAAS;QAClB,OAAO,oBAAC,WAAW,OAAG,CAAC;IACzB,CAAC;CACF;AAED,qBAAqB,CAAC,cAAc,CAAC,iBAAiB,CAAC,MAAM,EAAE,mBAAmB,EAAE,mBAAmB,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,OAAO,oBAAoB,CAAC;AAC5B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAO9C,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAW/D;;GAEG;AACH,MAAM,OAAO,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,CAAC,KAAe,EAAE,EAAE;YACzC,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,cAAgC,CAAC;YAEnE,IAAI,CAAC,QAAQ,CACX;gBACE,UAAU,EAAE,KAAK,CAAC,IAAI;aACvB,EACD,KAAK,IAAI,EAAE;gBACT,uBAAuB;gBACvB,IAAI,cAAc,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;oBACzC,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;oBACpD,uBAAuB;oBACvB,IAAI,aAAa,KAAK,SAAS,EAAE;wBAC/B,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,cAAc,EAAE,QAAQ,EAAE,aAA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AAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;oBACvB,IAAI,CAAC,QAAQ,EAAE,CAAC;iBACjB;YACH,CAAC,CACF,CAAC;SACH;IACH,CAAC;IAED,gBAAgB;IACA,MAAM;QACpB,MAAM,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QACxD,OAAO,CACL,6BACE,SAAS,EAAE,UAAU,CAAC,yBAAyB,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EACtE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK;YAEvB,oBAAC,iBAAiB,IAChB,GAAG,EAAE,IAAI,CAAC,cAAc,EACxB,YAAY,EAAE,QAAQ,EACtB,SAAS,EACP,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC;oBACnC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe;oBAC5B,CAAC,CAAC,CAAC,QAAQ,CAAC,EAEhB,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,EACjC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EAC9C,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAC7B,WAAW,EAAE,IAAI,CAAC,YAAY,iBAClB,yBAAyB,GACrC,CACE,CACP,CAAC;IACJ,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,mBAAoB,SAAQ,kBAAkB;IACzD,IAAW,SAAS;QAClB,OAAO,oBAAC,WAAW,OAAG,CAAC;IACzB,CAAC;CACF;AAED,qBAAqB,CAAC,cAAc,CAClC,iBAAiB,CAAC,MAAM,EACxB,mBAAmB,EACnB,mBAAmB,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,UAAU,iBAAiB;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,qBAAa,YAAa,SAAQ,KAAK,CAAC,aAAa,CAAC,mBAAmB,EAAE,iBAAiB,CAAE,YAAW,UAAU;IACjH,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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B,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,15 +1,15 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  /** @packageDocumentation
6
6
  * @module PropertyEditors
7
7
  */
8
8
  import "./WeightEditor.scss";
9
9
  import classnames from "classnames";
10
10
  import * as React from "react";
11
- import { PropertyValueFormat, StandardEditorNames, StandardTypeNames } from "@itwin/appui-abstract";
12
- import { PropertyEditorBase, PropertyEditorManager } from "@itwin/components-react";
11
+ import { PropertyValueFormat, StandardEditorNames, StandardTypeNames, } from "@itwin/appui-abstract";
12
+ import { PropertyEditorBase, PropertyEditorManager, } from "@itwin/components-react";
13
13
  import { WeightPickerButton } from "../lineweight/WeightPickerButton";
14
14
  /** WeightEditor React component that is a property editor for picking a weight using a [[WeightPickerButton]] component
15
15
  * @public
@@ -85,7 +85,7 @@ export class WeightEditor extends React.PureComponent {
85
85
  /** @internal */
86
86
  componentDidMount() {
87
87
  this._isMounted = true;
88
- this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises
88
+ void this.setStateFromProps();
89
89
  }
90
90
  /** @internal */
91
91
  componentWillUnmount() {
@@ -94,7 +94,7 @@ export class WeightEditor extends React.PureComponent {
94
94
  /** @internal */
95
95
  componentDidUpdate(prevProps) {
96
96
  if (this.props.propertyRecord !== prevProps.propertyRecord) {
97
- this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises
97
+ void this.setStateFromProps();
98
98
  }
99
99
  }
100
100
  async setStateFromProps() {
@@ -117,7 +117,9 @@ export class WeightEditor extends React.PureComponent {
117
117
  /** @internal */
118
118
  render() {
119
119
  return (React.createElement("div", { className: classnames("components-weight-editor", this.props.className), style: this.props.style, ref: this._divElement },
120
- React.createElement(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" })));
120
+ React.createElement(WeightPickerButton, { ref: (control) => (this._control = control), activeWeight: this.state.weightValue, weights: this._availableWeights.length > 0
121
+ ? /* istanbul ignore next */ this._availableWeights
122
+ : undefined, disabled: this.state.isDisabled ? true : false, readonly: this.state.readonly, onLineWeightPick: this._onLineWeightPick, "data-testid": "components-weight-editor" })));
121
123
  }
122
124
  }
123
125
  /** Weight Property Editor registered for the "number" type name and "weight-picker" editor name.
@@ -1 +1 @@
1
- {"version":3,"file":"WeightEditor.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/editors/WeightEditor.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,qBAAqB,CAAC;AAC7B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO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,CAAC,KAAK,CAAC,WAAW,EACpC,OAAO,EAAE,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;AAED;;;GAGG;AACH,MAAM,OAAO,oBAAqB,SAAQ,kBAAkB;IAC1D,uBAAuB;IACvB,IAAW,SAAS;QAClB,OAAO,oBAAC,YAAY,OAAG,CAAC;IAC1B,CAAC;CACF;AAED,qBAAqB,CAAC,cAAc,CAAC,iBAAiB,CAAC,MAAM,EAAE,oBAAoB,EAAE,mBAAmB,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,OAAO,qBAAqB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,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,EAC3C,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,EACpC,OAAO,EACL,IAAI,CAAC,iBAAiB,CAAC,MAAM,GAAG,CAAC;oBAC/B,CAAC,CAAC,0BAA0B,CAAC,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;AAED;;;GAGG;AACH,MAAM,OAAO,oBAAqB,SAAQ,kBAAkB;IAC1D,uBAAuB;IACvB,IAAW,SAAS;QAClB,OAAO,oBAAC,YAAY,OAAG,CAAC;IAC1B,CAAC;CACF;AAED,qBAAqB,CAAC,cAAc,CAClC,iBAAiB,CAAC,MAAM,EACxB,oBAAoB,EACpB,mBAAmB,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,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  /** @packageDocumentation
6
6
  * @module Inputs
7
7
  */
@@ -14,7 +14,7 @@ import { ParsedInput } from "@itwin/components-react";
14
14
  /** Input control that allows users to input a quantity and show the formatted string that represents the value.
15
15
  * @beta
16
16
  */
17
- export function QuantityInput({ initialValue, quantityType, readonly, className, style, onQuantityChange, ref }) {
17
+ export function QuantityInput({ initialValue, quantityType, readonly, className, style, onQuantityChange, ref, }) {
18
18
  const [formatterSpec, setFormatterSpec] = React.useState(() => IModelApp.quantityFormatter.findFormatterSpecByQuantityType(quantityType));
19
19
  const [parserSpec, setParserSpec] = React.useState(() => IModelApp.quantityFormatter.findParserSpecByQuantityType(quantityType));
20
20
  const formatValue = React.useCallback((value) => {
@@ -34,38 +34,44 @@ export function QuantityInput({ initialValue, quantityType, readonly, className,
34
34
  return { value: parseResult.value };
35
35
  }
36
36
  else {
37
- const statusId = Parser.isParseError(parseResult) ? parseResult.error.toString() : "Unknown";
38
- return { parseError: `${UiIModelComponents.translate("QuantityInput.NoParserDefined")}${statusId}` };
37
+ const statusId = Parser.isParseError(parseResult)
38
+ ? parseResult.error.toString()
39
+ : "Unknown";
40
+ return {
41
+ parseError: `${UiIModelComponents.translate("QuantityInput.NoParserDefined")}${statusId}`,
42
+ };
39
43
  }
40
44
  }
41
45
  // istanbul ignore next
42
- return { parseError: UiIModelComponents.translate("QuantityInput.NoParserDefined") };
46
+ return {
47
+ parseError: UiIModelComponents.translate("QuantityInput.NoParserDefined"),
48
+ };
43
49
  }, [parserSpec]);
44
50
  const classNames = classnames(className, "components-quantity-input");
45
51
  React.useEffect(() => {
46
- const handleUnitSystemChanged = (() => {
52
+ const handleUnitSystemChanged = () => {
47
53
  setFormatterSpec(IModelApp.quantityFormatter.findFormatterSpecByQuantityType(quantityType));
48
54
  setParserSpec(IModelApp.quantityFormatter.findParserSpecByQuantityType(quantityType));
49
- });
55
+ };
50
56
  IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.addListener(handleUnitSystemChanged);
51
57
  return () => {
52
58
  IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.removeListener(handleUnitSystemChanged);
53
59
  };
54
60
  }, [quantityType]);
55
61
  React.useEffect(() => {
56
- const handleUnitSystemChanged = ((args) => {
62
+ const handleUnitSystemChanged = (args) => {
57
63
  const quantityKey = IModelApp.quantityFormatter.getQuantityTypeKey(quantityType);
58
64
  // istanbul ignore else
59
65
  if (args.quantityType === quantityKey) {
60
66
  setFormatterSpec(IModelApp.quantityFormatter.findFormatterSpecByQuantityType(quantityType));
61
67
  setParserSpec(IModelApp.quantityFormatter.findParserSpecByQuantityType(quantityType));
62
68
  }
63
- });
69
+ };
64
70
  IModelApp.quantityFormatter.onQuantityFormatsChanged.addListener(handleUnitSystemChanged);
65
71
  return () => {
66
72
  IModelApp.quantityFormatter.onQuantityFormatsChanged.removeListener(handleUnitSystemChanged);
67
73
  };
68
74
  }, [quantityType]);
69
- return React.createElement(ParsedInput, { "data-testid": "components-quantity-input", ref: ref, style: style, className: classNames, onChange: onQuantityChange, initialValue: initialValue, readonly: readonly, formatValue: formatValue, parseString: parseString });
75
+ return (React.createElement(ParsedInput, { "data-testid": "components-quantity-input", ref: ref, style: style, className: classNames, onChange: onQuantityChange, initialValue: initialValue, readonly: readonly, formatValue: formatValue, parseString: parseString }));
70
76
  }
71
77
  //# 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,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAkBtD;;GAEG;AACH,MAAM,UAAU,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,SAAS,CAAC,iBAAiB,CAAC,+BAA+B,CAAC,YAAY,CAAC,CAAC,CAAC;IAC1I,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,KAAK,CA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B,OAAO,oBAAC,WAAW,mBAAa,2BAA2B,EAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,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","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,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAkBtD;;GAEG;AACH,MAAM,UAAU,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,SAAS,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,SAAS,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,C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,CAAC;QACF,OAAO,GAAG,EAAE;YACV,SAAS,CAAC,iBAAiB,CAAC,mCAAmC,CAAC,cAAc,CAC5E,uBAAuB,CACxB,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAEnB,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,uBAAuB,GAAG,CAC9B,IAAgC,EAC1B,EAAE;YACR,MAAM,WAAW,GACf,SAAS,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;YAC/D,uBAAuB;YACvB,IAAI,IAAI,CAAC,YAAY,KAAK,WAAW,EAAE;gBACrC,gBAAgB,CACd,SAAS,CAAC,iBAAiB,CAAC,+BAA+B,CACzD,YAAY,CACb,CACF,CAAC;gBACF,aAAa,CACX,SAAS,CAAC,iBAAiB,CAAC,4BAA4B,CAAC,YAAY,CAAC,CACvE,CAAC;aACH;QACH,CAAC,CAAC;QAEF,SAAS,CAAC,iBAAiB,CAAC,wBAAwB,CAAC,WAAW,CAC9D,uBAAuB,CACxB,CAAC;QACF,OAAO,GAAG,EAAE;YACV,SAAS,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,WAAW,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","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,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  /** @packageDocumentation
6
6
  * @module Inputs
7
7
  */
@@ -11,9 +11,9 @@ import * as React from "react";
11
11
  import { Icon } from "@itwin/core-react";
12
12
  import { SpecialKey } from "@itwin/appui-abstract";
13
13
  import { IModelApp } from "@itwin/core-frontend";
14
- import { DecimalPrecision, FormatterSpec, FormatTraits, FormatType, Parser } from "@itwin/core-quantity";
14
+ import { DecimalPrecision, FormatterSpec, FormatTraits, FormatType, Parser, } from "@itwin/core-quantity";
15
15
  import { Input } from "@itwin/itwinui-react";
16
- import { SvgCaretDown, SvgCaretDownSmall, SvgCaretUp, SvgCaretUpSmall } from "@itwin/itwinui-icons-react";
16
+ import { SvgCaretDown, SvgCaretDownSmall, SvgCaretUp, SvgCaretUpSmall, } from "@itwin/itwinui-icons-react";
17
17
  /** adjust formatter spec to show only primary unit without a label. */
18
18
  function adjustFormatterSpec(formatterSpec) {
19
19
  if (undefined === formatterSpec)
@@ -24,7 +24,9 @@ function adjustFormatterSpec(formatterSpec) {
24
24
  showOnlyPrimaryUnit: true,
25
25
  traits: formatterSpec.format.formatTraits & ~FormatTraits.ShowUnitLabel,
26
26
  type: FormatType.Decimal,
27
- precision: FormatType.Decimal !== formatterSpec.format.type ? DecimalPrecision.Four : formatterSpec.format.precision,
27
+ precision: FormatType.Decimal !== formatterSpec.format.type
28
+ ? DecimalPrecision.Four
29
+ : formatterSpec.format.precision,
28
30
  });
29
31
  return new FormatterSpec("single-value", newFormat, singleUnitConversion, formatterSpec.persistenceUnit);
30
32
  }
@@ -36,7 +38,7 @@ function convertValueFromDisplayToPersistence(value, unitConversions, unit) {
36
38
  // istanbul ignore next
37
39
  if (!unitConversion)
38
40
  return value;
39
- const convertedValue = (value * unitConversion.conversion.factor) + unitConversion.conversion.offset;
41
+ const convertedValue = value * unitConversion.conversion.factor + unitConversion.conversion.offset;
40
42
  return convertedValue;
41
43
  }
42
44
  function getUnitLabel(parserSpec) {
@@ -68,24 +70,24 @@ const ForwardRefQuantityNumberInput = React.forwardRef(function ForwardRefQuanti
68
70
  const lastFormattedValueRef = React.useRef(formatValue(persistenceValue));
69
71
  const [formattedValue, setFormattedValue] = React.useState(() => lastFormattedValueRef.current);
70
72
  React.useEffect(() => {
71
- const handleUnitSystemChanged = (() => {
73
+ const handleUnitSystemChanged = () => {
72
74
  setFormatterSpec(adjustFormatterSpec(IModelApp.quantityFormatter.findFormatterSpecByQuantityType(quantityType)));
73
75
  setParserSpec(IModelApp.quantityFormatter.findParserSpecByQuantityType(quantityType));
74
- });
76
+ };
75
77
  IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.addListener(handleUnitSystemChanged);
76
78
  return () => {
77
79
  IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.removeListener(handleUnitSystemChanged);
78
80
  };
79
81
  }, [quantityType]);
80
82
  React.useEffect(() => {
81
- const handleUnitSystemChanged = ((args) => {
83
+ const handleUnitSystemChanged = (args) => {
82
84
  const quantityKey = IModelApp.quantityFormatter.getQuantityTypeKey(quantityType);
83
85
  // istanbul ignore else
84
86
  if (args.quantityType === quantityKey) {
85
87
  setFormatterSpec(adjustFormatterSpec(IModelApp.quantityFormatter.findFormatterSpecByQuantityType(quantityType)));
86
88
  setParserSpec(IModelApp.quantityFormatter.findParserSpecByQuantityType(quantityType));
87
89
  }
88
- });
90
+ };
89
91
  IModelApp.quantityFormatter.onQuantityFormatsChanged.addListener(handleUnitSystemChanged);
90
92
  return () => {
91
93
  IModelApp.quantityFormatter.onQuantityFormatsChanged.removeListener(handleUnitSystemChanged);
@@ -107,7 +109,9 @@ const ForwardRefQuantityNumberInput = React.forwardRef(function ForwardRefQuanti
107
109
  // istanbul ignore else
108
110
  if (parserSpec) {
109
111
  // convert value from display unit to persistence unit
110
- const [unit] = parserSpec.format.units ? parserSpec.format.units[0] : /* istanbul ignore next */ [parserSpec.outUnit];
112
+ const [unit] = parserSpec.format.units
113
+ ? parserSpec.format.units[0]
114
+ : /* istanbul ignore next */ [parserSpec.outUnit];
111
115
  persistedValue = convertValueFromDisplayToPersistence(newValue, parserSpec.unitConversions, unit);
112
116
  rawValueRef.current = persistedValue;
113
117
  }
@@ -116,12 +120,12 @@ const ForwardRefQuantityNumberInput = React.forwardRef(function ForwardRefQuanti
116
120
  setFormattedValue(newFormattedVal);
117
121
  }, [formatValue, onChange, parserSpec]);
118
122
  /**
119
- * Used internally to parse the argument x to it's numeric representation.
120
- * If the argument cannot be converted to finite number returns 0; If a
121
- * "precision" prop is specified uses it round the number with that
122
- * precision (no fixed precision here because the return value is float, not
123
- * string).
124
- */
123
+ * Used internally to parse the argument x to it's numeric representation.
124
+ * If the argument cannot be converted to finite number returns 0; If a
125
+ * "precision" prop is specified uses it round the number with that
126
+ * precision (no fixed precision here because the return value is float, not
127
+ * string).
128
+ */
125
129
  const parseInternal = React.useCallback((x) => {
126
130
  if (!x)
127
131
  return 0;
@@ -150,7 +154,8 @@ const ForwardRefQuantityNumberInput = React.forwardRef(function ForwardRefQuanti
150
154
  }
151
155
  else {
152
156
  // istanbul ignore else
153
- if (rawValueRef.current) { // restore last known good value
157
+ if (rawValueRef.current) {
158
+ // restore last known good value
154
159
  const lastKnownFormattedVal = formatValue(rawValueRef.current);
155
160
  setFormattedValue(lastKnownFormattedVal);
156
161
  return;
@@ -175,11 +180,12 @@ const ForwardRefQuantityNumberInput = React.forwardRef(function ForwardRefQuanti
175
180
  return !step ? 1 : step;
176
181
  }, [step]);
177
182
  /**
178
- * The internal method that actually sets the new value on the input
179
- */
183
+ * The internal method that actually sets the new value on the input
184
+ */
180
185
  const applyStep = React.useCallback((increment) => {
181
186
  const incrementValue = getIncrementValue(increment);
182
- let num = parseInternal(formattedValue) + (increment ? incrementValue : -incrementValue);
187
+ let num = parseInternal(formattedValue) +
188
+ (increment ? incrementValue : -incrementValue);
183
189
  if (snap) {
184
190
  num = Math.round(num / incrementValue) * incrementValue;
185
191
  }
@@ -187,7 +193,15 @@ const ForwardRefQuantityNumberInput = React.forwardRef(function ForwardRefQuanti
187
193
  const localMax = undefined === max ? Number.MAX_SAFE_INTEGER : max;
188
194
  num = Math.min(Math.max(num, localMin), localMax);
189
195
  updateValue(num);
190
- }, [formattedValue, getIncrementValue, max, min, parseInternal, snap, updateValue]);
196
+ }, [
197
+ formattedValue,
198
+ getIncrementValue,
199
+ max,
200
+ min,
201
+ parseInternal,
202
+ snap,
203
+ updateValue,
204
+ ]);
191
205
  const handleKeyDown = React.useCallback((event) => {
192
206
  // istanbul ignore else
193
207
  if (event.key === SpecialKey.Enter) {