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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (351) hide show
  1. package/CHANGELOG.md +25 -2
  2. package/lib/cjs/imodel-components-react/UiIModelComponents.js +4 -2
  3. package/lib/cjs/imodel-components-react/UiIModelComponents.js.map +1 -1
  4. package/lib/cjs/imodel-components-react/color/AlphaSlider.d.ts +1 -1
  5. package/lib/cjs/imodel-components-react/color/AlphaSlider.d.ts.map +1 -1
  6. package/lib/cjs/imodel-components-react/color/AlphaSlider.js.map +1 -1
  7. package/lib/cjs/imodel-components-react/color/AlphaSlider.scss +63 -63
  8. package/lib/cjs/imodel-components-react/color/ColorPickerButton.d.ts +1 -1
  9. package/lib/cjs/imodel-components-react/color/ColorPickerButton.d.ts.map +1 -1
  10. package/lib/cjs/imodel-components-react/color/ColorPickerButton.js +1 -1
  11. package/lib/cjs/imodel-components-react/color/ColorPickerButton.js.map +1 -1
  12. package/lib/cjs/imodel-components-react/color/ColorPickerButton.scss +90 -90
  13. package/lib/cjs/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
  14. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.d.ts +1 -1
  15. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.d.ts.map +1 -1
  16. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
  17. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.scss +62 -62
  18. package/lib/cjs/imodel-components-react/color/HueSlider.d.ts +2 -2
  19. package/lib/cjs/imodel-components-react/color/HueSlider.d.ts.map +1 -1
  20. package/lib/cjs/imodel-components-react/color/HueSlider.js.map +1 -1
  21. package/lib/cjs/imodel-components-react/color/HueSlider.scss +61 -61
  22. package/lib/cjs/imodel-components-react/color/SaturationPicker.d.ts +1 -1
  23. package/lib/cjs/imodel-components-react/color/SaturationPicker.d.ts.map +1 -1
  24. package/lib/cjs/imodel-components-react/color/SaturationPicker.js.map +1 -1
  25. package/lib/cjs/imodel-components-react/color/SaturationPicker.scss +35 -35
  26. package/lib/cjs/imodel-components-react/color/Swatch.d.ts +2 -2
  27. package/lib/cjs/imodel-components-react/color/Swatch.d.ts.map +1 -1
  28. package/lib/cjs/imodel-components-react/color/Swatch.js.map +1 -1
  29. package/lib/cjs/imodel-components-react/color/Swatch.scss +22 -22
  30. package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.d.ts +1 -1
  31. package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.d.ts.map +1 -1
  32. package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.js.map +1 -1
  33. package/lib/cjs/imodel-components-react/editors/ColorEditor.d.ts +3 -2
  34. package/lib/cjs/imodel-components-react/editors/ColorEditor.d.ts.map +1 -1
  35. package/lib/cjs/imodel-components-react/editors/ColorEditor.js.map +1 -1
  36. package/lib/cjs/imodel-components-react/editors/ColorEditor.scss +18 -18
  37. package/lib/cjs/imodel-components-react/editors/WeightEditor.d.ts +3 -2
  38. package/lib/cjs/imodel-components-react/editors/WeightEditor.d.ts.map +1 -1
  39. package/lib/cjs/imodel-components-react/editors/WeightEditor.js.map +1 -1
  40. package/lib/cjs/imodel-components-react/editors/WeightEditor.scss +16 -16
  41. package/lib/cjs/imodel-components-react/inputs/QuantityInput.d.ts +2 -2
  42. package/lib/cjs/imodel-components-react/inputs/QuantityInput.d.ts.map +1 -1
  43. package/lib/cjs/imodel-components-react/inputs/QuantityInput.js.map +1 -1
  44. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.d.ts +2 -2
  45. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.d.ts.map +1 -1
  46. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js +1 -1
  47. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
  48. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.scss +106 -106
  49. package/lib/cjs/imodel-components-react/lineweight/Swatch.d.ts +2 -2
  50. package/lib/cjs/imodel-components-react/lineweight/Swatch.d.ts.map +1 -1
  51. package/lib/cjs/imodel-components-react/lineweight/Swatch.js.map +1 -1
  52. package/lib/cjs/imodel-components-react/lineweight/Swatch.scss +48 -48
  53. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.d.ts +2 -2
  54. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.d.ts.map +1 -1
  55. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
  56. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.scss +51 -51
  57. package/lib/cjs/imodel-components-react/navigationaids/Cube.d.ts +1 -1
  58. package/lib/cjs/imodel-components-react/navigationaids/Cube.d.ts.map +1 -1
  59. package/lib/cjs/imodel-components-react/navigationaids/Cube.js.map +1 -1
  60. package/lib/cjs/imodel-components-react/navigationaids/Cube.scss +19 -19
  61. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.d.ts +3 -2
  62. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.d.ts.map +1 -1
  63. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js +50 -23
  64. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
  65. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.scss +178 -178
  66. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts +3 -2
  67. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts.map +1 -1
  68. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
  69. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.scss +135 -135
  70. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.d.ts +3 -2
  71. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.d.ts.map +1 -1
  72. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js +1 -1
  73. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
  74. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.scss +59 -59
  75. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.d.ts +2 -2
  76. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.d.ts.map +1 -1
  77. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js +3 -2
  78. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
  79. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.d.ts +2 -2
  80. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.d.ts.map +1 -1
  81. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js +2 -2
  82. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
  83. package/lib/cjs/imodel-components-react/quantityformat/FormatType.d.ts +2 -2
  84. package/lib/cjs/imodel-components-react/quantityformat/FormatType.d.ts.map +1 -1
  85. package/lib/cjs/imodel-components-react/quantityformat/FormatType.js +2 -1
  86. package/lib/cjs/imodel-components-react/quantityformat/FormatType.js.map +1 -1
  87. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.d.ts +2 -2
  88. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.d.ts.map +1 -1
  89. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js +2 -1
  90. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
  91. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.d.ts +2 -2
  92. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.d.ts.map +1 -1
  93. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js +9 -5
  94. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
  95. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.d.ts +2 -2
  96. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.d.ts.map +1 -1
  97. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js +4 -3
  98. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
  99. package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts +3 -3
  100. package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts.map +1 -1
  101. package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.js.map +1 -1
  102. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.d.ts +1 -1
  103. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.d.ts.map +1 -1
  104. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.js.map +1 -1
  105. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.d.ts +1 -1
  106. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.d.ts.map +1 -1
  107. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.js.map +1 -1
  108. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.d.ts +1 -1
  109. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.d.ts.map +1 -1
  110. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.js.map +1 -1
  111. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.d.ts +1 -1
  112. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.d.ts.map +1 -1
  113. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.js.map +1 -1
  114. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.d.ts +1 -1
  115. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.d.ts.map +1 -1
  116. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.js.map +1 -1
  117. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.d.ts +1 -1
  118. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.d.ts.map +1 -1
  119. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js.map +1 -1
  120. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.d.ts +1 -1
  121. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.d.ts.map +1 -1
  122. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.js.map +1 -1
  123. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.d.ts +1 -1
  124. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.d.ts.map +1 -1
  125. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.js.map +1 -1
  126. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts +2 -2
  127. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts.map +1 -1
  128. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +2 -1
  129. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
  130. package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.d.ts +2 -2
  131. package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.d.ts.map +1 -1
  132. package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.js.map +1 -1
  133. package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.d.ts +2 -2
  134. package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.d.ts.map +1 -1
  135. package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.js.map +1 -1
  136. package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.d.ts +2 -2
  137. package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.d.ts.map +1 -1
  138. package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.js.map +1 -1
  139. package/lib/cjs/imodel-components-react/timeline/InlineEdit.d.ts +1 -1
  140. package/lib/cjs/imodel-components-react/timeline/InlineEdit.d.ts.map +1 -1
  141. package/lib/cjs/imodel-components-react/timeline/InlineEdit.js.map +1 -1
  142. package/lib/cjs/imodel-components-react/timeline/InlineEdit.scss +26 -26
  143. package/lib/cjs/imodel-components-react/timeline/PlayerButton.d.ts +1 -1
  144. package/lib/cjs/imodel-components-react/timeline/PlayerButton.d.ts.map +1 -1
  145. package/lib/cjs/imodel-components-react/timeline/PlayerButton.js.map +1 -1
  146. package/lib/cjs/imodel-components-react/timeline/PlayerButton.scss +28 -28
  147. package/lib/cjs/imodel-components-react/timeline/Scrubber.d.ts +2 -2
  148. package/lib/cjs/imodel-components-react/timeline/Scrubber.d.ts.map +1 -1
  149. package/lib/cjs/imodel-components-react/timeline/Scrubber.js.map +1 -1
  150. package/lib/cjs/imodel-components-react/timeline/Scrubber.scss +105 -105
  151. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.d.ts +1 -1
  152. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.d.ts.map +1 -1
  153. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
  154. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.scss +359 -359
  155. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.d.ts +1 -1
  156. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.d.ts.map +1 -1
  157. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.js.map +1 -1
  158. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.scss +39 -39
  159. package/lib/cjs/imodel-components-react/timeline/Timeline.scss +164 -164
  160. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.d.ts +2 -2
  161. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.d.ts.map +1 -1
  162. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js +0 -7
  163. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
  164. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.scss +177 -177
  165. package/lib/cjs/imodel-components-react/timeline/interfaces.d.ts +3 -3
  166. package/lib/cjs/imodel-components-react/timeline/interfaces.d.ts.map +1 -1
  167. package/lib/cjs/imodel-components-react/timeline/interfaces.js.map +1 -1
  168. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.d.ts +4 -3
  169. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.d.ts.map +1 -1
  170. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js +9 -7
  171. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
  172. package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.d.ts +1 -1
  173. package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.d.ts.map +1 -1
  174. package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.js.map +1 -1
  175. package/lib/cjs/imodel-components-react.js.map +1 -1
  176. package/lib/esm/imodel-components-react/UiIModelComponents.js +4 -2
  177. package/lib/esm/imodel-components-react/UiIModelComponents.js.map +1 -1
  178. package/lib/esm/imodel-components-react/color/AlphaSlider.d.ts +1 -1
  179. package/lib/esm/imodel-components-react/color/AlphaSlider.d.ts.map +1 -1
  180. package/lib/esm/imodel-components-react/color/AlphaSlider.js.map +1 -1
  181. package/lib/esm/imodel-components-react/color/AlphaSlider.scss +63 -63
  182. package/lib/esm/imodel-components-react/color/ColorPickerButton.d.ts +1 -1
  183. package/lib/esm/imodel-components-react/color/ColorPickerButton.d.ts.map +1 -1
  184. package/lib/esm/imodel-components-react/color/ColorPickerButton.js +1 -1
  185. package/lib/esm/imodel-components-react/color/ColorPickerButton.js.map +1 -1
  186. package/lib/esm/imodel-components-react/color/ColorPickerButton.scss +90 -90
  187. package/lib/esm/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
  188. package/lib/esm/imodel-components-react/color/ColorPickerPopup.d.ts +1 -1
  189. package/lib/esm/imodel-components-react/color/ColorPickerPopup.d.ts.map +1 -1
  190. package/lib/esm/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
  191. package/lib/esm/imodel-components-react/color/ColorPickerPopup.scss +62 -62
  192. package/lib/esm/imodel-components-react/color/HueSlider.d.ts +2 -2
  193. package/lib/esm/imodel-components-react/color/HueSlider.d.ts.map +1 -1
  194. package/lib/esm/imodel-components-react/color/HueSlider.js.map +1 -1
  195. package/lib/esm/imodel-components-react/color/HueSlider.scss +61 -61
  196. package/lib/esm/imodel-components-react/color/SaturationPicker.d.ts +1 -1
  197. package/lib/esm/imodel-components-react/color/SaturationPicker.d.ts.map +1 -1
  198. package/lib/esm/imodel-components-react/color/SaturationPicker.js.map +1 -1
  199. package/lib/esm/imodel-components-react/color/SaturationPicker.scss +35 -35
  200. package/lib/esm/imodel-components-react/color/Swatch.d.ts +2 -2
  201. package/lib/esm/imodel-components-react/color/Swatch.d.ts.map +1 -1
  202. package/lib/esm/imodel-components-react/color/Swatch.js.map +1 -1
  203. package/lib/esm/imodel-components-react/color/Swatch.scss +22 -22
  204. package/lib/esm/imodel-components-react/color/getCSSColorFromDef.d.ts +1 -1
  205. package/lib/esm/imodel-components-react/color/getCSSColorFromDef.d.ts.map +1 -1
  206. package/lib/esm/imodel-components-react/color/getCSSColorFromDef.js.map +1 -1
  207. package/lib/esm/imodel-components-react/editors/ColorEditor.d.ts +3 -2
  208. package/lib/esm/imodel-components-react/editors/ColorEditor.d.ts.map +1 -1
  209. package/lib/esm/imodel-components-react/editors/ColorEditor.js.map +1 -1
  210. package/lib/esm/imodel-components-react/editors/ColorEditor.scss +18 -18
  211. package/lib/esm/imodel-components-react/editors/WeightEditor.d.ts +3 -2
  212. package/lib/esm/imodel-components-react/editors/WeightEditor.d.ts.map +1 -1
  213. package/lib/esm/imodel-components-react/editors/WeightEditor.js.map +1 -1
  214. package/lib/esm/imodel-components-react/editors/WeightEditor.scss +16 -16
  215. package/lib/esm/imodel-components-react/inputs/QuantityInput.d.ts +2 -2
  216. package/lib/esm/imodel-components-react/inputs/QuantityInput.d.ts.map +1 -1
  217. package/lib/esm/imodel-components-react/inputs/QuantityInput.js.map +1 -1
  218. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.d.ts +2 -2
  219. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.d.ts.map +1 -1
  220. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js +1 -1
  221. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
  222. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.scss +106 -106
  223. package/lib/esm/imodel-components-react/lineweight/Swatch.d.ts +2 -2
  224. package/lib/esm/imodel-components-react/lineweight/Swatch.d.ts.map +1 -1
  225. package/lib/esm/imodel-components-react/lineweight/Swatch.js.map +1 -1
  226. package/lib/esm/imodel-components-react/lineweight/Swatch.scss +48 -48
  227. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.d.ts +2 -2
  228. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.d.ts.map +1 -1
  229. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
  230. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.scss +51 -51
  231. package/lib/esm/imodel-components-react/navigationaids/Cube.d.ts +1 -1
  232. package/lib/esm/imodel-components-react/navigationaids/Cube.d.ts.map +1 -1
  233. package/lib/esm/imodel-components-react/navigationaids/Cube.js.map +1 -1
  234. package/lib/esm/imodel-components-react/navigationaids/Cube.scss +19 -19
  235. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.d.ts +3 -2
  236. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.d.ts.map +1 -1
  237. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js +50 -23
  238. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
  239. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.scss +178 -178
  240. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts +3 -2
  241. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts.map +1 -1
  242. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
  243. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.scss +135 -135
  244. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.d.ts +3 -2
  245. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.d.ts.map +1 -1
  246. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js +1 -1
  247. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
  248. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.scss +59 -59
  249. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.d.ts +2 -2
  250. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.d.ts.map +1 -1
  251. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js +3 -2
  252. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
  253. package/lib/esm/imodel-components-react/quantityformat/FormatSample.d.ts +2 -2
  254. package/lib/esm/imodel-components-react/quantityformat/FormatSample.d.ts.map +1 -1
  255. package/lib/esm/imodel-components-react/quantityformat/FormatSample.js +2 -2
  256. package/lib/esm/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
  257. package/lib/esm/imodel-components-react/quantityformat/FormatType.d.ts +2 -2
  258. package/lib/esm/imodel-components-react/quantityformat/FormatType.d.ts.map +1 -1
  259. package/lib/esm/imodel-components-react/quantityformat/FormatType.js +2 -1
  260. package/lib/esm/imodel-components-react/quantityformat/FormatType.js.map +1 -1
  261. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.d.ts +2 -2
  262. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.d.ts.map +1 -1
  263. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js +2 -1
  264. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
  265. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.d.ts +2 -2
  266. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.d.ts.map +1 -1
  267. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js +9 -5
  268. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
  269. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.d.ts +2 -2
  270. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.d.ts.map +1 -1
  271. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js +4 -3
  272. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
  273. package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts +3 -3
  274. package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts.map +1 -1
  275. package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.js.map +1 -1
  276. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.d.ts +1 -1
  277. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.d.ts.map +1 -1
  278. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.js.map +1 -1
  279. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.d.ts +1 -1
  280. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.d.ts.map +1 -1
  281. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.js.map +1 -1
  282. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.d.ts +1 -1
  283. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.d.ts.map +1 -1
  284. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.js.map +1 -1
  285. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.d.ts +1 -1
  286. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.d.ts.map +1 -1
  287. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.js.map +1 -1
  288. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.d.ts +1 -1
  289. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.d.ts.map +1 -1
  290. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.js.map +1 -1
  291. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.d.ts +1 -1
  292. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.d.ts.map +1 -1
  293. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js.map +1 -1
  294. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.d.ts +1 -1
  295. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.d.ts.map +1 -1
  296. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.js.map +1 -1
  297. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.d.ts +1 -1
  298. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.d.ts.map +1 -1
  299. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.js.map +1 -1
  300. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts +2 -2
  301. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts.map +1 -1
  302. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +2 -1
  303. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
  304. package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.d.ts +2 -2
  305. package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.d.ts.map +1 -1
  306. package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.js.map +1 -1
  307. package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.d.ts +2 -2
  308. package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.d.ts.map +1 -1
  309. package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.js.map +1 -1
  310. package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.d.ts +2 -2
  311. package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.d.ts.map +1 -1
  312. package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.js.map +1 -1
  313. package/lib/esm/imodel-components-react/timeline/InlineEdit.d.ts +1 -1
  314. package/lib/esm/imodel-components-react/timeline/InlineEdit.d.ts.map +1 -1
  315. package/lib/esm/imodel-components-react/timeline/InlineEdit.js.map +1 -1
  316. package/lib/esm/imodel-components-react/timeline/InlineEdit.scss +26 -26
  317. package/lib/esm/imodel-components-react/timeline/PlayerButton.d.ts +1 -1
  318. package/lib/esm/imodel-components-react/timeline/PlayerButton.d.ts.map +1 -1
  319. package/lib/esm/imodel-components-react/timeline/PlayerButton.js.map +1 -1
  320. package/lib/esm/imodel-components-react/timeline/PlayerButton.scss +28 -28
  321. package/lib/esm/imodel-components-react/timeline/Scrubber.d.ts +2 -2
  322. package/lib/esm/imodel-components-react/timeline/Scrubber.d.ts.map +1 -1
  323. package/lib/esm/imodel-components-react/timeline/Scrubber.js.map +1 -1
  324. package/lib/esm/imodel-components-react/timeline/Scrubber.scss +105 -105
  325. package/lib/esm/imodel-components-react/timeline/SolarTimeline.d.ts +1 -1
  326. package/lib/esm/imodel-components-react/timeline/SolarTimeline.d.ts.map +1 -1
  327. package/lib/esm/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
  328. package/lib/esm/imodel-components-react/timeline/SolarTimeline.scss +359 -359
  329. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.d.ts +1 -1
  330. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.d.ts.map +1 -1
  331. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.js.map +1 -1
  332. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.scss +39 -39
  333. package/lib/esm/imodel-components-react/timeline/Timeline.scss +164 -164
  334. package/lib/esm/imodel-components-react/timeline/TimelineComponent.d.ts +2 -2
  335. package/lib/esm/imodel-components-react/timeline/TimelineComponent.d.ts.map +1 -1
  336. package/lib/esm/imodel-components-react/timeline/TimelineComponent.js +0 -7
  337. package/lib/esm/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
  338. package/lib/esm/imodel-components-react/timeline/TimelineComponent.scss +177 -177
  339. package/lib/esm/imodel-components-react/timeline/interfaces.d.ts +3 -3
  340. package/lib/esm/imodel-components-react/timeline/interfaces.d.ts.map +1 -1
  341. package/lib/esm/imodel-components-react/timeline/interfaces.js.map +1 -1
  342. package/lib/esm/imodel-components-react/viewport/ViewportComponent.d.ts +4 -3
  343. package/lib/esm/imodel-components-react/viewport/ViewportComponent.d.ts.map +1 -1
  344. package/lib/esm/imodel-components-react/viewport/ViewportComponent.js +9 -7
  345. package/lib/esm/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
  346. package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.d.ts +1 -1
  347. package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.d.ts.map +1 -1
  348. package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.js.map +1 -1
  349. package/lib/esm/imodel-components-react.js.map +1 -1
  350. package/lib/public/locales/en/UiIModelComponents.json +139 -139
  351. package/package.json +17 -12
