@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,18 +1,18 @@
1
- /** @packageDocumentation
2
- * @module QuantityFormat
3
- */
4
- /// <reference types="react" />
5
- import { CommonProps } from "@itwin/core-react";
6
- import { FormatProps } from "@itwin/core-quantity";
7
- /** Properties of [[FormatPrecision]] component.
8
- * @alpha
9
- */
10
- export interface FormatPrecisionProps extends CommonProps {
11
- formatProps: FormatProps;
12
- onChange?: (format: FormatProps) => void;
13
- }
14
- /** Component to show/edit Quantity Format Precision.
15
- * @alpha
16
- */
17
- export declare function FormatPrecision(props: FormatPrecisionProps): JSX.Element;
1
+ /** @packageDocumentation
2
+ * @module QuantityFormat
3
+ */
4
+ /// <reference types="react" />
5
+ import { CommonProps } from "@itwin/core-react";
6
+ import { FormatProps } from "@itwin/core-quantity";
7
+ /** Properties of [[FormatPrecision]] component.
8
+ * @alpha
9
+ */
10
+ export interface FormatPrecisionProps extends CommonProps {
11
+ formatProps: FormatProps;
12
+ onChange?: (format: FormatProps) => void;
13
+ }
14
+ /** Component to show/edit Quantity Format Precision.
15
+ * @alpha
16
+ */
17
+ export declare function FormatPrecision(props: FormatPrecisionProps): JSX.Element;
18
18
  //# sourceMappingURL=FormatPrecision.d.ts.map
@@ -1,31 +1,30 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- /** @packageDocumentation
6
- * @module QuantityFormat
7
- */
8
- import * as React from "react";
9
- import { FormatType, parseFormatType } from "@itwin/core-quantity";
10
- import { DecimalPrecisionSelector } from "./misc/DecimalPrecision";
11
- import { FractionPrecisionSelector } from "./misc/FractionPrecision";
12
- import { UiIModelComponents } from "../UiIModelComponents";
13
- /** Component to show/edit Quantity Format Precision.
14
- * @alpha
15
- */
16
- export function FormatPrecision(props) {
17
- var _a, _b;
18
- const { formatProps, onChange } = props;
19
- const handlePrecisionChange = React.useCallback((precision) => {
20
- const newFormatProps = { ...formatProps, precision };
21
- onChange && onChange(newFormatProps);
22
- }, [formatProps, onChange]);
23
- const formatType = parseFormatType(formatProps.type, "format");
24
- const label = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.precision"));
25
- return (React.createElement(React.Fragment, null,
26
- React.createElement("span", { className: "uicore-label" }, label.current),
27
- formatType === FormatType.Fractional ?
28
- React.createElement(FractionPrecisionSelector, { "data-testid": "fraction-precision-selector", precision: (_a = formatProps.precision) !== null && _a !== void 0 ? _a : 0, onChange: handlePrecisionChange }) :
29
- React.createElement(DecimalPrecisionSelector, { "data-testid": "decimal-precision-selector", precision: (_b = formatProps.precision) !== null && _b !== void 0 ? _b : 0, onChange: handlePrecisionChange })));
30
- }
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /** @packageDocumentation
6
+ * @module QuantityFormat
7
+ */
8
+ import * as React from "react";
9
+ import { FormatType, parseFormatType } from "@itwin/core-quantity";
10
+ import { DecimalPrecisionSelector } from "./misc/DecimalPrecision";
11
+ import { FractionPrecisionSelector } from "./misc/FractionPrecision";
12
+ import { UiIModelComponents } from "../UiIModelComponents";
13
+ /** Component to show/edit Quantity Format Precision.
14
+ * @alpha
15
+ */
16
+ export function FormatPrecision(props) {
17
+ const { formatProps, onChange } = props;
18
+ const handlePrecisionChange = React.useCallback((precision) => {
19
+ const newFormatProps = { ...formatProps, precision };
20
+ onChange && onChange(newFormatProps);
21
+ }, [formatProps, onChange]);
22
+ const formatType = parseFormatType(formatProps.type, "format");
23
+ const label = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.precision"));
24
+ return (React.createElement(React.Fragment, null,
25
+ React.createElement("span", { className: "uicore-label" }, label.current),
26
+ formatType === FormatType.Fractional ?
27
+ React.createElement(FractionPrecisionSelector, { "data-testid": "fraction-precision-selector", precision: formatProps.precision ?? 0, onChange: handlePrecisionChange }) :
28
+ React.createElement(DecimalPrecisionSelector, { "data-testid": "decimal-precision-selector", precision: formatProps.precision ?? 0, onChange: handlePrecisionChange })));
29
+ }
31
30
  //# sourceMappingURL=FormatPrecision.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormatPrecision.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/FormatPrecision.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAe,UAAU,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAU3D;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,KAA2B;;IACzD,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAExC,MAAM,qBAAqB,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,SAAiB,EAAE,EAAE;QACpE,MAAM,cAAc,GAAG,EAAE,GAAG,WAAW,EAAE,SAAS,EAAE,CAAC;QACrD,QAAQ,IAAI,QAAQ,CAAC,cAAc,CAAC,CAAC;IACvC,CAAC,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE5B,MAAM,UAAU,GAAG,eAAe,CAAC,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAE/D,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC,SAAS,CAAC,iCAAiC,CAAC,CAAC,CAAC;IAC5F,OAAO,CACL;QACE,8BAAM,SAAS,EAAE,cAAc,IAAG,KAAK,CAAC,OAAO,CAAQ;QACtD,UAAU,KAAK,UAAU,CAAC,UAAU,CAAC,CAAC;YACrC,oBAAC,yBAAyB,mBAAa,6BAA6B,EAAC,SAAS,EAAE,MAAA,WAAW,CAAC,SAAS,mCAAI,CAAC,EAAE,QAAQ,EAAE,qBAAqB,GAAI,CAAC,CAAC;YACjJ,oBAAC,wBAAwB,mBAAa,4BAA4B,EAAC,SAAS,EAAE,MAAA,WAAW,CAAC,SAAS,mCAAI,CAAC,EAAE,QAAQ,EAAE,qBAAqB,GAAI,CAE9I,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module QuantityFormat\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { FormatProps, FormatType, parseFormatType } from \"@itwin/core-quantity\";\r\nimport { DecimalPrecisionSelector } from \"./misc/DecimalPrecision\";\r\nimport { FractionPrecisionSelector } from \"./misc/FractionPrecision\";\r\nimport { UiIModelComponents } from \"../UiIModelComponents\";\r\n\r\n/** Properties of [[FormatPrecision]] component.\r\n * @alpha\r\n */\r\nexport interface FormatPrecisionProps extends CommonProps {\r\n formatProps: FormatProps;\r\n onChange?: (format: FormatProps) => void;\r\n}\r\n\r\n/** Component to show/edit Quantity Format Precision.\r\n * @alpha\r\n */\r\nexport function FormatPrecision(props: FormatPrecisionProps) {\r\n const { formatProps, onChange } = props;\r\n\r\n const handlePrecisionChange = React.useCallback((precision: number) => {\r\n const newFormatProps = { ...formatProps, precision };\r\n onChange && onChange(newFormatProps);\r\n }, [formatProps, onChange]);\r\n\r\n const formatType = parseFormatType(formatProps.type, \"format\");\r\n\r\n const label = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.precision\"));\r\n return (\r\n <>\r\n <span className={\"uicore-label\"}>{label.current}</span>\r\n {formatType === FormatType.Fractional ?\r\n <FractionPrecisionSelector data-testid=\"fraction-precision-selector\" precision={formatProps.precision ?? 0} onChange={handlePrecisionChange} /> :\r\n <DecimalPrecisionSelector data-testid=\"decimal-precision-selector\" precision={formatProps.precision ?? 0} onChange={handlePrecisionChange} />\r\n }\r\n </>\r\n );\r\n}\r\n"]}
