@itwin/imodel-components-react 4.0.0-dev.12 → 4.0.0-dev.14

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 (282) hide show
  1. package/CHANGELOG.md +113 -1
  2. package/README.md +2 -2
  3. package/lib/cjs/imodel-components-react/UiIModelComponents.d.ts +28 -28
  4. package/lib/cjs/imodel-components-react/UiIModelComponents.js +75 -77
  5. package/lib/cjs/imodel-components-react/UiIModelComponents.js.map +1 -1
  6. package/lib/cjs/imodel-components-react/color/AlphaSlider.d.ts +36 -36
  7. package/lib/cjs/imodel-components-react/color/AlphaSlider.js +190 -186
  8. package/lib/cjs/imodel-components-react/color/AlphaSlider.js.map +1 -1
  9. package/lib/cjs/imodel-components-react/color/ColorPickerButton.d.ts +37 -37
  10. package/lib/cjs/imodel-components-react/color/ColorPickerButton.js +112 -108
  11. package/lib/cjs/imodel-components-react/color/ColorPickerButton.js.map +1 -1
  12. package/lib/cjs/imodel-components-react/color/ColorPickerDialog.d.ts +23 -23
  13. package/lib/cjs/imodel-components-react/color/ColorPickerDialog.js +78 -74
  14. package/lib/cjs/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
  15. package/lib/cjs/imodel-components-react/color/ColorPickerPanel.d.ts +21 -21
  16. package/lib/cjs/imodel-components-react/color/ColorPickerPanel.js +149 -145
  17. package/lib/cjs/imodel-components-react/color/ColorPickerPanel.js.map +1 -1
  18. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.d.ts +44 -44
  19. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.js +143 -139
  20. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
  21. package/lib/cjs/imodel-components-react/color/HueSlider.d.ts +22 -22
  22. package/lib/cjs/imodel-components-react/color/HueSlider.js +203 -199
  23. package/lib/cjs/imodel-components-react/color/HueSlider.js.map +1 -1
  24. package/lib/cjs/imodel-components-react/color/SaturationPicker.d.ts +20 -20
  25. package/lib/cjs/imodel-components-react/color/SaturationPicker.js +217 -213
  26. package/lib/cjs/imodel-components-react/color/SaturationPicker.js.map +1 -1
  27. package/lib/cjs/imodel-components-react/color/Swatch.d.ts +22 -22
  28. package/lib/cjs/imodel-components-react/color/Swatch.js +64 -60
  29. package/lib/cjs/imodel-components-react/color/Swatch.js.map +1 -1
  30. package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.d.ts +6 -6
  31. package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.js +23 -23
  32. package/lib/cjs/imodel-components-react/editors/ColorEditor.d.ts +44 -44
  33. package/lib/cjs/imodel-components-react/editors/ColorEditor.js +155 -151
  34. package/lib/cjs/imodel-components-react/editors/ColorEditor.js.map +1 -1
  35. package/lib/cjs/imodel-components-react/editors/WeightEditor.d.ts +47 -47
  36. package/lib/cjs/imodel-components-react/editors/WeightEditor.js +164 -160
  37. package/lib/cjs/imodel-components-react/editors/WeightEditor.js.map +1 -1
  38. package/lib/cjs/imodel-components-react/inputs/QuantityInput.d.ts +25 -25
  39. package/lib/cjs/imodel-components-react/inputs/QuantityInput.js +100 -96
  40. package/lib/cjs/imodel-components-react/inputs/QuantityInput.js.map +1 -1
  41. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.d.ts +44 -44
  42. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.d.ts.map +1 -1
  43. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js +272 -268
  44. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
  45. package/lib/cjs/imodel-components-react/lineweight/Swatch.d.ts +33 -33
  46. package/lib/cjs/imodel-components-react/lineweight/Swatch.js +89 -85
  47. package/lib/cjs/imodel-components-react/lineweight/Swatch.js.map +1 -1
  48. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.d.ts +60 -60
  49. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.js +163 -159
  50. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
  51. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.scss +1 -2
  52. package/lib/cjs/imodel-components-react/navigationaids/Cube.d.ts +45 -45
  53. package/lib/cjs/imodel-components-react/navigationaids/Cube.js +131 -127
  54. package/lib/cjs/imodel-components-react/navigationaids/Cube.js.map +1 -1
  55. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.d.ts +175 -174
  56. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.d.ts.map +1 -1
  57. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js +650 -638
  58. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
  59. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts +145 -145
  60. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.js +657 -653
  61. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
  62. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.d.ts +26 -26
  63. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js +103 -99
  64. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
  65. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.scss +0 -4
  66. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.d.ts +17 -17
  67. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js +56 -53
  68. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
  69. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.d.ts +18 -18
  70. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js +88 -84
  71. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
  72. package/lib/cjs/imodel-components-react/quantityformat/FormatType.d.ts +17 -17
  73. package/lib/cjs/imodel-components-react/quantityformat/FormatType.js +89 -86
  74. package/lib/cjs/imodel-components-react/quantityformat/FormatType.js.map +1 -1
  75. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.d.ts +17 -17
  76. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js +112 -109
  77. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
  78. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.d.ts +19 -19
  79. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js +133 -133
  80. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
  81. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.d.ts +21 -21
  82. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js +187 -184
  83. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
  84. package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts +22 -22
  85. package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.js +149 -145
  86. package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.js.map +1 -1
  87. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.d.ts +17 -17
  88. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.js +63 -59
  89. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.js.map +1 -1
  90. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.d.ts +17 -17
  91. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.js +51 -47
  92. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.js.map +1 -1
  93. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.d.ts +16 -16
  94. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.js +58 -54
  95. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.js.map +1 -1
  96. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.d.ts +18 -18
  97. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.js +52 -48
  98. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.js.map +1 -1
  99. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.d.ts +17 -17
  100. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.js +54 -50
  101. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.js.map +1 -1
  102. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.d.ts +17 -17
  103. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js +62 -58
  104. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js.map +1 -1
  105. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.d.ts +17 -17
  106. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.js +51 -47
  107. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.js.map +1 -1
  108. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.d.ts +17 -17
  109. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.js +60 -56
  110. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.js.map +1 -1
  111. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts +17 -17
  112. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +98 -95
  113. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
  114. package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.d.ts +23 -23
  115. package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.js +123 -119
  116. package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.js.map +1 -1
  117. package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.d.ts +52 -52
  118. package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.d.ts.map +1 -1
  119. package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.js +142 -143
  120. package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.js.map +1 -1
  121. package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.d.ts +31 -31
  122. package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.js +69 -69
  123. package/lib/cjs/imodel-components-react/timeline/InlineEdit.d.ts +27 -27
  124. package/lib/cjs/imodel-components-react/timeline/InlineEdit.js +85 -81
  125. package/lib/cjs/imodel-components-react/timeline/InlineEdit.js.map +1 -1
  126. package/lib/cjs/imodel-components-react/timeline/PlayerButton.d.ts +33 -33
  127. package/lib/cjs/imodel-components-react/timeline/PlayerButton.js +99 -95
  128. package/lib/cjs/imodel-components-react/timeline/PlayerButton.js.map +1 -1
  129. package/lib/cjs/imodel-components-react/timeline/Scrubber.d.ts +54 -54
  130. package/lib/cjs/imodel-components-react/timeline/Scrubber.js +195 -191
  131. package/lib/cjs/imodel-components-react/timeline/Scrubber.js.map +1 -1
  132. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.d.ts +77 -77
  133. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.js +432 -428
  134. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
  135. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.d.ts +15 -15
  136. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.js +58 -54
  137. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.js.map +1 -1
  138. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.d.ts +130 -133
  139. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.d.ts.map +1 -1
  140. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js +398 -365
  141. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
  142. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.scss +17 -0
  143. package/lib/cjs/imodel-components-react/timeline/interfaces.d.ts +174 -174
  144. package/lib/cjs/imodel-components-react/timeline/interfaces.d.ts.map +1 -1
  145. package/lib/cjs/imodel-components-react/timeline/interfaces.js +45 -45
  146. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.d.ts +42 -42
  147. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.d.ts.map +1 -1
  148. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js +276 -274
  149. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
  150. package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.d.ts +106 -106
  151. package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.js +105 -105
  152. package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.js.map +1 -1
  153. package/lib/cjs/imodel-components-react.d.ts +82 -82
  154. package/lib/cjs/imodel-components-react.js +105 -101
  155. package/lib/cjs/imodel-components-react.js.map +1 -1
  156. package/lib/esm/imodel-components-react/UiIModelComponents.d.ts +28 -28
  157. package/lib/esm/imodel-components-react/UiIModelComponents.js +72 -73
  158. package/lib/esm/imodel-components-react/UiIModelComponents.js.map +1 -1
  159. package/lib/esm/imodel-components-react/color/AlphaSlider.d.ts +36 -36
  160. package/lib/esm/imodel-components-react/color/AlphaSlider.js +160 -160
  161. package/lib/esm/imodel-components-react/color/ColorPickerButton.d.ts +37 -37
  162. package/lib/esm/imodel-components-react/color/ColorPickerButton.js +83 -83
  163. package/lib/esm/imodel-components-react/color/ColorPickerButton.js.map +1 -1
  164. package/lib/esm/imodel-components-react/color/ColorPickerDialog.d.ts +23 -23
  165. package/lib/esm/imodel-components-react/color/ColorPickerDialog.js +51 -51
  166. package/lib/esm/imodel-components-react/color/ColorPickerPanel.d.ts +21 -21
  167. package/lib/esm/imodel-components-react/color/ColorPickerPanel.js +122 -122
  168. package/lib/esm/imodel-components-react/color/ColorPickerPanel.js.map +1 -1
  169. package/lib/esm/imodel-components-react/color/ColorPickerPopup.d.ts +44 -44
  170. package/lib/esm/imodel-components-react/color/ColorPickerPopup.js +114 -114
  171. package/lib/esm/imodel-components-react/color/HueSlider.d.ts +22 -22
  172. package/lib/esm/imodel-components-react/color/HueSlider.js +173 -173
  173. package/lib/esm/imodel-components-react/color/SaturationPicker.d.ts +20 -20
  174. package/lib/esm/imodel-components-react/color/SaturationPicker.js +187 -187
  175. package/lib/esm/imodel-components-react/color/Swatch.d.ts +22 -22
  176. package/lib/esm/imodel-components-react/color/Swatch.js +34 -34
  177. package/lib/esm/imodel-components-react/color/getCSSColorFromDef.d.ts +6 -6
  178. package/lib/esm/imodel-components-react/color/getCSSColorFromDef.js +19 -19
  179. package/lib/esm/imodel-components-react/editors/ColorEditor.d.ts +44 -44
  180. package/lib/esm/imodel-components-react/editors/ColorEditor.js +124 -124
  181. package/lib/esm/imodel-components-react/editors/WeightEditor.d.ts +47 -47
  182. package/lib/esm/imodel-components-react/editors/WeightEditor.js +133 -133
  183. package/lib/esm/imodel-components-react/inputs/QuantityInput.d.ts +25 -25
  184. package/lib/esm/imodel-components-react/inputs/QuantityInput.js +70 -70
  185. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.d.ts +44 -44
  186. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.d.ts.map +1 -1
  187. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js +243 -243
  188. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
  189. package/lib/esm/imodel-components-react/lineweight/Swatch.d.ts +33 -33
  190. package/lib/esm/imodel-components-react/lineweight/Swatch.js +59 -59
  191. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.d.ts +60 -60
  192. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.js +134 -133
  193. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
  194. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.scss +1 -2
  195. package/lib/esm/imodel-components-react/navigationaids/Cube.d.ts +45 -45
  196. package/lib/esm/imodel-components-react/navigationaids/Cube.js +100 -100
  197. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.d.ts +175 -174
  198. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.d.ts.map +1 -1
  199. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js +620 -610
  200. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
  201. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts +145 -145
  202. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.js +627 -626
  203. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
  204. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.d.ts +26 -26
  205. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js +76 -76
  206. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
  207. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.scss +0 -4
  208. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.d.ts +17 -17
  209. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js +29 -30
  210. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
  211. package/lib/esm/imodel-components-react/quantityformat/FormatSample.d.ts +18 -18
  212. package/lib/esm/imodel-components-react/quantityformat/FormatSample.js +61 -61
  213. package/lib/esm/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
  214. package/lib/esm/imodel-components-react/quantityformat/FormatType.d.ts +17 -17
  215. package/lib/esm/imodel-components-react/quantityformat/FormatType.js +62 -63
  216. package/lib/esm/imodel-components-react/quantityformat/FormatType.js.map +1 -1
  217. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.d.ts +17 -17
  218. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js +82 -83
  219. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
  220. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.d.ts +19 -19
  221. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js +106 -110
  222. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
  223. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.d.ts +21 -21
  224. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js +157 -158
  225. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
  226. package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts +22 -22
  227. package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.js +122 -122
  228. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.d.ts +17 -17
  229. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.js +36 -36
  230. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.d.ts +17 -17
  231. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.js +24 -24
  232. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.d.ts +16 -16
  233. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.js +31 -31
  234. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.d.ts +18 -18
  235. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.js +25 -25
  236. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.d.ts +17 -17
  237. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.js +27 -27
  238. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.d.ts +17 -17
  239. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js +35 -35
  240. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.d.ts +17 -17
  241. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.js +24 -24
  242. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.d.ts +17 -17
  243. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.js +33 -33
  244. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts +17 -17
  245. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +68 -69
  246. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
  247. package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.d.ts +23 -23
  248. package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.js +96 -96
  249. package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.d.ts +52 -52
  250. package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.d.ts.map +1 -1
  251. package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.js +138 -139
  252. package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.js.map +1 -1
  253. package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.d.ts +31 -31
  254. package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.js +65 -65
  255. package/lib/esm/imodel-components-react/timeline/InlineEdit.d.ts +27 -27
  256. package/lib/esm/imodel-components-react/timeline/InlineEdit.js +55 -55
  257. package/lib/esm/imodel-components-react/timeline/PlayerButton.d.ts +33 -33
  258. package/lib/esm/imodel-components-react/timeline/PlayerButton.js +68 -68
  259. package/lib/esm/imodel-components-react/timeline/Scrubber.d.ts +54 -54
  260. package/lib/esm/imodel-components-react/timeline/Scrubber.js +164 -164
  261. package/lib/esm/imodel-components-react/timeline/SolarTimeline.d.ts +77 -77
  262. package/lib/esm/imodel-components-react/timeline/SolarTimeline.js +402 -402
  263. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.d.ts +15 -15
  264. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.js +28 -28
  265. package/lib/esm/imodel-components-react/timeline/TimelineComponent.d.ts +130 -133
  266. package/lib/esm/imodel-components-react/timeline/TimelineComponent.d.ts.map +1 -1
  267. package/lib/esm/imodel-components-react/timeline/TimelineComponent.js +368 -339
  268. package/lib/esm/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
  269. package/lib/esm/imodel-components-react/timeline/TimelineComponent.scss +17 -0
  270. package/lib/esm/imodel-components-react/timeline/interfaces.d.ts +174 -174
  271. package/lib/esm/imodel-components-react/timeline/interfaces.d.ts.map +1 -1
  272. package/lib/esm/imodel-components-react/timeline/interfaces.js +42 -42
  273. package/lib/esm/imodel-components-react/viewport/ViewportComponent.d.ts +42 -42
  274. package/lib/esm/imodel-components-react/viewport/ViewportComponent.d.ts.map +1 -1
  275. package/lib/esm/imodel-components-react/viewport/ViewportComponent.js +249 -251
  276. package/lib/esm/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
  277. package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.d.ts +106 -106
  278. package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.js +96 -95
  279. package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.js.map +1 -1
  280. package/lib/esm/imodel-components-react.d.ts +82 -82
  281. package/lib/esm/imodel-components-react.js +87 -87
  282. package/package.json +26 -24