@@ -2,8 +2,8 @@
2
2
  * @module Inputs
3
3
  */
4
4
  import * as React from "react";
5
- import { QuantityTypeArg } from "@itwin/core-frontend";
6
- import { CommonProps } from "@itwin/core-react";
5
+ import type { QuantityTypeArg } from "@itwin/core-frontend";
6
+ import type { CommonProps } from "@itwin/core-react";
7
7
  /** Props for [[QuantityInput]] control
8
8
  * @beta
9
9
  */
@@ -1 +1 @@
1
- {"version":3,"file":"QuantityInput.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/inputs/QuantityInput.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAyC,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG9F,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD;;GAEG;AACH,MAAM,WAAW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,CAAC,mCAAmC,CAAC,cAAc,CAAC,uBAAuB,CAAC,CAAC;QAC1G,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAEnB,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,uBAAuB,GAAG,CAAC,CAAC,IAAgC,EAAQ,EAAE;YAC1E,MAAM,WAAW,GAAG,SAAS,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;YACjF,uBAAuB;YACvB,IAAI,IAAI,CAAC,YAAY,KAAK,WAAW,EAAE;gBACrC,gBAAgB,CAAC,SAAS,CAAC,iBAAiB,CAAC,+BAA+B,CAAC,YAAY,CAAC,CAAC,CAAC;gBAC5F,aAAa,CAAC,SAAS,CAAC,iBAAiB,CAAC,4BAA4B,CAAC,YAAY,CAAC,CAAC,CAAC;aACvF;QACH,CAAC,CAAC,CAAC;QAEH,SAAS,CAAC,iBAAiB,CAAC,wBAAwB,CAAC,WAAW,CAAC,uBAAuB,CAAC,CAAC;QAC1F,OAAO,GAAG,EAAE;YACV,SAAS,CAAC,iBAAiB,CAAC,wBAAwB,CAAC,cAAc,CAAC,uBAAuB,CAAC,CAAC;QAC/F,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAEnB,OAAO,oBAAC,WAAW,mBAAa,2BAA2B,EAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EACvG,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,GAAI,CAAC;AACvI,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\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 Inputs\r\n */\r\n\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { IModelApp, QuantityFormatsChangedArgs, QuantityTypeArg } from \"@itwin/core-frontend\";\r\nimport { Parser } from \"@itwin/core-quantity\";\r\nimport { ParseResults } from \"@itwin/appui-abstract\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { UiIModelComponents } from \"../UiIModelComponents\";\r\nimport { ParsedInput } from \"@itwin/components-react\";\r\n\r\n/** Props for [[QuantityInput]] control\r\n * @beta\r\n */\r\nexport interface QuantityProps extends CommonProps {\r\n /** Initial magnitude in 'persistence' units. See `getPersistenceUnitByQuantityType` in [QuantityFormatter]($core-frontend) */\r\n initialValue: number;\r\n /** Type of quantity being input. */\r\n quantityType: QuantityTypeArg;\r\n /** Function to call in the quantity value is changed. The value returned will be in 'persistence' units. */\r\n onQuantityChange: (newQuantityValue: number) => void;\r\n /** Set to `true` if value is for display only */\r\n readonly?: boolean;\r\n /** Provides ability to return reference to HTMLInputElement */\r\n ref?: React.Ref<HTMLInputElement>;\r\n}\r\n\r\n/** Input control that allows users to input a quantity and show the formatted string that represents the value.\r\n * @beta\r\n */\r\nexport function QuantityInput({ initialValue, quantityType, readonly, className, style, onQuantityChange, ref }: QuantityProps) {\r\n const [formatterSpec, setFormatterSpec] = React.useState(() => IModelApp.quantityFormatter.findFormatterSpecByQuantityType(quantityType));\r\n const [parserSpec, setParserSpec] = React.useState(() => IModelApp.quantityFormatter.findParserSpecByQuantityType(quantityType));\r\n\r\n const formatValue = React.useCallback((value: number) => {\r\n // istanbul ignore else\r\n if (formatterSpec) {\r\n return formatterSpec.applyFormatting(value);\r\n }\r\n // istanbul ignore next\r\n return value.toFixed(2);\r\n }, [formatterSpec]);\r\n\r\n const parseString = React.useCallback((userInput: string): ParseResults => {\r\n // istanbul ignore else\r\n if (parserSpec) {\r\n const parseResult = IModelApp.quantityFormatter.parseToQuantityValue(userInput, parserSpec);\r\n // istanbul ignore else\r\n if (Parser.isParsedQuantity(parseResult)) {\r\n return { value: parseResult.value };\r\n } else {\r\n const statusId = Parser.isParseError(parseResult) ? parseResult.error.toString() : \"Unknown\";\r\n return { parseError: `${UiIModelComponents.translate(\"QuantityInput.NoParserDefined\")}${statusId}` };\r\n }\r\n }\r\n // istanbul ignore next\r\n return { parseError: UiIModelComponents.translate(\"QuantityInput.NoParserDefined\") };\r\n }, [parserSpec]);\r\n\r\n const classNames = classnames(className, \"components-quantity-input\");\r\n\r\n React.useEffect(() => {\r\n const handleUnitSystemChanged = ((): void => {\r\n setFormatterSpec(IModelApp.quantityFormatter.findFormatterSpecByQuantityType(quantityType));\r\n setParserSpec(IModelApp.quantityFormatter.findParserSpecByQuantityType(quantityType));\r\n });\r\n\r\n IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.addListener(handleUnitSystemChanged);\r\n return () => {\r\n IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.removeListener(handleUnitSystemChanged);\r\n };\r\n }, [quantityType]);\r\n\r\n React.useEffect(() => {\r\n const handleUnitSystemChanged = ((args: QuantityFormatsChangedArgs): void => {\r\n const quantityKey = IModelApp.quantityFormatter.getQuantityTypeKey(quantityType);\r\n // istanbul ignore else\r\n if (args.quantityType === quantityKey) {\r\n setFormatterSpec(IModelApp.quantityFormatter.findFormatterSpecByQuantityType(quantityType));\r\n setParserSpec(IModelApp.quantityFormatter.findParserSpecByQuantityType(quantityType));\r\n }\r\n });\r\n\r\n IModelApp.quantityFormatter.onQuantityFormatsChanged.addListener(handleUnitSystemChanged);\r\n return () => {\r\n IModelApp.quantityFormatter.onQuantityFormatsChanged.removeListener(handleUnitSystemChanged);\r\n };\r\n }, [quantityType]);\r\n\r\n return <ParsedInput data-testid=\"components-quantity-input\" ref={ref} style={style} className={classNames}\r\n onChange={onQuantityChange} initialValue={initialValue} readonly={readonly} formatValue={formatValue} parseString={parseString} />;\r\n}\r\n"]}
1
+ {"version":3,"file":"QuantityInput.js","sourceRoot":"","sources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AY,CAAC,CAAC,CAAC;IAEnB,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,uBAAuB,GAAG,CAAC,CAAC,IAAgC,EAAQ,EAAE;YAC1E,MAAM,WAAW,GAAG,SAAS,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;YACjF,uBAAuB;YACvB,IAAI,IAAI,CAAC,YAAY,KAAK,WAAW,EAAE;gBACrC,gBAAgB,CAAC,SAAS,CAAC,iBAAiB,CAAC,+BAA+B,CAAC,YAAY,CAAC,CAAC,CAAC;gBAC5F,aAAa,CAAC,SAAS,CAAC,iBAAiB,CAAC,4BAA4B,CAAC,YAAY,CAAC,CAAC,CAAC;aACvF;QACH,CAAC,CAAC,CAAC;QAEH,SAAS,CAAC,iBAAiB,CAAC,wBAAwB,CAAC,WAAW,CAAC,uBAAuB,CAAC,CAAC;QAC1F,OAAO,GAAG,EAAE;YACV,SAAS,CAAC,iBAAiB,CAAC,wBAAwB,CAAC,cAAc,CAAC,uBAAuB,CAAC,CAAC;QAC/F,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAEnB,OAAO,oBAAC,WAAW,mBAAa,2BAA2B,EAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EACvG,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,GAAI,CAAC;AACvI,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Inputs\n */\n\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { QuantityFormatsChangedArgs, QuantityTypeArg } from \"@itwin/core-frontend\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { Parser } from \"@itwin/core-quantity\";\nimport type { ParseResults } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { UiIModelComponents } from \"../UiIModelComponents\";\nimport { ParsedInput } from \"@itwin/components-react\";\n\n/** Props for [[QuantityInput]] control\n * @beta\n */\nexport interface QuantityProps extends CommonProps {\n /** Initial magnitude in 'persistence' units. See `getPersistenceUnitByQuantityType` in [QuantityFormatter]($core-frontend) */\n initialValue: number;\n /** Type of quantity being input. */\n quantityType: QuantityTypeArg;\n /** Function to call in the quantity value is changed. The value returned will be in 'persistence' units. */\n onQuantityChange: (newQuantityValue: number) => void;\n /** Set to `true` if value is for display only */\n readonly?: boolean;\n /** Provides ability to return reference to HTMLInputElement */\n ref?: React.Ref<HTMLInputElement>;\n}\n\n/** Input control that allows users to input a quantity and show the formatted string that represents the value.\n * @beta\n */\nexport function QuantityInput({ initialValue, quantityType, readonly, className, style, onQuantityChange, ref }: QuantityProps) {\n const [formatterSpec, setFormatterSpec] = React.useState(() => IModelApp.quantityFormatter.findFormatterSpecByQuantityType(quantityType));\n const [parserSpec, setParserSpec] = React.useState(() => IModelApp.quantityFormatter.findParserSpecByQuantityType(quantityType));\n\n const formatValue = React.useCallback((value: number) => {\n // istanbul ignore else\n if (formatterSpec) {\n return formatterSpec.applyFormatting(value);\n }\n // istanbul ignore next\n return value.toFixed(2);\n }, [formatterSpec]);\n\n const parseString = React.useCallback((userInput: string): ParseResults => {\n // istanbul ignore else\n if (parserSpec) {\n const parseResult = IModelApp.quantityFormatter.parseToQuantityValue(userInput, parserSpec);\n // istanbul ignore else\n if (Parser.isParsedQuantity(parseResult)) {\n return { value: parseResult.value };\n } else {\n const statusId = Parser.isParseError(parseResult) ? parseResult.error.toString() : \"Unknown\";\n return { parseError: `${UiIModelComponents.translate(\"QuantityInput.NoParserDefined\")}${statusId}` };\n }\n }\n // istanbul ignore next\n return { parseError: UiIModelComponents.translate(\"QuantityInput.NoParserDefined\") };\n }, [parserSpec]);\n\n const classNames = classnames(className, \"components-quantity-input\");\n\n React.useEffect(() => {\n const handleUnitSystemChanged = ((): void => {\n setFormatterSpec(IModelApp.quantityFormatter.findFormatterSpecByQuantityType(quantityType));\n setParserSpec(IModelApp.quantityFormatter.findParserSpecByQuantityType(quantityType));\n });\n\n IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.addListener(handleUnitSystemChanged);\n return () => {\n IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.removeListener(handleUnitSystemChanged);\n };\n }, [quantityType]);\n\n React.useEffect(() => {\n const handleUnitSystemChanged = ((args: QuantityFormatsChangedArgs): void => {\n const quantityKey = IModelApp.quantityFormatter.getQuantityTypeKey(quantityType);\n // istanbul ignore else\n if (args.quantityType === quantityKey) {\n setFormatterSpec(IModelApp.quantityFormatter.findFormatterSpecByQuantityType(quantityType));\n setParserSpec(IModelApp.quantityFormatter.findParserSpecByQuantityType(quantityType));\n }\n });\n\n IModelApp.quantityFormatter.onQuantityFormatsChanged.addListener(handleUnitSystemChanged);\n return () => {\n IModelApp.quantityFormatter.onQuantityFormatsChanged.removeListener(handleUnitSystemChanged);\n };\n }, [quantityType]);\n\n return <ParsedInput data-testid=\"components-quantity-input\" ref={ref} style={style} className={classNames}\n onChange={onQuantityChange} initialValue={initialValue} readonly={readonly} formatValue={formatValue} parseString={parseString} />;\n}\n"]}
@@ -3,8 +3,8 @@
3
3
  */