1
+ {"version":3,"file":"FormatPrecision.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/FormatPrecision.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAe,UAAU,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAU3D;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,KAA2B;IACzD,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAExC,MAAM,qBAAqB,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,SAAiB,EAAE,EAAE;QACpE,MAAM,cAAc,GAAG,EAAE,GAAG,WAAW,EAAE,SAAS,EAAE,CAAC;QACrD,QAAQ,IAAI,QAAQ,CAAC,cAAc,CAAC,CAAC;IACvC,CAAC,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE5B,MAAM,UAAU,GAAG,eAAe,CAAC,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAE/D,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC,SAAS,CAAC,iCAAiC,CAAC,CAAC,CAAC;IAC5F,OAAO,CACL;QACE,8BAAM,SAAS,EAAE,cAAc,IAAG,KAAK,CAAC,OAAO,CAAQ;QACtD,UAAU,KAAK,UAAU,CAAC,UAAU,CAAC,CAAC;YACrC,oBAAC,yBAAyB,mBAAa,6BAA6B,EAAC,SAAS,EAAE,WAAW,CAAC,SAAS,IAAI,CAAC,EAAE,QAAQ,EAAE,qBAAqB,GAAI,CAAC,CAAC;YACjJ,oBAAC,wBAAwB,mBAAa,4BAA4B,EAAC,SAAS,EAAE,WAAW,CAAC,SAAS,IAAI,CAAC,EAAE,QAAQ,EAAE,qBAAqB,GAAI,CAE9I,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module QuantityFormat\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { FormatProps, FormatType, parseFormatType } from \"@itwin/core-quantity\";\r\nimport { DecimalPrecisionSelector } from \"./misc/DecimalPrecision\";\r\nimport { FractionPrecisionSelector } from \"./misc/FractionPrecision\";\r\nimport { UiIModelComponents } from \"../UiIModelComponents\";\r\n\r\n/** Properties of [[FormatPrecision]] component.\r\n * @alpha\r\n */\r\nexport interface FormatPrecisionProps extends CommonProps {\r\n formatProps: FormatProps;\r\n onChange?: (format: FormatProps) => void;\r\n}\r\n\r\n/** Component to show/edit Quantity Format Precision.\r\n * @alpha\r\n */\r\nexport function FormatPrecision(props: FormatPrecisionProps) {\r\n const { formatProps, onChange } = props;\r\n\r\n const handlePrecisionChange = React.useCallback((precision: number) => {\r\n const newFormatProps = { ...formatProps, precision };\r\n onChange && onChange(newFormatProps);\r\n }, [formatProps, onChange]);\r\n\r\n const formatType = parseFormatType(formatProps.type, \"format\");\r\n\r\n const label = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.precision\"));\r\n return (\r\n <>\r\n <span className={\"uicore-label\"}>{label.current}</span>\r\n {formatType === FormatType.Fractional ?\r\n <FractionPrecisionSelector data-testid=\"fraction-precision-selector\" precision={formatProps.precision ?? 0} onChange={handlePrecisionChange} /> :\r\n <DecimalPrecisionSelector data-testid=\"decimal-precision-selector\" precision={formatProps.precision ?? 0} onChange={handlePrecisionChange} />\r\n }\r\n </>\r\n );\r\n}\r\n"]}
@@ -1,19 +1,19 @@
1
- /** @packageDocumentation
2
- * @module QuantityFormat
3
- */
4
- /// <reference types="react" />
5
- import { FormatterSpec } from "@itwin/core-quantity";
6
- import { CommonProps } from "@itwin/core-react";
7
- /** Properties of [[FormatSample]] component.
8
- * @alpha
9
- */
10
- export interface FormatSampleProps extends CommonProps {
11
- formatSpec?: FormatterSpec;
12
- initialMagnitude?: number;
13
- hideLabels?: boolean;
14
- }
15
- /** Component to show the persistence value and formatted value given a FormatterSpec.
16
- * @alpha
17
- */
18
- export declare function FormatSample(props: FormatSampleProps): JSX.Element;
1
+ /** @packageDocumentation
2
+ * @module QuantityFormat
3
+ */
4
+ /// <reference types="react" />
5
+ import { FormatterSpec } from "@itwin/core-quantity";
6
+ import { CommonProps } from "@itwin/core-react";
7
+ /** Properties of [[FormatSample]] component.
8
+ * @alpha
9
+ */
10
+ export interface FormatSampleProps extends CommonProps {
11
+ formatSpec?: FormatterSpec;
12
+ initialMagnitude?: number;
13
+ hideLabels?: boolean;
14
+ }
15
+ /** Component to show the persistence value and formatted value given a FormatterSpec.
16
+ * @alpha
17
+ */
18
+ export declare function FormatSample(props: FormatSampleProps): JSX.Element;
19
19
  //# sourceMappingURL=FormatSample.d.ts.map