@@ -1,269 +1,273 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- /** @packageDocumentation
7
- * @module Inputs
8
- */
9
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12
- }) : (function(o, m, k, k2) {
13
- if (k2 === undefined) k2 = k;
14
- o[k2] = m[k];
15
- }));
16
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
- Object.defineProperty(o, "default", { enumerable: true, value: v });
18
- }) : function(o, v) {
19
- o["default"] = v;
20
- });
21
- var __importStar = (this && this.__importStar) || function (mod) {
22
- if (mod && mod.__esModule) return mod;
23
- var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
- __setModuleDefault(result, mod);
26
- return result;
27
- };
28
- var __importDefault = (this && this.__importDefault) || function (mod) {
29
- return (mod && mod.__esModule) ? mod : { "default": mod };
30
- };
31
- Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.QuantityNumberInput = void 0;
33
- require("./QuantityNumberInput.scss");
34
- const classnames_1 = __importDefault(require("classnames"));
35
- const React = __importStar(require("react"));
36
- const core_react_1 = require("@itwin/core-react");
37
- const appui_abstract_1 = require("@itwin/appui-abstract");
38
- const core_frontend_1 = require("@itwin/core-frontend");
39
- const core_quantity_1 = require("@itwin/core-quantity");
40
- const itwinui_react_1 = require("@itwin/itwinui-react");
41
- const itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
42
- /** adjust formatter spec to show only primary unit without a label. */
43
- function adjustFormatterSpec(formatterSpec) {
44
- if (undefined === formatterSpec)
45
- return formatterSpec;
46
- const singleUnitConversion = [];
47
- singleUnitConversion.push(formatterSpec.unitConversions[0]);
48
- const newFormat = formatterSpec.format.clone({
49
- showOnlyPrimaryUnit: true,
50
- traits: formatterSpec.format.formatTraits & ~core_quantity_1.FormatTraits.ShowUnitLabel,
51
- type: core_quantity_1.FormatType.Decimal,
52
- precision: core_quantity_1.FormatType.Decimal !== formatterSpec.format.type ? core_quantity_1.DecimalPrecision.Four : formatterSpec.format.precision,
53
- });
54
- return new core_quantity_1.FormatterSpec("single-value", newFormat, singleUnitConversion, formatterSpec.persistenceUnit);
55
- }
56
- function convertValueFromDisplayToPersistence(value, unitConversions, unit) {
57
- // istanbul ignore next
58
- if (!unitConversions || 0 === unitConversions.length)
59
- return value;
60
- const unitConversion = unitConversions.find((spec) => spec.name === unit.name);
61
- // istanbul ignore next
62
- if (!unitConversion)
63
- return value;
64
- const convertedValue = (value * unitConversion.conversion.factor) + unitConversion.conversion.offset;
65
- return convertedValue;
66
- }
67
- function getUnitLabel(parserSpec) {
68
- if (undefined === parserSpec)
69
- return "";
70
- const format = parserSpec.format;
71
- // istanbul ignore else
72
- if (!format.units || !format.units[0])
73
- return parserSpec.outUnit.label;
74
- const [unit, label] = format.units[0];
75
- // istanbul ignore next
76
- return label !== null && label !== void 0 ? label : unit.label;
77
- }
78
- const ForwardRefQuantityNumberInput = React.forwardRef(function ForwardRefQuantityNumberInput(props, ref) {
79
- const { containerClassName, persistenceValue, min, max, onChange, onBlur, onKeyDown, step, snap, showTouchButtons, quantityType, ...otherProps } = props;
80
- const rawValueRef = React.useRef(persistenceValue);
81
- const [formatterSpec, setFormatterSpec] = React.useState(() => adjustFormatterSpec(core_frontend_1.IModelApp.quantityFormatter.findFormatterSpecByQuantityType(quantityType)));
82
- const [parserSpec, setParserSpec] = React.useState(() => core_frontend_1.IModelApp.quantityFormatter.findParserSpecByQuantityType(quantityType));
83
- const formatValue = React.useCallback((value) => {
84
- if (undefined === value)
85
- return "";
86
- // istanbul ignore else
87
- if (formatterSpec) {
88
- return formatterSpec.applyFormatting(value);
89
- }
90
- // istanbul ignore next
91
- return value.toFixed(2);
92
- }, [formatterSpec]);
93
- const lastFormattedValueRef = React.useRef(formatValue(persistenceValue));
94
- const [formattedValue, setFormattedValue] = React.useState(() => lastFormattedValueRef.current);
95
- React.useEffect(() => {
96
- const handleUnitSystemChanged = (() => {
97
- setFormatterSpec(adjustFormatterSpec(core_frontend_1.IModelApp.quantityFormatter.findFormatterSpecByQuantityType(quantityType)));
98
- setParserSpec(core_frontend_1.IModelApp.quantityFormatter.findParserSpecByQuantityType(quantityType));
99
- });
100
- core_frontend_1.IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.addListener(handleUnitSystemChanged);
101
- return () => {
102
- core_frontend_1.IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.removeListener(handleUnitSystemChanged);
103
- };
104
- }, [quantityType]);
105
- React.useEffect(() => {
106
- const handleUnitSystemChanged = ((args) => {
107
- const quantityKey = core_frontend_1.IModelApp.quantityFormatter.getQuantityTypeKey(quantityType);
108
- // istanbul ignore else
109
- if (args.quantityType === quantityKey) {
110
- setFormatterSpec(adjustFormatterSpec(core_frontend_1.IModelApp.quantityFormatter.findFormatterSpecByQuantityType(quantityType)));
111
- setParserSpec(core_frontend_1.IModelApp.quantityFormatter.findParserSpecByQuantityType(quantityType));
112
- }
113
- });
114
- core_frontend_1.IModelApp.quantityFormatter.onQuantityFormatsChanged.addListener(handleUnitSystemChanged);
115
- return () => {
116
- core_frontend_1.IModelApp.quantityFormatter.onQuantityFormatsChanged.removeListener(handleUnitSystemChanged);
117
- };
118
- }, [quantityType]);
119
- const unitLabel = getUnitLabel(parserSpec);
120
- // See if new initialValue props have changed since component mounted
121
- React.useEffect(() => {
122
- rawValueRef.current = persistenceValue;
123
- const currentFormattedValue = formatValue(rawValueRef.current);
124
- setFormattedValue(currentFormattedValue);
125
- }, [formatValue, persistenceValue]);
126
- // this is the unprocessed input from user, it is not processed until blur or enter key press
127
- const handleDisplayValueChange = React.useCallback((event) => {
128
- setFormattedValue(event.currentTarget.value);
129
- }, []);
130
- const updateValue = React.useCallback((newValue) => {
131
- let persistedValue = newValue;
132
- // istanbul ignore else
133
- if (parserSpec) {
134
- // convert value from display unit to persistence unit
135
- const [unit] = parserSpec.format.units ? parserSpec.format.units[0] : /* istanbul ignore next */ [parserSpec.outUnit];
136
- persistedValue = convertValueFromDisplayToPersistence(newValue, parserSpec.unitConversions, unit);
137
- rawValueRef.current = persistedValue;
138
- }
139
- const newFormattedVal = formatValue(persistedValue);
140
- onChange && onChange(persistedValue);
141
- setFormattedValue(newFormattedVal);
142
- }, [formatValue, onChange, parserSpec]);
143
- /**
144
- * Used internally to parse the argument x to it's numeric representation.
145
- * If the argument cannot be converted to finite number returns 0; If a
146
- * "precision" prop is specified uses it round the number with that
147
- * precision (no fixed precision here because the return value is float, not
148
- * string).
149
- */
150
- const parseInternal = React.useCallback((x) => {
151
- if (!x)
152
- return 0;
153
- let n = parseFloat(x);
154
- // istanbul ignore next
155
- if (isNaN(n) || !isFinite(n)) {
156
- n = 0;
157
- }
158
- const localPrecision = 6; // TODO get a reasonable value from format
159
- const q = Math.pow(10, localPrecision);
160
- const localMin = undefined === min ? Number.MIN_SAFE_INTEGER : min;
161
- const localMax = undefined === max ? Number.MAX_SAFE_INTEGER : max;
162
- n = Math.min(Math.max(n, localMin), localMax);
163
- n = Math.round(n * q) / q;
164
- return n;
165
- }, [min, max]);
166
- const updateValueFromString = React.useCallback((strValue) => {
167
- // istanbul ignore else
168
- if (parserSpec) {
169
- const parseResult = core_frontend_1.IModelApp.quantityFormatter.parseToQuantityValue(strValue, parserSpec);
170
- // at this point we should have a string value in persistence units without a label
171
- if (core_quantity_1.Parser.isParsedQuantity(parseResult)) {
172
- const persistedValue = parseResult.value; // in persistence units
173
- // set strValue and let it go through parseInternal which will ensure min/max limits are observed
174
- strValue = formatValue(persistedValue);
175
- }
176
- else {
177
- // istanbul ignore else
178
- if (rawValueRef.current) { // restore last known good value
179
- const lastKnownFormattedVal = formatValue(rawValueRef.current);
180
- setFormattedValue(lastKnownFormattedVal);
181
- return;
182
- }
183
- }
184
- }
185
- const newValue = parseInternal(strValue);
186
- // istanbul ignore else
187
- if (undefined !== newValue)
188
- updateValue(newValue);
189
- }, [formatValue, parseInternal, parserSpec, updateValue]);
190
- const handleBlur = React.useCallback((event) => {
191
- const newVal = parseInternal(event.target.value);
192
- onBlur && onBlur(event);
193
- updateValue(newVal);
194
- }, [parseInternal, updateValue, onBlur]);
195
- const getIncrementValue = React.useCallback((increment) => {
196
- if (typeof step === "function") {
197
- const stepVal = step(increment ? "up" : "down");
198
- return stepVal ? stepVal : 1;
199
- }
200
- return !step ? 1 : step;
201
- }, [step]);
202
- /**
203
- * The internal method that actually sets the new value on the input
204
- */
205
- const applyStep = React.useCallback((increment) => {
206
- const incrementValue = getIncrementValue(increment);
207
- let num = parseInternal(formattedValue) + (increment ? incrementValue : -incrementValue);
208
- if (snap) {
209
- num = Math.round(num / incrementValue) * incrementValue;
210
- }
211
- const localMin = undefined === min ? Number.MIN_SAFE_INTEGER : min;
212
- const localMax = undefined === max ? Number.MAX_SAFE_INTEGER : max;
213
- num = Math.min(Math.max(num, localMin), localMax);
214
- updateValue(num);
215
- }, [formattedValue, getIncrementValue, max, min, parseInternal, snap, updateValue]);
216
- const handleKeyDown = React.useCallback((event) => {
217
- // istanbul ignore else
218
- if (event.key === appui_abstract_1.SpecialKey.Enter) {
219
- updateValueFromString(event.currentTarget.value);
220
- event.preventDefault();
221
- }
222
- else if (event.key === appui_abstract_1.SpecialKey.Escape) {
223
- setFormattedValue(formatValue(rawValueRef.current));
224
- event.preventDefault();
225
- }
226
- else if (event.key === appui_abstract_1.SpecialKey.ArrowDown) {
227
- applyStep(false);
228
- event.preventDefault();
229
- }
230
- else if (event.key === appui_abstract_1.SpecialKey.ArrowUp) {
231
- applyStep(true);
232
- event.preventDefault();
233
- }
234
- onKeyDown && onKeyDown(event);
235
- }, [onKeyDown, updateValueFromString, formatValue, applyStep]);
236
- const handleDownClick = React.useCallback((event) => {
237
- applyStep(false);
238
- event.preventDefault();
239
- }, [applyStep]);
240
- const handleUpClick = React.useCallback((event) => {
241
- applyStep(true);
242
- event.preventDefault();
243
- }, [applyStep]);
244
- // istanbul ignore next
245
- const handleFocus = React.useCallback((event) => {
246
- event.currentTarget.select();
247
- }, []);
248
- const isDisabled = !!otherProps.disabled;
249
- const containerClasses = (0, classnames_1.default)("component-quantity-number-input-container", containerClassName, showTouchButtons && "component-number-buttons-for-touch", isDisabled && "component-quantity-number-input-disabled");
250
- const caretUp = showTouchButtons ? React.createElement(itwinui_icons_react_1.SvgCaretUp, null) : React.createElement(itwinui_icons_react_1.SvgCaretUpSmall, null);
251
- const caretDown = showTouchButtons ? React.createElement(itwinui_icons_react_1.SvgCaretDown, null) : React.createElement(itwinui_icons_react_1.SvgCaretDownSmall, null);
252
- return (React.createElement("div", { className: containerClasses },
253
- React.createElement("div", { className: "component-quantity-number-input-value-and-buttons-container" },
254
- React.createElement(itwinui_react_1.Input, { ref: ref, value: formattedValue, onChange: handleDisplayValueChange, onKeyDown: handleKeyDown, onBlur: handleBlur, onFocus: handleFocus, size: "small", ...otherProps }),
255
- React.createElement("div", { className: (0, classnames_1.default)("component-quantity-number-input-buttons-container", showTouchButtons && "component-number-buttons-for-touch") },
256
- React.createElement("div", { className: "component-quantity-number-input-button component-quantity-number-input-button-up", tabIndex: -1, onClick: handleUpClick },
257
- React.createElement(core_react_1.Icon, { iconSpec: caretUp })),
258
- React.createElement("div", { className: "component-quantity-number-input-button component-quantity-number-input-button-down", tabIndex: -1, onClick: handleDownClick },
259
- React.createElement(core_react_1.Icon, { iconSpec: caretDown })))),
260
- React.createElement("span", { className: "component-quantity-number-input-suffix" }, unitLabel)));
261
- });
262
- /** The QuantityNumberInput component accepts input for quantity values. The quantity value is shown as a single numeric value and the quantity's
263
- * "display" unit is shown next to the input control. The "display" unit is determined by the active unit system as defined by the [QuantityFormatter]($frontend).
264
- * The control also display buttons to increment and decrement the "displayed" value. The value reported by via the onChange function is in "persistence"
265
- * units that can be stored in the iModel.
266
- * @beta
267
- */
268
- exports.QuantityNumberInput = ForwardRefQuantityNumberInput;
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ /** @packageDocumentation
7
+ * @module Inputs
8
+ */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
22
+ }) : function(o, v) {
23
+ o["default"] = v;
24
+ });
25
+ var __importStar = (this && this.__importStar) || function (mod) {
26
+ if (mod && mod.__esModule) return mod;
27
+ var result = {};
28
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
29
+ __setModuleDefault(result, mod);
30
+ return result;
31
+ };
32
+ var __importDefault = (this && this.__importDefault) || function (mod) {
33
+ return (mod && mod.__esModule) ? mod : { "default": mod };
34
+ };
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.QuantityNumberInput = void 0;
37
+ require("./QuantityNumberInput.scss");
38
+ const classnames_1 = __importDefault(require("classnames"));
39
+ const React = __importStar(require("react"));
40
+ const core_react_1 = require("@itwin/core-react");
41
+ const appui_abstract_1 = require("@itwin/appui-abstract");
42
+ const core_frontend_1 = require("@itwin/core-frontend");
43
+ const core_quantity_1 = require("@itwin/core-quantity");
44
+ const itwinui_react_1 = require("@itwin/itwinui-react");
45
+ const itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
46
+ /** adjust formatter spec to show only primary unit without a label. */
47
+ function adjustFormatterSpec(formatterSpec) {
48
+ if (undefined === formatterSpec)
49
+ return formatterSpec;
50
+ const singleUnitConversion = [];
51
+ singleUnitConversion.push(formatterSpec.unitConversions[0]);
52
+ const newFormat = formatterSpec.format.clone({
53
+ showOnlyPrimaryUnit: true,
54
+ traits: formatterSpec.format.formatTraits & ~core_quantity_1.FormatTraits.ShowUnitLabel,
55
+ type: core_quantity_1.FormatType.Decimal,
56
+ precision: core_quantity_1.FormatType.Decimal !== formatterSpec.format.type ? core_quantity_1.DecimalPrecision.Four : formatterSpec.format.precision,
57
+ });
58
+ return new core_quantity_1.FormatterSpec("single-value", newFormat, singleUnitConversion, formatterSpec.persistenceUnit);
59
+ }
60
+ function convertValueFromDisplayToPersistence(value, unitConversions, unit) {
61
+ // istanbul ignore next
62
+ if (!unitConversions || 0 === unitConversions.length)
63
+ return value;
64
+ const unitConversion = unitConversions.find((spec) => spec.name === unit.name);
65
+ // istanbul ignore next
66
+ if (!unitConversion)
67
+ return value;
68
+ const convertedValue = (value * unitConversion.conversion.factor) + unitConversion.conversion.offset;
69
+ return convertedValue;
70
+ }
71
+ function getUnitLabel(parserSpec) {
72
+ if (undefined === parserSpec)
73
+ return "";
74
+ const format = parserSpec.format;
75
+ // istanbul ignore else
76
+ if (!format.units || !format.units[0])
77
+ return parserSpec.outUnit.label;
78
+ const [unit, label] = format.units[0];
79
+ // istanbul ignore next
80
+ return label ?? unit.label;
81
+ }
82
+ const ForwardRefQuantityNumberInput = React.forwardRef(function ForwardRefQuantityNumberInput(props, ref) {
83
+ const { containerClassName, persistenceValue, min, max, onChange, onBlur, onKeyDown, step, snap, showTouchButtons, quantityType, ...otherProps } = props;
84
+ const rawValueRef = React.useRef(persistenceValue);
85
+ const [formatterSpec, setFormatterSpec] = React.useState(() => adjustFormatterSpec(core_frontend_1.IModelApp.quantityFormatter.findFormatterSpecByQuantityType(quantityType)));
86
+ const [parserSpec, setParserSpec] = React.useState(() => core_frontend_1.IModelApp.quantityFormatter.findParserSpecByQuantityType(quantityType));
87
+ const formatValue = React.useCallback((value) => {
88
+ if (undefined === value)
89
+ return "";
90
+ // istanbul ignore else
91
+ if (formatterSpec) {
92
+ return formatterSpec.applyFormatting(value);
93
+ }
94
+ // istanbul ignore next
95
+ return value.toFixed(2);
96
+ }, [formatterSpec]);
97
+ const lastFormattedValueRef = React.useRef(formatValue(persistenceValue));
98
+ const [formattedValue, setFormattedValue] = React.useState(() => lastFormattedValueRef.current);
99
+ React.useEffect(() => {
100
+ const handleUnitSystemChanged = (() => {
101
+ setFormatterSpec(adjustFormatterSpec(core_frontend_1.IModelApp.quantityFormatter.findFormatterSpecByQuantityType(quantityType)));
102
+ setParserSpec(core_frontend_1.IModelApp.quantityFormatter.findParserSpecByQuantityType(quantityType));
103
+ });
104
+ core_frontend_1.IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.addListener(handleUnitSystemChanged);
105
+ return () => {
106
+ core_frontend_1.IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.removeListener(handleUnitSystemChanged);
107
+ };
108
+ }, [quantityType]);
109
+ React.useEffect(() => {
110
+ const handleUnitSystemChanged = ((args) => {
111
+ const quantityKey = core_frontend_1.IModelApp.quantityFormatter.getQuantityTypeKey(quantityType);
112
+ // istanbul ignore else
113
+ if (args.quantityType === quantityKey) {
114
+ setFormatterSpec(adjustFormatterSpec(core_frontend_1.IModelApp.quantityFormatter.findFormatterSpecByQuantityType(quantityType)));
115
+ setParserSpec(core_frontend_1.IModelApp.quantityFormatter.findParserSpecByQuantityType(quantityType));
116
+ }
117
+ });
118
+ core_frontend_1.IModelApp.quantityFormatter.onQuantityFormatsChanged.addListener(handleUnitSystemChanged);
119
+ return () => {
120
+ core_frontend_1.IModelApp.quantityFormatter.onQuantityFormatsChanged.removeListener(handleUnitSystemChanged);
121
+ };
122
+ }, [quantityType]);
123
+ const unitLabel = getUnitLabel(parserSpec);
124
+ // See if new initialValue props have changed since component mounted
125
+ React.useEffect(() => {
126
+ rawValueRef.current = persistenceValue;
127
+ const currentFormattedValue = formatValue(rawValueRef.current);
128
+ setFormattedValue(currentFormattedValue);
129
+ }, [formatValue, persistenceValue]);
130
+ // this is the unprocessed input from user, it is not processed until blur or enter key press
131
+ const handleDisplayValueChange = React.useCallback((event) => {
132
+ setFormattedValue(event.currentTarget.value);
133
+ }, []);
134
+ const updateValue = React.useCallback((newValue) => {
135
+ let persistedValue = newValue;
136
+ // istanbul ignore else
137
+ if (parserSpec) {
138
+ // convert value from display unit to persistence unit
139
+ const [unit] = parserSpec.format.units ? parserSpec.format.units[0] : /* istanbul ignore next */ [parserSpec.outUnit];
140
+ persistedValue = convertValueFromDisplayToPersistence(newValue, parserSpec.unitConversions, unit);
141
+ rawValueRef.current = persistedValue;
142
+ }
143
+ const newFormattedVal = formatValue(persistedValue);
144
+ onChange && onChange(persistedValue);
145
+ setFormattedValue(newFormattedVal);
146
+ }, [formatValue, onChange, parserSpec]);
147
+ /**
148
+ * Used internally to parse the argument x to it's numeric representation.
149
+ * If the argument cannot be converted to finite number returns 0; If a
150
+ * "precision" prop is specified uses it round the number with that
151
+ * precision (no fixed precision here because the return value is float, not
152
+ * string).
153
+ */
154
+ const parseInternal = React.useCallback((x) => {
155
+ if (!x)
156
+ return 0;
157
+ let n = parseFloat(x);
158
+ // istanbul ignore next
159
+ if (isNaN(n) || !isFinite(n)) {
160
+ n = 0;
161
+ }
162
+ const localPrecision = 6; // TODO get a reasonable value from format
163
+ const q = Math.pow(10, localPrecision);
164
+ const localMin = undefined === min ? Number.MIN_SAFE_INTEGER : min;
165
+ const localMax = undefined === max ? Number.MAX_SAFE_INTEGER : max;
166
+ n = Math.min(Math.max(n, localMin), localMax);
167
+ n = Math.round(n * q) / q;
168
+ return n;
169
+ }, [min, max]);
170
+ const updateValueFromString = React.useCallback((strValue) => {
171
+ // istanbul ignore else
172
+ if (parserSpec) {
173
+ const parseResult = core_frontend_1.IModelApp.quantityFormatter.parseToQuantityValue(strValue, parserSpec);
174
+ // at this point we should have a string value in persistence units without a label
175
+ if (core_quantity_1.Parser.isParsedQuantity(parseResult)) {
176
+ const persistedValue = parseResult.value; // in persistence units
177
+ // set strValue and let it go through parseInternal which will ensure min/max limits are observed
178
+ strValue = formatValue(persistedValue);
179
+ }
180
+ else {
181
+ // istanbul ignore else
182
+ if (rawValueRef.current) { // restore last known good value
183
+ const lastKnownFormattedVal = formatValue(rawValueRef.current);
184
+ setFormattedValue(lastKnownFormattedVal);
185
+ return;
186
+ }
187
+ }
188
+ }
189
+ const newValue = parseInternal(strValue);
190
+ // istanbul ignore else
191
+ if (undefined !== newValue)
192
+ updateValue(newValue);
193
+ }, [formatValue, parseInternal, parserSpec, updateValue]);
194
+ const handleBlur = React.useCallback((event) => {
195
+ const newVal = parseInternal(event.target.value);
196
+ onBlur && onBlur(event);
197
+ updateValue(newVal);
198
+ }, [parseInternal, updateValue, onBlur]);
199
+ const getIncrementValue = React.useCallback((increment) => {
200
+ if (typeof step === "function") {
201
+ const stepVal = step(increment ? "up" : "down");
202
+ return stepVal ? stepVal : 1;
203
+ }
204
+ return !step ? 1 : step;
205
+ }, [step]);
206
+ /**
207
+ * The internal method that actually sets the new value on the input
208
+ */
209
+ const applyStep = React.useCallback((increment) => {
210
+ const incrementValue = getIncrementValue(increment);
211
+ let num = parseInternal(formattedValue) + (increment ? incrementValue : -incrementValue);
212
+ if (snap) {
213
+ num = Math.round(num / incrementValue) * incrementValue;
214
+ }
215
+ const localMin = undefined === min ? Number.MIN_SAFE_INTEGER : min;
216
+ const localMax = undefined === max ? Number.MAX_SAFE_INTEGER : max;
217
+ num = Math.min(Math.max(num, localMin), localMax);
218
+ updateValue(num);
219
+ }, [formattedValue, getIncrementValue, max, min, parseInternal, snap, updateValue]);
220
+ const handleKeyDown = React.useCallback((event) => {
221
+ // istanbul ignore else
222
+ if (event.key === appui_abstract_1.SpecialKey.Enter) {
223
+ updateValueFromString(event.currentTarget.value);
224
+ event.preventDefault();
225
+ }
226
+ else if (event.key === appui_abstract_1.SpecialKey.Escape) {
227
+ setFormattedValue(formatValue(rawValueRef.current));
228
+ event.preventDefault();
229
+ }
230
+ else if (event.key === appui_abstract_1.SpecialKey.ArrowDown) {
231
+ applyStep(false);
232
+ event.preventDefault();
233
+ }
234
+ else if (event.key === appui_abstract_1.SpecialKey.ArrowUp) {
235
+ applyStep(true);
236
+ event.preventDefault();
237
+ }
238
+ onKeyDown && onKeyDown(event);
239
+ }, [onKeyDown, updateValueFromString, formatValue, applyStep]);
240
+ const handleDownClick = React.useCallback((event) => {
241
+ applyStep(false);
242
+ event.preventDefault();
243
+ }, [applyStep]);
244
+ const handleUpClick = React.useCallback((event) => {
245
+ applyStep(true);
246
+ event.preventDefault();
247
+ }, [applyStep]);
248
+ // istanbul ignore next
249
+ const handleFocus = React.useCallback((event) => {
250
+ event.currentTarget.select();
251
+ }, []);
252
+ const isDisabled = !!otherProps.disabled;
253
+ const containerClasses = (0, classnames_1.default)("component-quantity-number-input-container", containerClassName, showTouchButtons && "component-number-buttons-for-touch", isDisabled && "component-quantity-number-input-disabled");
254
+ const caretUp = showTouchButtons ? React.createElement(itwinui_icons_react_1.SvgCaretUp, null) : React.createElement(itwinui_icons_react_1.SvgCaretUpSmall, null);
255
+ const caretDown = showTouchButtons ? React.createElement(itwinui_icons_react_1.SvgCaretDown, null) : React.createElement(itwinui_icons_react_1.SvgCaretDownSmall, null);
256
+ return (React.createElement("div", { className: containerClasses },
257
+ React.createElement("div", { className: "component-quantity-number-input-value-and-buttons-container" },
258
+ React.createElement(itwinui_react_1.Input, { ref: ref, value: formattedValue, onChange: handleDisplayValueChange, onKeyDown: handleKeyDown, onBlur: handleBlur, onFocus: handleFocus, size: "small", ...otherProps }),
259
+ React.createElement("div", { className: (0, classnames_1.default)("component-quantity-number-input-buttons-container", showTouchButtons && "component-number-buttons-for-touch") },
260
+ React.createElement("div", { className: "component-quantity-number-input-button component-quantity-number-input-button-up", tabIndex: -1, onClick: handleUpClick },
261
+ React.createElement(core_react_1.Icon, { iconSpec: caretUp })),
262
+ React.createElement("div", { className: "component-quantity-number-input-button component-quantity-number-input-button-down", tabIndex: -1, onClick: handleDownClick },
263
+ React.createElement(core_react_1.Icon, { iconSpec: caretDown })))),
264
+ React.createElement("span", { className: "component-quantity-number-input-suffix" }, unitLabel)));
265
+ });
266
+ /** The QuantityNumberInput component accepts input for quantity values. The quantity value is shown as a single numeric value and the quantity's
267
+ * "display" unit is shown next to the input control. The "display" unit is determined by the active unit system as defined by the [QuantityFormatter]($frontend).
268
+ * The control also display buttons to increment and decrement the "displayed" value. The value reported by via the onChange function is in "persistence"
269
+ * units that can be stored in the iModel.
270
+ * @beta
271
+ */
272
+ exports.QuantityNumberInput = ForwardRefQuantityNumberInput;
269
273
  //# sourceMappingURL=QuantityNumberInput.js.map