4
4
  import "./QuantityNumberInput.scss";
5
5
  import * as React from "react";
6
- import { QuantityTypeArg } from "@itwin/core-frontend";
7
- import { InputProps } from "@itwin/itwinui-react";
6
+ import type { QuantityTypeArg } from "@itwin/core-frontend";
7
+ import type { InputProps } from "@itwin/itwinui-react";
8
8
  /** Step function prototype for [[QuantityNumberInput]] component
9
9
  * @beta
10
10
  */
@@ -1 +1 @@
1
- {"version":3,"file":"QuantityNumberInput.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/inputs/Qu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}
@@ -48,7 +48,7 @@ function getUnitLabel(parserSpec) {
48
48
  return parserSpec.outUnit.label;
49
49
  const [unit, label] = format.units[0];
50
50
  // istanbul ignore next
51
- return label ?? unit.label;
51
+ return label !== null && label !== void 0 ? label : unit.label;
52
52
  }
53
53
  const ForwardRefQuantityNumberInput = React.forwardRef(function ForwardRefQuantityNumberInput(props, ref) {
54
54
  const { containerClassName, persistenceValue, min, max, onChange, onBlur, onKeyDown, step, snap, showTouchButtons, quantityType, ...otherProps } = props;
@@ -1 +1 @@
1
- {"version":3,"file":"QuantityNumberInput.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/inputs/QuantityNumberInput.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,4BAA4B,CAAC;AACpC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,SAAS,EAA+C,MAAM,sBAAsB,CAAC;AAC9F,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAA6C,MAAM,sBAAsB,CAAC;AACpJ,OAAO,EAAE,KAAK,EAAc,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAkC1G,wEAAwE;AACxE,SAAS,mBAAmB,CAAC,aAAwC;IACnE,IAAI,SAAS,KAAK,aAAa;QAC7B,OAAO,aAAa,CAAC;IACvB,MAAM,oBAAoB,GAAyB,EAAE,CAAC;IACtD,oBAAoB,CAAC,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5D,MAAM,SAAS,GAAG,aAAa,CAAC,MAAM,C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AAS,GAAI,CACzB,CACF,CACF;QACN,8BAAM,SAAS,EAAC,wCAAwC,IAAE,SAAS,CAAQ,CACtE,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAA4D,6BAA6B,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 Inputs\r\n */\r\n\r\nimport \"./QuantityNumberInput.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { Icon } from \"@itwin/core-react\";\r\nimport { SpecialKey } from \"@itwin/appui-abstract\";\r\nimport { IModelApp, QuantityFormatsChangedArgs, QuantityTypeArg } from \"@itwin/core-frontend\";\r\nimport { DecimalPrecision, FormatterSpec, FormatTraits, FormatType, Parser, ParserSpec, UnitConversionSpec, UnitProps } from \"@itwin/core-quantity\";\r\nimport { Input, InputProps } from \"@itwin/itwinui-react\";\r\nimport { SvgCaretDown, SvgCaretDownSmall, SvgCaretUp, SvgCaretUpSmall } from \"@itwin/itwinui-icons-react\";\r\n\r\n/** Step function prototype for [[QuantityNumberInput]] component\r\n * @beta\r\n */\r\nexport type StepFunctionProp = number | ((direction: string) => number | undefined);\r\n\r\n/** Properties for the [[QuantityNumberInput]] component\r\n * @beta\r\n */\r\nexport interface QuantityNumberInputProps extends Omit<InputProps, \"value\" | \"min\" | \"max\" | \"step\" | \"onFocus\" | \"onChange\"> {\r\n /** Initial magnitude in 'persistence' units. See `getPersistenceUnitByQuantityType` in [QuantityFormatter]($core-frontend).\r\n * Set to `undefined` to show placeholder text */\r\n persistenceValue?: number;\r\n /** CSS class name for the QuantityNumberInput component container div */\r\n containerClassName?: string;\r\n /** number or function\tNumber.MIN_SAFE_INTEGER */\r\n min?: number;\r\n /** number or function\tdefaults to Number.MAX_SAFE_INTEGER */\r\n max?: number;\r\n /** increment step value used while incrementing or decrementing (up/down buttons or arrow keys) defaults to 1. */\r\n step?: StepFunctionProp;\r\n /** Set to true to \"snap\" to the closest step value while incrementing or decrementing (up/down buttons or arrow keys). */\r\n snap?: boolean;\r\n /** Function to call when the quantity value is changed. The value returned will be in 'persistence' units. */\r\n onChange?: (value: number) => void;\r\n /** if true up/down buttons are shown larger and side by side */\r\n showTouchButtons?: boolean;\r\n /** Provides ability to return reference to HTMLInputElement */\r\n ref?: React.Ref<HTMLInputElement>;\r\n /** Type of quantity being input. */\r\n quantityType: QuantityTypeArg;\r\n}\r\n\r\n/** adjust formatter spec to show only primary unit without a label. */\r\nfunction adjustFormatterSpec(formatterSpec: FormatterSpec | undefined) {\r\n if (undefined === formatterSpec)\r\n return formatterSpec;\r\n const singleUnitConversion: UnitConversionSpec[] = [];\r\n singleUnitConversion.push(formatterSpec.unitConversions[0]);\r\n const newFormat = formatterSpec.format.clone({\r\n showOnlyPrimaryUnit: true,\r\n traits: formatterSpec.format.formatTraits & ~FormatTraits.ShowUnitLabel,\r\n type: FormatType.Decimal,\r\n precision: FormatType.Decimal !== formatterSpec.format.type ? DecimalPrecision.Four : formatterSpec.format.precision,\r\n });\r\n return new FormatterSpec(\"single-value\", newFormat, singleUnitConversion, formatterSpec.persistenceUnit);\r\n}\r\n\r\nfunction convertValueFromDisplayToPersistence(value: number, unitConversions: UnitConversionSpec[] | undefined, unit: UnitProps) {\r\n // istanbul ignore next\r\n if (!unitConversions || 0 === unitConversions.length)\r\n return value;\r\n\r\n const unitConversion = unitConversions.find((spec) => spec.name === unit.name);\r\n // istanbul ignore next\r\n if (!unitConversion)\r\n return value;\r\n\r\n const convertedValue = (value * unitConversion.conversion.factor) + unitConversion.conversion.offset;\r\n return convertedValue;\r\n}\r\n\r\nfunction getUnitLabel(parserSpec: ParserSpec | undefined) {\r\n if (undefined === parserSpec)\r\n return \"\";\r\n\r\n const format = parserSpec.format;\r\n // istanbul ignore else\r\n if (!format.units || !format.units[0])\r\n return parserSpec.outUnit.label;\r\n const [unit, label] = format.units[0];\r\n // istanbul ignore next\r\n return label ?? unit.label;\r\n}\r\n\r\nconst ForwardRefQuantityNumberInput = React.forwardRef<HTMLInputElement, QuantityNumberInputProps>(\r\n function ForwardRefQuantityNumberInput(props, ref) {\r\n\r\n const { containerClassName, persistenceValue, min, max,\r\n onChange, onBlur, onKeyDown, step, snap, showTouchButtons, quantityType, ...otherProps } = props;\r\n const rawValueRef = React.useRef(persistenceValue);\r\n\r\n const [formatterSpec, setFormatterSpec] = React.useState(() => adjustFormatterSpec(IModelApp.quantityFormatter.findFormatterSpecByQuantityType(quantityType)));\r\n const [parserSpec, setParserSpec] = React.useState(() => IModelApp.quantityFormatter.findParserSpecByQuantityType(quantityType));\r\n\r\n const formatValue = React.useCallback((value: number | undefined) => {\r\n if (undefined === value)\r\n return \"\";\r\n\r\n // istanbul ignore else\r\n if (formatterSpec) {\r\n return formatterSpec.applyFormatting(value);\r\n }\r\n // istanbul ignore next\r\n return value.toFixed(2);\r\n }, [formatterSpec]);\r\n\r\n const lastFormattedValueRef = React.useRef(formatValue(persistenceValue));\r\n const [formattedValue, setFormattedValue] = React.useState(() => lastFormattedValueRef.current);\r\n\r\n React.useEffect(() => {\r\n const handleUnitSystemChanged = ((): void => {\r\n setFormatterSpec(adjustFormatterSpec(IModelApp.quantityFormatter.findFormatterSpecByQuantityType(quantityType)));\r\n setParserSpec(IModelApp.quantityFormatter.findParserSpecByQuantityType(quantityType));\r\n });\r\n\r\n IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.addListener(handleUnitSystemChanged);\r\n return () => {\r\n IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.removeListener(handleUnitSystemChanged);\r\n };\r\n }, [quantityType]);\r\n\r\n React.useEffect(() => {\r\n const handleUnitSystemChanged = ((args: QuantityFormatsChangedArgs): void => {\r\n const quantityKey = IModelApp.quantityFormatter.getQuantityTypeKey(quantityType);\r\n // istanbul ignore else\r\n if (args.quantityType === quantityKey) {\r\n setFormatterSpec(adjustFormatterSpec(IModelApp.quantityFormatter.findFormatterSpecByQuantityType(quantityType)));\r\n setParserSpec(IModelApp.quantityFormatter.findParserSpecByQuantityType(quantityType));\r\n }\r\n });\r\n\r\n IModelApp.quantityFormatter.onQuantityFormatsChanged.addListener(handleUnitSystemChanged);\r\n return () => {\r\n IModelApp.quantityFormatter.onQuantityFormatsChanged.removeListener(handleUnitSystemChanged);\r\n };\r\n }, [quantityType]);\r\n\r\n const unitLabel = getUnitLabel(parserSpec);\r\n\r\n // See if new initialValue props have changed since component mounted\r\n React.useEffect(() => {\r\n rawValueRef.current = persistenceValue;\r\n const currentFormattedValue = formatValue(rawValueRef.current);\r\n setFormattedValue(currentFormattedValue);\r\n }, [formatValue, persistenceValue]);\r\n\r\n // this is the unprocessed input from user, it is not processed until blur or enter key press\r\n const handleDisplayValueChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\r\n setFormattedValue(event.currentTarget.value);\r\n }, []);\r\n\r\n const updateValue = React.useCallback((newValue: number) => {\r\n let persistedValue = newValue;\r\n // istanbul ignore else\r\n if (parserSpec) {\r\n // convert value from display unit to persistence unit\r\n const [unit] = parserSpec.format.units ? parserSpec.format.units[0] : /* istanbul ignore next */[parserSpec.outUnit];\r\n persistedValue = convertValueFromDisplayToPersistence(newValue, parserSpec.unitConversions, unit);\r\n rawValueRef.current = persistedValue;\r\n }\r\n const newFormattedVal = formatValue(persistedValue);\r\n onChange && onChange(persistedValue);\r\n setFormattedValue(newFormattedVal);\r\n\r\n }, [formatValue, onChange, parserSpec]);\r\n\r\n /**\r\n * Used internally to parse the argument x to it's numeric representation.\r\n * If the argument cannot be converted to finite number returns 0; If a\r\n * \"precision\" prop is specified uses it round the number with that\r\n * precision (no fixed precision here because the return value is float, not\r\n * string).\r\n */\r\n const parseInternal = React.useCallback((x: string | undefined) => {\r\n if (!x)\r\n return 0;\r\n\r\n let n = parseFloat(x);\r\n // istanbul ignore next\r\n if (isNaN(n) || !isFinite(n)) {\r\n n = 0;\r\n }\r\n\r\n const localPrecision = 6; // TODO get a reasonable value from format\r\n const q = Math.pow(10, localPrecision);\r\n const localMin = undefined === min ? Number.MIN_SAFE_INTEGER : min;\r\n const localMax = undefined === max ? Number.MAX_SAFE_INTEGER : max;\r\n n = Math.min(Math.max(n, localMin), localMax);\r\n n = Math.round(n * q) / q;\r\n\r\n return n;\r\n }, [min, max]);\r\n\r\n const updateValueFromString = React.useCallback((strValue: string) => {\r\n // istanbul ignore else\r\n if (parserSpec) {\r\n const parseResult = IModelApp.quantityFormatter.parseToQuantityValue(strValue, parserSpec);\r\n // at this point we should have a string value in persistence units without a label\r\n if (Parser.isParsedQuantity(parseResult)) {\r\n const persistedValue = parseResult.value; // in persistence units\r\n // set strValue and let it go through parseInternal which will ensure min/max limits are observed\r\n strValue = formatValue(persistedValue)!;\r\n } else {\r\n // istanbul ignore else\r\n if (rawValueRef.current) { // restore last known good value\r\n const lastKnownFormattedVal = formatValue(rawValueRef.current);\r\n setFormattedValue(lastKnownFormattedVal);\r\n return;\r\n }\r\n }\r\n }\r\n const newValue = parseInternal(strValue);\r\n // istanbul ignore else\r\n if (undefined !== newValue)\r\n updateValue(newValue);\r\n }, [formatValue, parseInternal, parserSpec, updateValue]);\r\n\r\n const handleBlur = React.useCallback((event: React.FocusEvent<HTMLInputElement>) => {\r\n const newVal = parseInternal(event.target.value);\r\n onBlur && onBlur(event);\r\n updateValue(newVal);\r\n }, [parseInternal, updateValue, onBlur]);\r\n\r\n const getIncrementValue = React.useCallback((increment: boolean) => {\r\n if (typeof step === \"function\") {\r\n const stepVal = step(increment ? \"up\" : \"down\");\r\n return stepVal ? stepVal : 1;\r\n }\r\n\r\n return !step ? 1 : step;\r\n }, [step]);\r\n\r\n /**\r\n * The internal method that actually sets the new value on the input\r\n */\r\n const applyStep = React.useCallback((increment: boolean) => {\r\n const incrementValue = getIncrementValue(increment);\r\n\r\n let num = parseInternal(formattedValue) + (increment ? incrementValue : -incrementValue);\r\n if (snap) {\r\n num = Math.round(num / incrementValue) * incrementValue;\r\n }\r\n\r\n const localMin = undefined === min ? Number.MIN_SAFE_INTEGER : min;\r\n const localMax = undefined === max ? Number.MAX_SAFE_INTEGER : max;\r\n num = Math.min(Math.max(num, localMin), localMax);\r\n\r\n updateValue(num);\r\n }, [formattedValue, getIncrementValue, max, min, parseInternal, snap, updateValue]);\r\n\r\n const handleKeyDown = React.useCallback((event: React.KeyboardEvent<HTMLInputElement>) => {\r\n // istanbul ignore else\r\n if (event.key === SpecialKey.Enter) {\r\n updateValueFromString(event.currentTarget.value);\r\n event.preventDefault();\r\n } else if (event.key === SpecialKey.Escape) {\r\n setFormattedValue(formatValue(rawValueRef.current));\r\n event.preventDefault();\r\n } else if (event.key === SpecialKey.ArrowDown) {\r\n applyStep(false);\r\n event.preventDefault();\r\n } else if (event.key === SpecialKey.ArrowUp) {\r\n applyStep(true);\r\n event.preventDefault();\r\n }\r\n onKeyDown && onKeyDown(event);\r\n }, [onKeyDown, updateValueFromString, formatValue, applyStep]);\r\n\r\n const handleDownClick = React.useCallback((event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\r\n applyStep(false);\r\n event.preventDefault();\r\n }, [applyStep]);\r\n\r\n const handleUpClick = React.useCallback((event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\r\n applyStep(true);\r\n event.preventDefault();\r\n }, [applyStep]);\r\n\r\n // istanbul ignore next\r\n const handleFocus = React.useCallback((event: React.FocusEvent<HTMLInputElement>) => {\r\n event.currentTarget.select();\r\n }, []);\r\n\r\n const isDisabled = !!otherProps.disabled;\r\n const containerClasses = classnames(\"component-quantity-number-input-container\",\r\n containerClassName, showTouchButtons && \"component-number-buttons-for-touch\",\r\n isDisabled && \"component-quantity-number-input-disabled\",\r\n );\r\n\r\n const caretUp = showTouchButtons ? <SvgCaretUp /> : <SvgCaretUpSmall />;\r\n const caretDown = showTouchButtons ? <SvgCaretDown /> : <SvgCaretDownSmall />;\r\n\r\n return (\r\n <div className={containerClasses} >\r\n <div className=\"component-quantity-number-input-value-and-buttons-container\">\r\n <Input ref={ref} value={formattedValue} onChange={handleDisplayValueChange} onKeyDown={handleKeyDown}\r\n onBlur={handleBlur} onFocus={handleFocus} size=\"small\" {...otherProps} />\r\n <div className={classnames(\"component-quantity-number-input-buttons-container\", showTouchButtons && \"component-number-buttons-for-touch\")}>\r\n { /* eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */}\r\n <div className=\"component-quantity-number-input-button component-quantity-number-input-button-up\" tabIndex={-1} onClick={handleUpClick}>\r\n <Icon iconSpec={caretUp} />\r\n </div>\r\n { /* eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */}\r\n <div className=\"component-quantity-number-input-button component-quantity-number-input-button-down\" tabIndex={-1} onClick={handleDownClick}>\r\n <Icon iconSpec={caretDown} />\r\n </div>\r\n </div>\r\n </div>\r\n <span className=\"component-quantity-number-input-suffix\">{unitLabel}</span>\r\n </div >\r\n );\r\n }\r\n);\r\n\r\n/** The QuantityNumberInput component accepts input for quantity values. The quantity value is shown as a single numeric value and the quantity's\r\n * \"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).\r\n * The control also display buttons to increment and decrement the \"displayed\" value. The value reported by via the onChange function is in \"persistence\"\r\n * units that can be stored in the iModel.\r\n * @beta\r\n */\r\nexport const QuantityNumberInput: (props: QuantityNumberInputProps) => JSX.Element | null = ForwardRefQuantityNumberInput;\r\n"]}
1
+ {"version":3,"file":"QuantityNumberInput.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/inputs/QuantityNumberInput.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,4BAA4B,CAAC;AACpC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,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BAAC,iBAAiB,OAAG,CAAC;IAE9E,OAAO,CACL,6BAAK,SAAS,EAAE,gBAAgB;QAC9B,6BAAK,SAAS,EAAC,6DAA6D;YAC1E,oBAAC,KAAK,IAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,wBAAwB,EAAE,SAAS,EAAE,aAAa,EAClG,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAC,OAAO,KAAK,UAAU,GAAI;YAC3E,6BAAK,SAAS,EAAE,UAAU,CAAC,mDAAmD,EAAE,gBAAgB,IAAI,oCAAoC,CAAC;gBAEvI,6BAAK,SAAS,EAAC,kFAAkF,EAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,aAAa;oBACpI,oBAAC,IAAI,IAAC,QAAQ,EAAE,OAAO,GAAI,CACvB;gBAEN,6BAAK,SAAS,EAAC,oFAAoF,EAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,eAAe;oBACxI,oBAAC,IAAI,IAAC,QAAQ,EAAE,SAAS,GAAI,CACzB,CACF,CACF;QACN,8BAAM,SAAS,EAAC,wCAAwC,IAAE,SAAS,CAAQ,CACtE,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAA4D,6BAA6B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Inputs\n */\n\nimport \"./QuantityNumberInput.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Icon } from \"@itwin/core-react\";\nimport { SpecialKey } from \"@itwin/appui-abstract\";\nimport type { QuantityFormatsChangedArgs, QuantityTypeArg } from \"@itwin/core-frontend\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport type { ParserSpec, UnitConversionSpec, UnitProps } from \"@itwin/core-quantity\";\nimport { DecimalPrecision, FormatterSpec, FormatTraits, FormatType, Parser } from \"@itwin/core-quantity\";\nimport type { InputProps } from \"@itwin/itwinui-react\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport { SvgCaretDown, SvgCaretDownSmall, SvgCaretUp, SvgCaretUpSmall } from \"@itwin/itwinui-icons-react\";\n\n/** Step function prototype for [[QuantityNumberInput]] component\n * @beta\n */\nexport type StepFunctionProp = number | ((direction: string) => number | undefined);\n\n/** Properties for the [[QuantityNumberInput]] component\n * @beta\n */\nexport interface QuantityNumberInputProps extends Omit<InputProps, \"value\" | \"min\" | \"max\" | \"step\" | \"onFocus\" | \"onChange\"> {\n /** Initial magnitude in 'persistence' units. See `getPersistenceUnitByQuantityType` in [QuantityFormatter]($core-frontend).\n * Set to `undefined` to show placeholder text */\n persistenceValue?: number;\n /** CSS class name for the QuantityNumberInput component container div */\n containerClassName?: string;\n /** number or function\tNumber.MIN_SAFE_INTEGER */\n min?: number;\n /** number or function\tdefaults to Number.MAX_SAFE_INTEGER */\n max?: number;\n /** increment step value used while incrementing or decrementing (up/down buttons or arrow keys) defaults to 1. */\n step?: StepFunctionProp;\n /** Set to true to \"snap\" to the closest step value while incrementing or decrementing (up/down buttons or arrow keys). */\n snap?: boolean;\n /** Function to call when the quantity value is changed. The value returned will be in 'persistence' units. */\n onChange?: (value: number) => void;\n /** if true up/down buttons are shown larger and side by side */\n showTouchButtons?: boolean;\n /** Provides ability to return reference to HTMLInputElement */\n ref?: React.Ref<HTMLInputElement>;\n /** Type of quantity being input. */\n quantityType: QuantityTypeArg;\n}\n\n/** adjust formatter spec to show only primary unit without a label. */\nfunction adjustFormatterSpec(formatterSpec: FormatterSpec | undefined) {\n if (undefined === formatterSpec)\n return formatterSpec;\n const singleUnitConversion: UnitConversionSpec[] = [];\n singleUnitConversion.push(formatterSpec.unitConversions[0]);\n const newFormat = formatterSpec.format.clone({\n showOnlyPrimaryUnit: true,\n traits: formatterSpec.format.formatTraits & ~FormatTraits.ShowUnitLabel,\n type: FormatType.Decimal,\n precision: FormatType.Decimal !== formatterSpec.format.type ? DecimalPrecision.Four : formatterSpec.format.precision,\n });\n return new FormatterSpec(\"single-value\", newFormat, singleUnitConversion, formatterSpec.persistenceUnit);\n}\n\nfunction convertValueFromDisplayToPersistence(value: number, unitConversions: UnitConversionSpec[] | undefined, unit: UnitProps) {\n // istanbul ignore next\n if (!unitConversions || 0 === unitConversions.length)\n return value;\n\n const unitConversion = unitConversions.find((spec) => spec.name === unit.name);\n // istanbul ignore next\n if (!unitConversion)\n return value;\n\n const convertedValue = (value * unitConversion.conversion.factor) + unitConversion.conversion.offset;\n return convertedValue;\n}\n\nfunction getUnitLabel(parserSpec: ParserSpec | undefined) {\n if (undefined === parserSpec)\n return \"\";\n\n const format = parserSpec.format;\n // istanbul ignore else\n if (!format.units || !format.units[0])\n return parserSpec.outUnit.label;\n const [unit, label] = format.units[0];\n // istanbul ignore next\n return label ?? unit.label;\n}\n\nconst ForwardRefQuantityNumberInput = React.forwardRef<HTMLInputElement, QuantityNumberInputProps>(\n function ForwardRefQuantityNumberInput(props, ref) {\n\n const { containerClassName, persistenceValue, min, max,\n onChange, onBlur, onKeyDown, step, snap, showTouchButtons, quantityType, ...otherProps } = props;\n const rawValueRef = React.useRef(persistenceValue);\n\n const [formatterSpec, setFormatterSpec] = React.useState(() => adjustFormatterSpec(IModelApp.quantityFormatter.findFormatterSpecByQuantityType(quantityType)));\n const [parserSpec, setParserSpec] = React.useState(() => IModelApp.quantityFormatter.findParserSpecByQuantityType(quantityType));\n\n const formatValue = React.useCallback((value: number | undefined) => {\n if (undefined === value)\n return \"\";\n\n // istanbul ignore else\n if (formatterSpec) {\n return formatterSpec.applyFormatting(value);\n }\n // istanbul ignore next\n return value.toFixed(2);\n }, [formatterSpec]);\n\n const lastFormattedValueRef = React.useRef(formatValue(persistenceValue));\n const [formattedValue, setFormattedValue] = React.useState(() => lastFormattedValueRef.current);\n\n React.useEffect(() => {\n const handleUnitSystemChanged = ((): void => {\n setFormatterSpec(adjustFormatterSpec(IModelApp.quantityFormatter.findFormatterSpecByQuantityType(quantityType)));\n setParserSpec(IModelApp.quantityFormatter.findParserSpecByQuantityType(quantityType));\n });\n\n IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.addListener(handleUnitSystemChanged);\n return () => {\n IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.removeListener(handleUnitSystemChanged);\n };\n }, [quantityType]);\n\n React.useEffect(() => {\n const handleUnitSystemChanged = ((args: QuantityFormatsChangedArgs): void => {\n const quantityKey = IModelApp.quantityFormatter.getQuantityTypeKey(quantityType);\n // istanbul ignore else\n if (args.quantityType === quantityKey) {\n setFormatterSpec(adjustFormatterSpec(IModelApp.quantityFormatter.findFormatterSpecByQuantityType(quantityType)));\n setParserSpec(IModelApp.quantityFormatter.findParserSpecByQuantityType(quantityType));\n }\n });\n\n IModelApp.quantityFormatter.onQuantityFormatsChanged.addListener(handleUnitSystemChanged);\n return () => {\n IModelApp.quantityFormatter.onQuantityFormatsChanged.removeListener(handleUnitSystemChanged);\n };\n }, [quantityType]);\n\n const unitLabel = getUnitLabel(parserSpec);\n\n // See if new initialValue props have changed since component mounted\n React.useEffect(() => {\n rawValueRef.current = persistenceValue;\n const currentFormattedValue = formatValue(rawValueRef.current);\n setFormattedValue(currentFormattedValue);\n }, [formatValue, persistenceValue]);\n\n // this is the unprocessed input from user, it is not processed until blur or enter key press\n const handleDisplayValueChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\n setFormattedValue(event.currentTarget.value);\n }, []);\n\n const updateValue = React.useCallback((newValue: number) => {\n let persistedValue = newValue;\n // istanbul ignore else\n if (parserSpec) {\n // convert value from display unit to persistence unit\n const [unit] = parserSpec.format.units ? parserSpec.format.units[0] : /* istanbul ignore next */[parserSpec.outUnit];\n persistedValue = convertValueFromDisplayToPersistence(newValue, parserSpec.unitConversions, unit);\n rawValueRef.current = persistedValue;\n }\n const newFormattedVal = formatValue(persistedValue);\n onChange && onChange(persistedValue);\n setFormattedValue(newFormattedVal);\n\n }, [formatValue, onChange, parserSpec]);\n\n /**\n * Used internally to parse the argument x to it's numeric representation.\n * If the argument cannot be converted to finite number returns 0; If a\n * \"precision\" prop is specified uses it round the number with that\n * precision (no fixed precision here because the return value is float, not\n * string).\n */\n const parseInternal = React.useCallback((x: string | undefined) => {\n if (!x)\n return 0;\n\n let n = parseFloat(x);\n // istanbul ignore next\n if (isNaN(n) || !isFinite(n)) {\n n = 0;\n }\n\n const localPrecision = 6; // TODO get a reasonable value from format\n const q = Math.pow(10, localPrecision);\n const localMin = undefined === min ? Number.MIN_SAFE_INTEGER : min;\n const localMax = undefined === max ? Number.MAX_SAFE_INTEGER : max;\n n = Math.min(Math.max(n, localMin), localMax);\n n = Math.round(n * q) / q;\n\n return n;\n }, [min, max]);\n\n const updateValueFromString = React.useCallback((strValue: string) => {\n // istanbul ignore else\n if (parserSpec) {\n const parseResult = IModelApp.quantityFormatter.parseToQuantityValue(strValue, parserSpec);\n // at this point we should have a string value in persistence units without a label\n if (Parser.isParsedQuantity(parseResult)) {\n const persistedValue = parseResult.value; // in persistence units\n // set strValue and let it go through parseInternal which will ensure min/max limits are observed\n strValue = formatValue(persistedValue)!;\n } else {\n // istanbul ignore else\n if (rawValueRef.current) { // restore last known good value\n const lastKnownFormattedVal = formatValue(rawValueRef.current);\n setFormattedValue(lastKnownFormattedVal);\n return;\n }\n }\n }\n const newValue = parseInternal(strValue);\n // istanbul ignore else\n if (undefined !== newValue)\n updateValue(newValue);\n }, [formatValue, parseInternal, parserSpec, updateValue]);\n\n const handleBlur = React.useCallback((event: React.FocusEvent<HTMLInputElement>) => {\n const newVal = parseInternal(event.target.value);\n onBlur && onBlur(event);\n updateValue(newVal);\n }, [parseInternal, updateValue, onBlur]);\n\n const getIncrementValue = React.useCallback((increment: boolean) => {\n if (typeof step === \"function\") {\n const stepVal = step(increment ? \"up\" : \"down\");\n return stepVal ? stepVal : 1;\n }\n\n return !step ? 1 : step;\n }, [step]);\n\n /**\n * The internal method that actually sets the new value on the input\n */\n const applyStep = React.useCallback((increment: boolean) => {\n const incrementValue = getIncrementValue(increment);\n\n let num = parseInternal(formattedValue) + (increment ? incrementValue : -incrementValue);\n if (snap) {\n num = Math.round(num / incrementValue) * incrementValue;\n }\n\n const localMin = undefined === min ? Number.MIN_SAFE_INTEGER : min;\n const localMax = undefined === max ? Number.MAX_SAFE_INTEGER : max;\n num = Math.min(Math.max(num, localMin), localMax);\n\n updateValue(num);\n }, [formattedValue, getIncrementValue, max, min, parseInternal, snap, updateValue]);\n\n const handleKeyDown = React.useCallback((event: React.KeyboardEvent<HTMLInputElement>) => {\n // istanbul ignore else\n if (event.key === SpecialKey.Enter) {\n updateValueFromString(event.currentTarget.value);\n event.preventDefault();\n } else if (event.key === SpecialKey.Escape) {\n setFormattedValue(formatValue(rawValueRef.current));\n event.preventDefault();\n } else if (event.key === SpecialKey.ArrowDown) {\n applyStep(false);\n event.preventDefault();\n } else if (event.key === SpecialKey.ArrowUp) {\n applyStep(true);\n event.preventDefault();\n }\n onKeyDown && onKeyDown(event);\n }, [onKeyDown, updateValueFromString, formatValue, applyStep]);\n\n const handleDownClick = React.useCallback((event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n applyStep(false);\n event.preventDefault();\n }, [applyStep]);\n\n const handleUpClick = React.useCallback((event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n applyStep(true);\n event.preventDefault();\n }, [applyStep]);\n\n // istanbul ignore next\n const handleFocus = React.useCallback((event: React.FocusEvent<HTMLInputElement>) => {\n event.currentTarget.select();\n }, []);\n\n const isDisabled = !!otherProps.disabled;\n const containerClasses = classnames(\"component-quantity-number-input-container\",\n containerClassName, showTouchButtons && \"component-number-buttons-for-touch\",\n isDisabled && \"component-quantity-number-input-disabled\",\n );\n\n const caretUp = showTouchButtons ? <SvgCaretUp /> : <SvgCaretUpSmall />;\n const caretDown = showTouchButtons ? <SvgCaretDown /> : <SvgCaretDownSmall />;\n\n return (\n <div className={containerClasses} >\n <div className=\"component-quantity-number-input-value-and-buttons-container\">\n <Input ref={ref} value={formattedValue} onChange={handleDisplayValueChange} onKeyDown={handleKeyDown}\n onBlur={handleBlur} onFocus={handleFocus} size=\"small\" {...otherProps} />\n <div className={classnames(\"component-quantity-number-input-buttons-container\", showTouchButtons && \"component-number-buttons-for-touch\")}>\n { /* eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */}\n <div className=\"component-quantity-number-input-button component-quantity-number-input-button-up\" tabIndex={-1} onClick={handleUpClick}>\n <Icon iconSpec={caretUp} />\n </div>\n { /* eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */}\n <div className=\"component-quantity-number-input-button component-quantity-number-input-button-down\" tabIndex={-1} onClick={handleDownClick}>\n <Icon iconSpec={caretDown} />\n </div>\n </div>\n </div>\n <span className=\"component-quantity-number-input-suffix\">{unitLabel}</span>\n </div >\n );\n }\n);\n\n/** The QuantityNumberInput component accepts input for quantity values. The quantity value is shown as a single numeric value and the quantity's\n * \"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).\n * The control also display buttons to increment and decrement the \"displayed\" value. The value reported by via the onChange function is in \"persistence\"\n * units that can be stored in the iModel.\n * @beta\n */\nexport const QuantityNumberInput: (props: QuantityNumberInputProps) => JSX.Element | null = ForwardRefQuantityNumberInput;\n"]}
@@ -1,106 +1,106 @@
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
- @import "~@itwin/core-react/lib/cjs/core-react/base/base";
6
-
7
- .component-quantity-number-input-container {
8
- display: flex;
9
- align-items: center;
10
- position: relative;
11
- padding: 0;
12
- margin: 0;
13
- box-sizing: border-box;
14
-
15
- .component-quantity-number-input-suffix {
16
- padding-left: 0.25em;
17
- }
18
-
19
- .component-quantity-number-input-value-and-buttons-container {
20
- position: relative;
21
- padding: 0;
22
- margin: 0;
23
- box-sizing: border-box;
24
-
25
- input {
26
- margin: 0;
27
- padding-right: 1.5em;
28
- }
29
-
30
- &.component-number-buttons-for-touch {
31
- input {
32
- padding-right: 3.5em;
33
- }
34
- }
35
-
36
- .component-quantity-number-input-buttons-container {
37
- position: absolute;
38
- top: 0;
39
- right: 0;
40
- width: 20px;
41
- height: 100%;
42
- @include uicore-centered;
43
- flex-direction: column;
44
-
45
- .component-quantity-number-input-button {
46
- font-size: 8px;
47
- outline: none;
48
- height: 100%;
49
- width: 100%;
50
- @include uicore-centered;
51
-
52
- &:hover {
53
- color: var(--iui-color-text-accent-hover);
54
- transition-duration: 150ms;
55
- }
56
-
57
- &.component-quantity-number-input-button-up {
58
- padding-top: 1px;
59
- }
60
-
61
- &.component-quantity-number-input-button-down {
62
- padding-top: 1px;
63
- }
64
- }
65
-
66
- &.component-number-buttons-for-touch {
67
- width: 3.5em;
68
- flex-direction: row-reverse;
69
-
70
- .component-quantity-number-input-button {
71
- font-size: 1em;
72
-
73
- &:hover {
74
- color: unset;
75
- transition-duration: unset;
76
- }
77
-
78
- &.component-quantity-number-input-button-up {
79
- padding-top: 2px;
80
- }
81
-
82
- &.component-quantity-number-input-button-down {
83
- padding-top: 2px;
84
- }
85
- }
86
- }
87
- }
88
- }
89
-
90
- &.component-quantity-number-input-disabled {
91
- .component-quantity-number-input-suffix {
92
- -webkit-user-select: none;
93
- user-select: none;
94
- color: var(--iui-color-text-disabled);
95
- }
96
- .component-quantity-number-input-button-up {
97
- pointer-events: none;
98
- color: var(--iui-color-text-disabled);
99
- }
100
-
101
- .component-quantity-number-input-button-down {
102
- pointer-events: none;
103
- color: var(--iui-color-text-disabled);
104
- }
105
- }
106
- }
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
+ @import "~@itwin/core-react/lib/cjs/core-react/base/base";
6
+
7
+ .component-quantity-number-input-container {
8
+ display: flex;
9
+ align-items: center;
10
+ position: relative;
11
+ padding: 0;
12
+ margin: 0;
13
+ box-sizing: border-box;
14
+
15
+ .component-quantity-number-input-suffix {
16
+ padding-left: 0.25em;
17
+ }
18
+
19
+ .component-quantity-number-input-value-and-buttons-container {
20
+ position: relative;
21
+ padding: 0;
22
+ margin: 0;
23
+ box-sizing: border-box;
24
+
25
+ input {
26
+ margin: 0;
27
+ padding-right: 1.5em;
28
+ }
29
+
30
+ &.component-number-buttons-for-touch {
31
+ input {
32
+ padding-right: 3.5em;
33
+ }
34
+ }
35
+
36
+ .component-quantity-number-input-buttons-container {
37
+ position: absolute;
38
+ top: 0;
39
+ right: 0;
40
+ width: 20px;
41
+ height: 100%;
42
+ @include uicore-centered;
43
+ flex-direction: column;
44
+
45
+ .component-quantity-number-input-button {
46
+ font-size: 8px;
47
+ outline: none;
48
+ height: 100%;
49
+ width: 100%;
50
+ @include uicore-centered;
51
+
52
+ &:hover {
53
+ color: var(--iui-color-text-accent-hover);
54
+ transition-duration: 150ms;
55
+ }
56
+
57
+ &.component-quantity-number-input-button-up {
58
+ padding-top: 1px;
59
+ }
60
+
61
+ &.component-quantity-number-input-button-down {
62
+ padding-top: 1px;
63
+ }
64
+ }
65
+
66
+ &.component-number-buttons-for-touch {
67
+ width: 3.5em;
68
+ flex-direction: row-reverse;
69
+
70
+ .component-quantity-number-input-button {
71
+ font-size: 1em;
72
+
73
+ &:hover {
74
+ color: unset;
75
+ transition-duration: unset;
76
+ }
77
+
78
+ &.component-quantity-number-input-button-up {
79
+ padding-top: 2px;
80
+ }
81
+
82
+ &.component-quantity-number-input-button-down {
83
+ padding-top: 2px;
84
+ }
85
+ }
86
+ }
87
+ }
88
+ }
89
+
90
+ &.component-quantity-number-input-disabled {
91
+ .component-quantity-number-input-suffix {
92
+ -webkit-user-select: none;
93
+ user-select: none;
94
+ color: var(--iui-color-text-disabled);
95
+ }
96
+ .component-quantity-number-input-button-up {
97
+ pointer-events: none;
98
+ color: var(--iui-color-text-disabled);
99
+ }
100
+
101
+ .component-quantity-number-input-button-down {
102
+ pointer-events: none;
103
+ color: var(--iui-color-text-disabled);
104
+ }
105
+ }
106
+ }
@@ -3,8 +3,8 @@
3
3
  */
4
4
  import "./Swatch.scss";
5
5
  import * as React from "react";
6
- import { ColorDef } from "@itwin/core-common";
7
- import { CommonProps } from "@itwin/core-react";
6
+ import type { ColorDef } from "@itwin/core-common";
7
+ import type { CommonProps } from "@itwin/core-react";
8
8
  /** Properties for the [[LineWeightSwatch]] React component
9
9
  * @public
10
10
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Swatch.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/lineweight/Swatch.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,eAAe,CAAC;AAEvB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,WAAW;IACvG,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,4BAA4B;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,sBAAsB;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sBAAsB;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,KAAK,CAAC,aAAa,CAAC,qBAAqB,CAAC;IAC9E,gBAAgB;gBACJ,KAAK,EAAE,qBAAqB;IAIxB,iBAAiB;IAKjB,MAAM;CAmDvB"}
1
+ {"version":3,"file":"Swatch.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/lineweight/Swatch.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,eAAe,CAAC;AAEvB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,WAAW;IACvG,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,4BAA4B;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,sBAAsB;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sBAAsB;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,KAAK,CAAC,aAAa,CAAC,qBAAqB,CAAC;IAC9E,gBAAgB;gBACJ,KAAK,EAAE,qBAAqB;IAIxB,iBAAiB;IAKjB,MAAM;CAmDvB"}
@@ -1 +1 @@
1
- {"version":3,"file":"Swatch.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/lineweight/Swatch.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,eAAe,CAAC;AACvB,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG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AY,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ;YACrG,CAAC,SAAS,IAAI,kCAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAQ;YAC/C,6BAAK,KAAK,EAAE,QAAQ,GAAI,CACjB,CACV,CAAC;IACJ,CAAC;CACF","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 LineWeight\r\n */\r\n\r\nimport \"./Swatch.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { ColorDef } from \"@itwin/core-common\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { getCSSColorFromDef } from \"../color/getCSSColorFromDef\";\r\n\r\n/** Properties for the [[LineWeightSwatch]] React component\r\n * @public\r\n */\r\nexport interface LineWeightSwatchProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, CommonProps {\r\n /** color specification */\r\n weight: number;\r\n /** color specification */\r\n colorDef?: ColorDef;\r\n /** hide the weight label */\r\n hideLabel?: boolean;\r\n /** Disabled or not */\r\n disabled?: boolean;\r\n /** Readonly or not */\r\n readonly?: boolean;\r\n /** function to run when user selects a line weight swatch */\r\n onClick?: () => void;\r\n}\r\n\r\n/** LineWeightSwatch Functional component\r\n * @public\r\n */\r\nexport class LineWeightSwatch extends React.PureComponent<LineWeightSwatchProps> {\r\n /** @internal */\r\n constructor(props: LineWeightSwatchProps) {\r\n super(props);\r\n }\r\n\r\n public override componentDidMount() {\r\n // eslint-disable-next-line no-console\r\n // console.log(`LineWeightSwatchProps.componentDidMount setFocusRef=${this.props.setFocusRef} focusRef=${this.props.focusRef && this.props.focusRef.current ? \"set\" : \"unset\"}`);\r\n }\r\n\r\n public override render() {\r\n const {\r\n onClick, colorDef, weight, hideLabel, className, // do not pass on color swatch specific props\r\n // eslint-disable-next-line comma-dangle\r\n disabled, readonly, ...otherProps // pass-through props\r\n } = this.props;\r\n\r\n let rgbaString = \"\";\r\n\r\n if (colorDef) {\r\n rgbaString = getCSSColorFromDef(colorDef);\r\n }\r\n\r\n const buttonStyle: React.CSSProperties = colorDef ?\r\n {\r\n ...this.props.style,\r\n color: rgbaString,\r\n } :\r\n {\r\n ...this.props.style,\r\n };\r\n\r\n const svgStyle: React.CSSProperties = colorDef ?\r\n {\r\n height: `${weight}px`,\r\n background: rgbaString,\r\n } :\r\n {\r\n height: `${weight}px`,\r\n };\r\n\r\n const handleClick = (_e: React.MouseEvent) => {\r\n // istanbul ignore else\r\n if (onClick)\r\n onClick();\r\n };\r\n\r\n const classes = classnames(\r\n \"components-lineweight-swatch\",\r\n hideLabel && \"hide-label\",\r\n readonly && \"readonly\",\r\n className,\r\n );\r\n\r\n return (\r\n <button {...otherProps} style={buttonStyle} className={classes} onClick={handleClick} disabled={disabled}>\r\n {!hideLabel && <span>{weight.toFixed(0)}</span>}\r\n <div style={svgStyle} />\r\n </button>\r\n );\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Swatch.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/lineweight/Swatch.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,eAAe,CAAC;AACvB,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAoBjE;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,KAAK,CAAC,aAAoC;IAC9E,gBAAgB;IAChB,YAAY,KAA4B;QACtC,KAAK,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;IAEe,iBAAiB;QAC/B,sCAAsC;QACtC,iLAAiL;IACnL,CAAC;IAEe,MAAM;Q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------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module LineWeight\n */\n\nimport \"./Swatch.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { ColorDef } from \"@itwin/core-common\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { getCSSColorFromDef } from \"../color/getCSSColorFromDef\";\n\n/** Properties for the [[LineWeightSwatch]] React component\n * @public\n */\nexport interface LineWeightSwatchProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, CommonProps {\n /** color specification */\n weight: number;\n /** color specification */\n colorDef?: ColorDef;\n /** hide the weight label */\n hideLabel?: boolean;\n /** Disabled or not */\n disabled?: boolean;\n /** Readonly or not */\n readonly?: boolean;\n /** function to run when user selects a line weight swatch */\n onClick?: () => void;\n}\n\n/** LineWeightSwatch Functional component\n * @public\n */\nexport class LineWeightSwatch extends React.PureComponent<LineWeightSwatchProps> {\n /** @internal */\n constructor(props: LineWeightSwatchProps) {\n super(props);\n }\n\n public override componentDidMount() {\n // eslint-disable-next-line no-console\n // console.log(`LineWeightSwatchProps.componentDidMount setFocusRef=${this.props.setFocusRef} focusRef=${this.props.focusRef && this.props.focusRef.current ? \"set\" : \"unset\"}`);\n }\n\n public override render() {\n const {\n onClick, colorDef, weight, hideLabel, className, // do not pass on color swatch specific props\n // eslint-disable-next-line comma-dangle\n disabled, readonly, ...otherProps // pass-through props\n } = this.props;\n\n let rgbaString = \"\";\n\n if (colorDef) {\n rgbaString = getCSSColorFromDef(colorDef);\n }\n\n const buttonStyle: React.CSSProperties = colorDef ?\n {\n ...this.props.style,\n color: rgbaString,\n } :\n {\n ...this.props.style,\n };\n\n const svgStyle: React.CSSProperties = colorDef ?\n {\n height: `${weight}px`,\n background: rgbaString,\n } :\n {\n height: `${weight}px`,\n };\n\n const handleClick = (_e: React.MouseEvent) => {\n // istanbul ignore else\n if (onClick)\n onClick();\n };\n\n const classes = classnames(\n \"components-lineweight-swatch\",\n hideLabel && \"hide-label\",\n readonly && \"readonly\",\n className,\n );\n\n return (\n <button {...otherProps} style={buttonStyle} className={classes} onClick={handleClick} disabled={disabled}>\n {!hideLabel && <span>{weight.toFixed(0)}</span>}\n <div style={svgStyle} />\n </button>\n );\n }\n}\n"]}
@@ -1,48 +1,48 @@
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
- @import "~@itwin/core-react/lib/cjs/core-react/style/themecolors";
6
-
7
- .components-lineweight-swatch {
8
- font-size: var(--iui-font-size-1);
9
- color: var(--iui-color-text);
10
- border: none;
11
- background: inherit;
12
- width: 100%;
13
- display: flex;
14
- flex-direction: row;
15
- align-items: center;
16
- padding: 3px 15px 3px 0;
17
- min-height: 22px;
18
- box-sizing: border-box;
19
-
20
- // remove inner focus ring that is specific to Firefox.
21
- &::-moz-focus-inner {
22
- border: 0px;
23
- }
24
-
25
- &:focus {
26
- outline: 1px solid $buic-row-selection;
27
- }
28
-
29
- &[disabled] {
30
- opacity: 0.2;
31
- cursor: default;
32
- }
33
-
34
- > span {
35
- width: 1.5em;
36
- text-align: right;
37
- }
38
-
39
- > div {
40
- flex: 1;
41
- background: $buic-foreground-body;
42
- margin-left: 15px;
43
- }
44
- }
45
-
46
- .components-lineweight-swatch.hide-label > span {
47
- display: none;
48
- }
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
+ @import "~@itwin/core-react/lib/cjs/core-react/style/themecolors";
6
+
7
+ .components-lineweight-swatch {
8
+ font-size: var(--iui-font-size-1);
9
+ color: var(--iui-color-text);
10
+ border: none;
11
+ background: inherit;
12
+ width: 100%;
13
+ display: flex;
14
+ flex-direction: row;
15
+ align-items: center;
16
+ padding: 3px 15px 3px 0;
17
+ min-height: 22px;
18
+ box-sizing: border-box;
19
+
20
+ // remove inner focus ring that is specific to Firefox.
21
+ &::-moz-focus-inner {
22
+ border: 0px;
23
+ }
24
+
25
+ &:focus {
26
+ outline: 1px solid $buic-row-selection;
27
+ }
28
+
29
+ &[disabled] {
30
+ opacity: 0.2;
31
+ cursor: default;
32
+ }
33
+
34
+ > span {
35
+ width: 1.5em;
36
+ text-align: right;
37
+ }
38
+
39
+ > div {
40
+ flex: 1;
41
+ background: $buic-foreground-body;
42
+ margin-left: 15px;
43
+ }
44
+ }
45
+
46
+ .components-lineweight-swatch.hide-label > span {
47
+ display: none;
48
+ }
@@ -3,8 +3,8 @@
3
3
  */