@@ -1,62 +1,62 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- /** @packageDocumentation
6
- * @module QuantityFormat
7
- */
8
- import * as React from "react";
9
- import { SpecialKey } from "@itwin/appui-abstract";
10
- import { Icon } from "@itwin/core-react";
11
- import { Input } from "@itwin/itwinui-react";
12
- import { UiIModelComponents } from "../UiIModelComponents";
13
- import { SvgProgressForward } from "@itwin/itwinui-icons-react";
14
- /** Component to show the persistence value and formatted value given a FormatterSpec.
15
- * @alpha
16
- */
17
- export function FormatSample(props) {
18
- const { initialMagnitude, formatSpec, hideLabels } = props;
19
- const initialValue = initialMagnitude !== null && initialMagnitude !== void 0 ? initialMagnitude : 0;
20
- const [magnitude, setMagnitude] = React.useState(initialValue);
21
- const [sampleValue, setSampleValue] = React.useState(initialValue.toString());
22
- React.useEffect(() => {
23
- const value = initialMagnitude !== null && initialMagnitude !== void 0 ? initialMagnitude : 0;
24
- setMagnitude(value);
25
- setSampleValue(value.toString());
26
- }, [initialMagnitude]);
27
- const handleOnValueBlur = React.useCallback(() => {
28
- let newValue = Number.parseFloat(sampleValue);
29
- if (Number.isNaN(newValue))
30
- newValue = 0;
31
- setMagnitude(newValue);
32
- setSampleValue(newValue.toString());
33
- }, [sampleValue]);
34
- const handleOnValueChange = React.useCallback((event) => {
35
- setSampleValue(event.target.value);
36
- }, []);
37
- const handleKeyDown = React.useCallback((e) => {
38
- // istanbul ignore else
39
- if (e.key === SpecialKey.Enter) {
40
- let newValue = Number.parseFloat(sampleValue);
41
- if (Number.isNaN(newValue))
42
- newValue = 0;
43
- setMagnitude(newValue);
44
- setSampleValue(newValue.toString());
45
- e.preventDefault();
46
- }
47
- }, [sampleValue]);
48
- const activePersistenceUnitLabel = formatSpec ? formatSpec.persistenceUnit.label : "";
49
- const formattedValue = formatSpec ? formatSpec.applyFormatting(magnitude) : "";
50
- const valueLabel = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.value"));
51
- const formattedLabel = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.formatted"));
52
- return (React.createElement(React.Fragment, null,
53
- !hideLabels && React.createElement("span", { className: "uicore-label" }, valueLabel.current),
54
- React.createElement("span", { className: "components-inline" },
55
- React.createElement(Input, { "data-testid": "format-sample-input", className: "components-quantity-persistence-input", value: sampleValue, onChange: handleOnValueChange, onKeyDown: handleKeyDown, onBlur: handleOnValueBlur, size: "small" }),
56
- activePersistenceUnitLabel),
57
- !hideLabels && React.createElement("span", { className: "uicore-label" }, formattedLabel.current),
58
- React.createElement("span", { "data-testid": "progress-forward" },
59
- hideLabels && (formattedValue.length > 0) && React.createElement(Icon, { iconSpec: React.createElement(SvgProgressForward, null) }),
60
- React.createElement("span", { "data-testid": "format-sample-formatted", className: "uicore-label components-quantity-formatted-sample" }, formattedValue))));
61
- }
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /** @packageDocumentation
6
+ * @module QuantityFormat
7
+ */
8
+ import * as React from "react";
9
+ import { SpecialKey } from "@itwin/appui-abstract";
10
+ import { Icon } from "@itwin/core-react";
11
+ import { Input } from "@itwin/itwinui-react";
12
+ import { UiIModelComponents } from "../UiIModelComponents";
13
+ import { SvgProgressForward } from "@itwin/itwinui-icons-react";
14
+ /** Component to show the persistence value and formatted value given a FormatterSpec.
15
+ * @alpha
16
+ */
17
+ export function FormatSample(props) {
18
+ const { initialMagnitude, formatSpec, hideLabels } = props;
19
+ const initialValue = initialMagnitude ?? 0;
20
+ const [magnitude, setMagnitude] = React.useState(initialValue);
21
+ const [sampleValue, setSampleValue] = React.useState(initialValue.toString());
22
+ React.useEffect(() => {
23
+ const value = initialMagnitude ?? 0;
24
+ setMagnitude(value);
25
+ setSampleValue(value.toString());
26
+ }, [initialMagnitude]);
27
+ const handleOnValueBlur = React.useCallback(() => {
28
+ let newValue = Number.parseFloat(sampleValue);
29
+ if (Number.isNaN(newValue))
30
+ newValue = 0;
31
+ setMagnitude(newValue);
32
+ setSampleValue(newValue.toString());
33
+ }, [sampleValue]);
34
+ const handleOnValueChange = React.useCallback((event) => {
35
+ setSampleValue(event.target.value);
36
+ }, []);
37
+ const handleKeyDown = React.useCallback((e) => {
38
+ // istanbul ignore else
39
+ if (e.key === SpecialKey.Enter) {
40
+ let newValue = Number.parseFloat(sampleValue);
41
+ if (Number.isNaN(newValue))
42
+ newValue = 0;
43
+ setMagnitude(newValue);
44
+ setSampleValue(newValue.toString());
45
+ e.preventDefault();
46
+ }
47
+ }, [sampleValue]);
48
+ const activePersistenceUnitLabel = formatSpec ? formatSpec.persistenceUnit.label : "";
49
+ const formattedValue = formatSpec ? formatSpec.applyFormatting(magnitude) : "";
50
+ const valueLabel = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.value"));
51
+ const formattedLabel = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.formatted"));
52
+ return (React.createElement(React.Fragment, null,
53
+ !hideLabels && React.createElement("span", { className: "uicore-label" }, valueLabel.current),
54
+ React.createElement("span", { className: "components-inline" },
55
+ React.createElement(Input, { "data-testid": "format-sample-input", className: "components-quantity-persistence-input", value: sampleValue, onChange: handleOnValueChange, onKeyDown: handleKeyDown, onBlur: handleOnValueBlur, size: "small" }),
56
+ activePersistenceUnitLabel),
57
+ !hideLabels && React.createElement("span", { className: "uicore-label" }, formattedLabel.current),
58
+ React.createElement("span", { "data-testid": "progress-forward" },
59
+ hideLabels && (formattedValue.length > 0) && React.createElement(Icon, { iconSpec: React.createElement(SvgProgressForward, null) }),
60
+ React.createElement("span", { "data-testid": "format-sample-formatted", className: "uicore-label components-quantity-formatted-sample" }, formattedValue))));
61
+ }
62
62
  //# sourceMappingURL=FormatSample.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormatSample.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/FormatSample.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAe,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAWhE;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,KAAwB;IACnD,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;IAC3D,MAAM,YAAY,GAAG,gBAAgB,aAAhB,gBAAgB,cAAhB,gBAAgB,GAAI,CAAC,CAAC;IAC3C,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;IAC/D,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC;IAE9E,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,KAAK,GAAG,gBAAgB,aAAhB,gBAAgB,cAAhB,gBAAgB,GAAI,CAAC,CAAC;QACpC,YAAY,CAAC,KAAK,CAAC,CAAC;QACpB,cAAc,CAAC,KAAK,C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AAC,CAAC,CAAC,UAAU,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAE/E,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC,SAAS,CAAC,6BAA6B,CAAC,CAAC,CAAC;IAC7F,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC,SAAS,CAAC,iCAAiC,CAAC,CAAC,CAAC;IAErG,OAAO,CACL;QACG,CAAC,UAAU,IAAI,8BAAM,SAAS,EAAE,cAAc,IAAG,UAAU,CAAC,OAAO,CAAQ;QAC5E,8BAAM,SAAS,EAAC,mBAAmB;YACjC,oBAAC,KAAK,mBAAa,qBAAqB,EAAC,SAAS,EAAE,uCAAuC,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,mBAAmB,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,iBAAiB,EAAE,IAAI,EAAC,OAAO,GAAG;YAAC,0BAA0B,CAC1O;QACN,CAAC,UAAU,IAAI,8BAAM,SAAS,EAAE,cAAc,IAAG,cAAc,CAAC,OAAO,CAAQ;QAChF,6CAAkB,kBAAkB;YACjC,UAAU,IAAI,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,oBAAC,IAAI,IAAC,QAAQ,EAAE,oBAAC,kBAAkB,OAAG,GAAI;YACxF,6CAAkB,yBAAyB,EAAC,SAAS,EAAE,mDAAmD,IAAG,cAAc,CAAQ,CAC9H,CACN,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module QuantityFormat\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { FormatterSpec } from \"@itwin/core-quantity\";\r\nimport { SpecialKey } from \"@itwin/appui-abstract\";\r\nimport { CommonProps, Icon } from \"@itwin/core-react\";\r\nimport { Input } from \"@itwin/itwinui-react\";\r\nimport { UiIModelComponents } from \"../UiIModelComponents\";\r\nimport { SvgProgressForward } from \"@itwin/itwinui-icons-react\";\r\n\r\n/** Properties of [[FormatSample]] component.\r\n * @alpha\r\n */\r\nexport interface FormatSampleProps extends CommonProps {\r\n formatSpec?: FormatterSpec;\r\n initialMagnitude?: number;\r\n hideLabels?: boolean;\r\n}\r\n\r\n/** Component to show the persistence value and formatted value given a FormatterSpec.\r\n * @alpha\r\n */\r\nexport function FormatSample(props: FormatSampleProps) {\r\n const { initialMagnitude, formatSpec, hideLabels } = props;\r\n const initialValue = initialMagnitude ?? 0;\r\n const [magnitude, setMagnitude] = React.useState(initialValue);\r\n const [sampleValue, setSampleValue] = React.useState(initialValue.toString());\r\n\r\n React.useEffect(() => {\r\n const value = initialMagnitude ?? 0;\r\n setMagnitude(value);\r\n setSampleValue(value.toString());\r\n }, [initialMagnitude]);\r\n\r\n const handleOnValueBlur = React.useCallback(() => {\r\n let newValue = Number.parseFloat(sampleValue);\r\n if (Number.isNaN(newValue))\r\n newValue = 0;\r\n setMagnitude(newValue);\r\n setSampleValue(newValue.toString());\r\n }, [sampleValue]);\r\n\r\n const handleOnValueChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\r\n setSampleValue(event.target.value);\r\n }, []);\r\n\r\n const handleKeyDown = React.useCallback((e: React.KeyboardEvent<HTMLInputElement>) => {\r\n // istanbul ignore else\r\n if (e.key === SpecialKey.Enter) {\r\n let newValue = Number.parseFloat(sampleValue);\r\n if (Number.isNaN(newValue))\r\n newValue = 0;\r\n setMagnitude(newValue);\r\n setSampleValue(newValue.toString());\r\n e.preventDefault();\r\n }\r\n }, [sampleValue]);\r\n\r\n const activePersistenceUnitLabel = formatSpec ? formatSpec.persistenceUnit.label : \"\";\r\n const formattedValue = formatSpec ? formatSpec.applyFormatting(magnitude) : \"\";\r\n\r\n const valueLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.value\"));\r\n const formattedLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.formatted\"));\r\n\r\n return (\r\n <>\r\n {!hideLabels && <span className={\"uicore-label\"}>{valueLabel.current}</span>}\r\n <span className=\"components-inline\">\r\n <Input data-testid=\"format-sample-input\" className={\"components-quantity-persistence-input\"} value={sampleValue} onChange={handleOnValueChange} onKeyDown={handleKeyDown} onBlur={handleOnValueBlur} size=\"small\" />{activePersistenceUnitLabel}\r\n </span>\r\n {!hideLabels && <span className={\"uicore-label\"}>{formattedLabel.current}</span>}\r\n <span data-testid=\"progress-forward\">\r\n {hideLabels && (formattedValue.length > 0) && <Icon iconSpec={<SvgProgressForward />} />}\r\n <span data-testid=\"format-sample-formatted\" className={\"uicore-label components-quantity-formatted-sample\"}>{formattedValue}</span>\r\n </span>\r\n </>\r\n );\r\n}\r\n"]}