4
4
  import "./WeightPickerButton.scss";
5
5
  import * as React from "react";
6
- import { ColorDef } from "@itwin/core-common";
7
- import { CommonProps } from "@itwin/core-react";
6
+ import type { ColorDef } from "@itwin/core-common";
7
+ import type { CommonProps } from "@itwin/core-react";
8
8
  /** Properties for the [[WeightPickerButton]] React component
9
9
  * @public
10
10
  */
@@ -1 +1 @@
1
- {"version":3,"file":"WeightPickerButton.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/lineweight/WeightPickerButton.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,2BAA2B,CAAC;AAEnC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAgC,MAAM,mBAAmB,CAAC;AAK9E;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,WAAW;IACnG,oBAAoB;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,wBAAwB;IACxB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,sDAAsD;IACtD,gBAAgB,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAC1D,sBAAsB;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sBAAsB;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4BAA4B;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,uCAAuC;IACvC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,gBAAgB;AAChB,UAAU,iBAAiB;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,cAAc,GAAG,IAAI,CAAC;CACtC;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,KAAK,CAAC,aAAa,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAC/F,OAAO,CAAC,OAAO,CAAqC;IACpD,OAAO,CAAC,iBAAiB,CAA+B;IACxD,OAAO,CAAC,YAAY,CAAwC;IAE5D,gBAAgB;gBACJ,KAAK,EAAE,iBAAiB;IAM7B,QAAQ,IAAI,IAAI;IAKvB,OAAc,YAAY;;MAExB;IAEF,OAAO,CAAC,YAAY,CAIlB;IAEF,OAAO,CAAC,cAAc,CACpB;IAEF,OAAO,CAAC,WAAW,CAEjB;IAEF,OAAO,CAAC,mBAAmB,CAGzB;IAEc,iBAAiB;IAMjC,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,gBAAgB;IA2BxB,OAAO,CAAC,cAAc,CAgCpB;IAEF,OAAO,CAAC,mBAAmB,CAEzB;IAEF,OAAO,CAAC,WAAW;IA0BnB,gBAAgB;IACA,MAAM;CA4CvB"}
1
+ {"version":3,"file":"WeightPickerButton.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/lineweight/WeightPickerButton.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,2BAA2B,CAAC;AAEnC,OAAO,KAAK,KAA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