1
+ {"version":3,"file":"FormatSample.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/FormatSample.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAe,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAWhE;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,KAAwB;IACnD,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;IAC3D,MAAM,YAAY,GAAG,gBAAgB,IAAI,CAAC,CAAC;IAC3C,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC,QA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H,CACN,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module QuantityFormat\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { FormatterSpec } from \"@itwin/core-quantity\";\r\nimport { SpecialKey } from \"@itwin/appui-abstract\";\r\nimport { CommonProps, Icon } from \"@itwin/core-react\";\r\nimport { Input } from \"@itwin/itwinui-react\";\r\nimport { UiIModelComponents } from \"../UiIModelComponents\";\r\nimport { SvgProgressForward } from \"@itwin/itwinui-icons-react\";\r\n\r\n/** Properties of [[FormatSample]] component.\r\n * @alpha\r\n */\r\nexport interface FormatSampleProps extends CommonProps {\r\n formatSpec?: FormatterSpec;\r\n initialMagnitude?: number;\r\n hideLabels?: boolean;\r\n}\r\n\r\n/** Component to show the persistence value and formatted value given a FormatterSpec.\r\n * @alpha\r\n */\r\nexport function FormatSample(props: FormatSampleProps) {\r\n const { initialMagnitude, formatSpec, hideLabels } = props;\r\n const initialValue = initialMagnitude ?? 0;\r\n const [magnitude, setMagnitude] = React.useState(initialValue);\r\n const [sampleValue, setSampleValue] = React.useState(initialValue.toString());\r\n\r\n React.useEffect(() => {\r\n const value = initialMagnitude ?? 0;\r\n setMagnitude(value);\r\n setSampleValue(value.toString());\r\n }, [initialMagnitude]);\r\n\r\n const handleOnValueBlur = React.useCallback(() => {\r\n let newValue = Number.parseFloat(sampleValue);\r\n if (Number.isNaN(newValue))\r\n newValue = 0;\r\n setMagnitude(newValue);\r\n setSampleValue(newValue.toString());\r\n }, [sampleValue]);\r\n\r\n const handleOnValueChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\r\n setSampleValue(event.target.value);\r\n }, []);\r\n\r\n const handleKeyDown = React.useCallback((e: React.KeyboardEvent<HTMLInputElement>) => {\r\n // istanbul ignore else\r\n if (e.key === SpecialKey.Enter) {\r\n let newValue = Number.parseFloat(sampleValue);\r\n if (Number.isNaN(newValue))\r\n newValue = 0;\r\n setMagnitude(newValue);\r\n setSampleValue(newValue.toString());\r\n e.preventDefault();\r\n }\r\n }, [sampleValue]);\r\n\r\n const activePersistenceUnitLabel = formatSpec ? formatSpec.persistenceUnit.label : \"\";\r\n const formattedValue = formatSpec ? formatSpec.applyFormatting(magnitude) : \"\";\r\n\r\n const valueLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.value\"));\r\n const formattedLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.formatted\"));\r\n\r\n return (\r\n <>\r\n {!hideLabels && <span className={\"uicore-label\"}>{valueLabel.current}</span>}\r\n <span className=\"components-inline\">\r\n <Input data-testid=\"format-sample-input\" className={\"components-quantity-persistence-input\"} value={sampleValue} onChange={handleOnValueChange} onKeyDown={handleKeyDown} onBlur={handleOnValueBlur} size=\"small\" />{activePersistenceUnitLabel}\r\n </span>\r\n {!hideLabels && <span className={\"uicore-label\"}>{formattedLabel.current}</span>}\r\n <span data-testid=\"progress-forward\">\r\n {hideLabels && (formattedValue.length > 0) && <Icon iconSpec={<SvgProgressForward />} />}\r\n <span data-testid=\"format-sample-formatted\" className={\"uicore-label components-quantity-formatted-sample\"}>{formattedValue}</span>\r\n </span>\r\n </>\r\n );\r\n}\r\n"]}
@@ -1,18 +1,18 @@
1
- /** @packageDocumentation
2
- * @module QuantityFormat
3
- */
4
- /// <reference types="react" />
5
- import { CommonProps } from "@itwin/core-react";
6
- import { FormatProps } from "@itwin/core-quantity";
7
- /** Properties of [[FormatTypeOptionProps]] component.
8
- * @alpha
9
- */
10
- export interface FormatTypeOptionProps extends CommonProps {
11
- formatProps: FormatProps;
12
- onChange?: (format: FormatProps) => void;
13
- }
14
- /** Component to set the Quantity Format type.
15
- * @alpha
16
- */
17
- export declare function FormatTypeOption(props: FormatTypeOptionProps): JSX.Element;
1
+ /** @packageDocumentation
2
+ * @module QuantityFormat
3
+ */
4
+ /// <reference types="react" />
5
+ import { CommonProps } from "@itwin/core-react";
6
+ import { FormatProps } from "@itwin/core-quantity";
7
+ /** Properties of [[FormatTypeOptionProps]] component.
8
+ * @alpha
9
+ */
10
+ export interface FormatTypeOptionProps extends CommonProps {
11
+ formatProps: FormatProps;
12
+ onChange?: (format: FormatProps) => void;
13
+ }
14
+ /** Component to set the Quantity Format type.
15
+ * @alpha
16
+ */
17
+ export declare function FormatTypeOption(props: FormatTypeOptionProps): JSX.Element;
18
18
  //# sourceMappingURL=FormatType.d.ts.map
@@ -1,64 +1,63 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- /** @packageDocumentation
6
- * @module QuantityFormat
7
- */
8
- import * as React from "react";
9
- import { UiIModelComponents } from "../UiIModelComponents";
10
- import { DecimalPrecision, FormatType, formatTypeToString, FractionalPrecision, parseFormatType, ScientificType, scientificTypeToString, } from "@itwin/core-quantity";
11
- import { Select } from "@itwin/itwinui-react";
12
- /** Component to select the format type.
13
- * @alpha
14
- */
15
- function FormatTypeSelector(props) {
16
- const { type, onChange, ...otherProps } = props;
17
- const formatOptions = React.useRef([
18
- { value: FormatType.Decimal, label: UiIModelComponents.translate("QuantityFormat.decimal") },
19
- { value: FormatType.Scientific, label: UiIModelComponents.translate("QuantityFormat.scientific") },
20
- { value: FormatType.Station, label: UiIModelComponents.translate("QuantityFormat.station") },
21
- { value: FormatType.Fractional, label: UiIModelComponents.translate("QuantityFormat.fractional") },
22
- ]);
23
- const handleOnChange = React.useCallback((newValue) => {
24
- onChange && onChange(newValue);
25
- }, [onChange]);
26
- return (React.createElement(Select, { options: formatOptions.current, value: type, onChange: handleOnChange, size: "small", ...otherProps }));
27
- }
28
- /** Component to set the Quantity Format type.
29
- * @alpha
30
- */
31
- export function FormatTypeOption(props) {
32
- const { formatProps, onChange } = props;
33
- const handleFormatTypeChange = React.useCallback((newType) => {
34
- var _a;
35
- const type = formatTypeToString(newType);
36
- let precision;
37
- let stationOffsetSize;
38
- let scientificType;
39
- switch (newType) { // type must be decimal, fractional, scientific, or station
40
- case FormatType.Scientific:
41
- precision = DecimalPrecision.Six;
42
- scientificType = scientificTypeToString(ScientificType.Normalized);
43
- break;
44
- case FormatType.Decimal:
45
- precision = DecimalPrecision.Four;
46
- break;
47
- case FormatType.Station:
48
- precision = DecimalPrecision.Two;
49
- stationOffsetSize = ((_a = formatProps.composite) === null || _a === void 0 ? void 0 : _a.units[0].name.toLocaleLowerCase().endsWith("m")) ? 3 : 2;
50
- break;
51
- case FormatType.Fractional:
52
- precision = FractionalPrecision.Eight;
53
- break;
54
- }
55
- const newFormatProps = { ...formatProps, type, precision, scientificType, stationOffsetSize };
56
- onChange && onChange(newFormatProps);
57
- }, [formatProps, onChange]);
58
- const formatType = parseFormatType(formatProps.type, "format");
59
- const label = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.type"));
60
- return (React.createElement(React.Fragment, null,
61
- React.createElement("span", { className: "uicore-label.current" }, label.current),
62
- React.createElement(FormatTypeSelector, { "data-testid": "format-type-selector", type: formatType, onChange: handleFormatTypeChange })));
63
- }
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /** @packageDocumentation
6
+ * @module QuantityFormat
7
+ */
8
+ import * as React from "react";
9
+ import { UiIModelComponents } from "../UiIModelComponents";
10
+ import { DecimalPrecision, FormatType, formatTypeToString, FractionalPrecision, parseFormatType, ScientificType, scientificTypeToString, } from "@itwin/core-quantity";
11
+ import { Select } from "@itwin/itwinui-react";
12
+ /** Component to select the format type.
13
+ * @alpha
14
+ */
15
+ function FormatTypeSelector(props) {
16
+ const { type, onChange, ...otherProps } = props;
17
+ const formatOptions = React.useRef([
18
+ { value: FormatType.Decimal, label: UiIModelComponents.translate("QuantityFormat.decimal") },
19
+ { value: FormatType.Scientific, label: UiIModelComponents.translate("QuantityFormat.scientific") },
20
+ { value: FormatType.Station, label: UiIModelComponents.translate("QuantityFormat.station") },
21
+ { value: FormatType.Fractional, label: UiIModelComponents.translate("QuantityFormat.fractional") },
22
+ ]);
23
+ const handleOnChange = React.useCallback((newValue) => {
24
+ onChange && onChange(newValue);
25
+ }, [onChange]);
26
+ return (React.createElement(Select, { options: formatOptions.current, value: type, onChange: handleOnChange, size: "small", ...otherProps }));
27
+ }
28
+ /** Component to set the Quantity Format type.
29
+ * @alpha
30
+ */
31
+ export function FormatTypeOption(props) {
32
+ const { formatProps, onChange } = props;
33
+ const handleFormatTypeChange = React.useCallback((newType) => {
34
+ const type = formatTypeToString(newType);
35
+ let precision;
36
+ let stationOffsetSize;
37
+ let scientificType;
38
+ switch (newType) { // type must be decimal, fractional, scientific, or station
39
+ case FormatType.Scientific:
40
+ precision = DecimalPrecision.Six;
41
+ scientificType = scientificTypeToString(ScientificType.Normalized);
42
+ break;
43
+ case FormatType.Decimal:
44
+ precision = DecimalPrecision.Four;
45
+ break;
46
+ case FormatType.Station:
47
+ precision = DecimalPrecision.Two;
48
+ stationOffsetSize = formatProps.composite?.units[0].name.toLocaleLowerCase().endsWith("m") ? 3 : 2;
49
+ break;
50
+ case FormatType.Fractional:
51
+ precision = FractionalPrecision.Eight;
52
+ break;
53
+ }
54
+ const newFormatProps = { ...formatProps, type, precision, scientificType, stationOffsetSize };
55
+ onChange && onChange(newFormatProps);
56
+ }, [formatProps, onChange]);
57
+ const formatType = parseFormatType(formatProps.type, "format");
58
+ const label = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.type"));
59
+ return (React.createElement(React.Fragment, null,
60
+ React.createElement("span", { className: "uicore-label.current" }, label.current),
61
+ React.createElement(FormatTypeSelector, { "data-testid": "format-type-selector", type: formatType, onChange: handleFormatTypeChange })));
62
+ }
64
63
  //# sourceMappingURL=FormatType.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormatType.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/FormatType.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAe,UAAU,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,eAAe,EAC1G,cAAc,EAAE,sBAAsB,GACvC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAgB,MAAM,sBAAsB,CAAC;AAU5D;;GAEG;AACH,SAAS,kBAAkB,CAAC,KAA8B;IACxD,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IAChD,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAA6B;QAC7D,EAAE,KAAK,EAAE,UAAU,CAAC,OAAO,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,wBAAwB,CAAC,EAAE;QAC5F,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,2BAA2B,CAAC,EAAE;QAClG,EAAE,KAAK,EAAE,UAAU,CAAC,OAAO,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,wBAAwB,CAAC,EAAE;QAC5F,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,2BAA2B,CAAC,EAAE;KACnG,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,QAAoB,EAAE,EAAE;QAChE,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,QAAQ,CAAC,C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AS,EAAE,cAAc,EAAE,iBAAiB,EAAE,CAAC;QAC9F,QAAQ,IAAI,QAAQ,CAAC,cAAc,CAAC,CAAC;IACvC,CAAC,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE5B,MAAM,UAAU,GAAG,eAAe,CAAC,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC/D,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC,SAAS,CAAC,4BAA4B,CAAC,CAAC,CAAC;IAEvF,OAAO,CACL;QACE,8BAAM,SAAS,EAAE,sBAAsB,IAAG,KAAK,CAAC,OAAO,CAAQ;QAC/D,oBAAC,kBAAkB,mBAAa,sBAAsB,EAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,sBAAsB,GAAI,CAC5G,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module QuantityFormat\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { UiIModelComponents } from \"../UiIModelComponents\";\r\nimport { DecimalPrecision, FormatProps, FormatType, formatTypeToString, FractionalPrecision, parseFormatType,\r\n ScientificType, scientificTypeToString,\r\n} from \"@itwin/core-quantity\";\r\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\r\n\r\n/** Properties of [[FormatTypeSelector]] component.\r\n * @alpha\r\n */\r\ninterface FormatTypeSelectorProps extends CommonProps {\r\n type: FormatType;\r\n onChange: (value: FormatType) => void;\r\n}\r\n\r\n/** Component to select the format type.\r\n * @alpha\r\n */\r\nfunction FormatTypeSelector(props: FormatTypeSelectorProps) {\r\n const { type, onChange, ...otherProps } = props;\r\n const formatOptions = React.useRef<SelectOption<FormatType>[]>([\r\n { value: FormatType.Decimal, label: UiIModelComponents.translate(\"QuantityFormat.decimal\") },\r\n { value: FormatType.Scientific, label: UiIModelComponents.translate(\"QuantityFormat.scientific\") },\r\n { value: FormatType.Station, label: UiIModelComponents.translate(\"QuantityFormat.station\") },\r\n { value: FormatType.Fractional, label: UiIModelComponents.translate(\"QuantityFormat.fractional\") },\r\n ]);\r\n\r\n const handleOnChange = React.useCallback((newValue: FormatType) => {\r\n onChange && onChange(newValue);\r\n }, [onChange]);\r\n\r\n return (\r\n <Select options={formatOptions.current} value={type} onChange={handleOnChange} size=\"small\" {...otherProps} />\r\n );\r\n}\r\n\r\n/** Properties of [[FormatTypeOptionProps]] component.\r\n * @alpha\r\n */\r\nexport interface FormatTypeOptionProps extends CommonProps {\r\n formatProps: FormatProps;\r\n onChange?: (format: FormatProps) => void;\r\n}\r\n\r\n/** Component to set the Quantity Format type.\r\n * @alpha\r\n */\r\nexport function FormatTypeOption(props: FormatTypeOptionProps) {\r\n const { formatProps, onChange } = props;\r\n const handleFormatTypeChange = React.useCallback((newType: FormatType) => {\r\n const type = formatTypeToString(newType);\r\n let precision: number | undefined;\r\n let stationOffsetSize: number | undefined;\r\n let scientificType: string | undefined;\r\n switch (newType) { // type must be decimal, fractional, scientific, or station\r\n case FormatType.Scientific:\r\n precision = DecimalPrecision.Six;\r\n scientificType = scientificTypeToString(ScientificType.Normalized);\r\n break;\r\n case FormatType.Decimal:\r\n precision = DecimalPrecision.Four;\r\n break;\r\n case FormatType.Station:\r\n precision = DecimalPrecision.Two;\r\n stationOffsetSize = formatProps.composite?.units[0].name.toLocaleLowerCase().endsWith(\"m\") ? 3 : 2;\r\n break;\r\n case FormatType.Fractional:\r\n precision = FractionalPrecision.Eight;\r\n break;\r\n }\r\n const newFormatProps = { ...formatProps, type, precision, scientificType, stationOffsetSize };\r\n onChange && onChange(newFormatProps);\r\n }, [formatProps, onChange]);\r\n\r\n const formatType = parseFormatType(formatProps.type, \"format\");\r\n const label = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.type\"));\r\n\r\n return (\r\n <>\r\n <span className={\"uicore-label.current\"}>{label.current}</span>\r\n <FormatTypeSelector data-testid=\"format-type-selector\" type={formatType} onChange={handleFormatTypeChange} />\r\n </>\r\n );\r\n}\r\n\r\n"]}
1
+ {"version":3,"file":"FormatType.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/FormatType.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAe,UAAU,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,eAAe,EAC1G,cAAc,EAAE,sBAAsB,GACvC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAgB,MAAM,sBAAsB,CAAC;AAU5D;;GAEG;AACH,SAAS,kBAAkB,CAAC,KAA8B;IACxD,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IAChD,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAA6B;QAC7D,EAAE,KAAK,EAAE,UAAU,CAAC,OAAO,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,wBAAwB,CAAC,EAAE;QAC5F,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,2BAA2B,CAAC,EAAE;QAClG,EAAE,KAAK,EAAE,UAAU,CAAC,OAAO,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,wBAAwB,CAAC,EAAE;QAC5F,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,2BAA2B,CAAC,EAAE;KACnG,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,KA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AC,UAAU;gBACxB,SAAS,GAAG,mBAAmB,CAAC,KAAK,CAAC;gBACtC,MAAM;SACT;QACD,MAAM,cAAc,GAAG,EAAE,GAAG,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,iBAAiB,EAAE,CAAC;QAC9F,QAAQ,IAAI,QAAQ,CAAC,cAAc,CAAC,CAAC;IACvC,CAAC,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE5B,MAAM,UAAU,GAAG,eAAe,CAAC,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC/D,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC,SAAS,CAAC,4BAA4B,CAAC,CAAC,CAAC;IAEvF,OAAO,CACL;QACE,8BAAM,SAAS,EAAE,sBAAsB,IAAG,KAAK,CAAC,OAAO,CAAQ;QAC/D,oBAAC,kBAAkB,mBAAa,sBAAsB,EAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,sBAAsB,GAAI,CAC5G,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module QuantityFormat\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { UiIModelComponents } from \"../UiIModelComponents\";\r\nimport { DecimalPrecision, FormatProps, FormatType, formatTypeToString, FractionalPrecision, parseFormatType,\r\n ScientificType, scientificTypeToString,\r\n} from \"@itwin/core-quantity\";\r\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\r\n\r\n/** Properties of [[FormatTypeSelector]] component.\r\n * @alpha\r\n */\r\ninterface FormatTypeSelectorProps extends CommonProps {\r\n type: FormatType;\r\n onChange: (value: FormatType) => void;\r\n}\r\n\r\n/** Component to select the format type.\r\n * @alpha\r\n */\r\nfunction FormatTypeSelector(props: FormatTypeSelectorProps) {\r\n const { type, onChange, ...otherProps } = props;\r\n const formatOptions = React.useRef<SelectOption<FormatType>[]>([\r\n { value: FormatType.Decimal, label: UiIModelComponents.translate(\"QuantityFormat.decimal\") },\r\n { value: FormatType.Scientific, label: UiIModelComponents.translate(\"QuantityFormat.scientific\") },\r\n { value: FormatType.Station, label: UiIModelComponents.translate(\"QuantityFormat.station\") },\r\n { value: FormatType.Fractional, label: UiIModelComponents.translate(\"QuantityFormat.fractional\") },\r\n ]);\r\n\r\n const handleOnChange = React.useCallback((newValue: FormatType) => {\r\n onChange && onChange(newValue);\r\n }, [onChange]);\r\n\r\n return (\r\n <Select options={formatOptions.current} value={type} onChange={handleOnChange} size=\"small\" {...otherProps} />\r\n );\r\n}\r\n\r\n/** Properties of [[FormatTypeOptionProps]] component.\r\n * @alpha\r\n */\r\nexport interface FormatTypeOptionProps extends CommonProps {\r\n formatProps: FormatProps;\r\n onChange?: (format: FormatProps) => void;\r\n}\r\n\r\n/** Component to set the Quantity Format type.\r\n * @alpha\r\n */\r\nexport function FormatTypeOption(props: FormatTypeOptionProps) {\r\n const { formatProps, onChange } = props;\r\n const handleFormatTypeChange = React.useCallback((newType: FormatType) => {\r\n const type = formatTypeToString(newType);\r\n let precision: number | undefined;\r\n let stationOffsetSize: number | undefined;\r\n let scientificType: string | undefined;\r\n switch (newType) { // type must be decimal, fractional, scientific, or station\r\n case FormatType.Scientific:\r\n precision = DecimalPrecision.Six;\r\n scientificType = scientificTypeToString(ScientificType.Normalized);\r\n break;\r\n case FormatType.Decimal:\r\n precision = DecimalPrecision.Four;\r\n break;\r\n case FormatType.Station:\r\n precision = DecimalPrecision.Two;\r\n stationOffsetSize = formatProps.composite?.units[0].name.toLocaleLowerCase().endsWith(\"m\") ? 3 : 2;\r\n break;\r\n case FormatType.Fractional:\r\n precision = FractionalPrecision.Eight;\r\n break;\r\n }\r\n const newFormatProps = { ...formatProps, type, precision, scientificType, stationOffsetSize };\r\n onChange && onChange(newFormatProps);\r\n }, [formatProps, onChange]);\r\n\r\n const formatType = parseFormatType(formatProps.type, \"format\");\r\n const label = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.type\"));\r\n\r\n return (\r\n <>\r\n <span className={\"uicore-label.current\"}>{label.current}</span>\r\n <FormatTypeSelector data-testid=\"format-type-selector\" type={formatType} onChange={handleFormatTypeChange} />\r\n </>\r\n );\r\n}\r\n\r\n"]}
@@ -1,18 +1,18 @@
1
- /** @packageDocumentation
2
- * @module QuantityFormat
3
- */
4
- /// <reference types="react" />
5
- import { CommonProps } from "@itwin/core-react";
6
- import { FormatProps } from "@itwin/core-quantity";
7
- /** Properties of [[FormatUnitLabel]] component.
8
- * @alpha
9
- */
10
- export interface FormatUnitLabelProps extends CommonProps {
11
- formatProps: FormatProps;
12
- onUnitLabelChange?: (format: FormatProps) => void;
13
- }
14
- /** Component to set the label separator definition in a Quantity Format and if it the label is to be displayed.
15
- * @alpha
16
- */
17
- export declare function FormatUnitLabel(props: FormatUnitLabelProps): JSX.Element;
1
+ /** @packageDocumentation
2
+ * @module QuantityFormat
3
+ */
4
+ /// <reference types="react" />
5
+ import { CommonProps } from "@itwin/core-react";
6
+ import { FormatProps } from "@itwin/core-quantity";
7
+ /** Properties of [[FormatUnitLabel]] component.
8
+ * @alpha
9
+ */
10
+ export interface FormatUnitLabelProps extends CommonProps {
11
+ formatProps: FormatProps;
12
+ onUnitLabelChange?: (format: FormatProps) => void;
13
+ }
14
+ /** Component to set the label separator definition in a Quantity Format and if it the label is to be displayed.
15
+ * @alpha
16
+ */
17
+ export declare function FormatUnitLabel(props: FormatUnitLabelProps): JSX.Element;
18
18
  //# sourceMappingURL=FormatUnitLabel.d.ts.map