@itwin/imodel-components-react 3.5.0-dev.66 → 3.5.0-dev.67

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 (342) hide show
  1. package/lib/cjs/imodel-components-react/UiIModelComponents.d.ts +28 -28
  2. package/lib/cjs/imodel-components-react/UiIModelComponents.js +79 -79
  3. package/lib/cjs/imodel-components-react/UiIModelComponents.js.map +1 -1
  4. package/lib/cjs/imodel-components-react/color/AlphaSlider.d.ts +36 -36
  5. package/lib/cjs/imodel-components-react/color/AlphaSlider.js +186 -186
  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 +37 -37
  9. package/lib/cjs/imodel-components-react/color/ColorPickerButton.js +107 -107
  10. package/lib/cjs/imodel-components-react/color/ColorPickerButton.js.map +1 -1
  11. package/lib/cjs/imodel-components-react/color/ColorPickerButton.scss +91 -91
  12. package/lib/cjs/imodel-components-react/color/ColorPickerDialog.d.ts +23 -23
  13. package/lib/cjs/imodel-components-react/color/ColorPickerDialog.js +74 -74
  14. package/lib/cjs/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
  15. package/lib/cjs/imodel-components-react/color/ColorPickerPanel.d.ts +21 -21
  16. package/lib/cjs/imodel-components-react/color/ColorPickerPanel.js +145 -145
  17. package/lib/cjs/imodel-components-react/color/ColorPickerPanel.js.map +1 -1
  18. package/lib/cjs/imodel-components-react/color/ColorPickerPanel.scss +93 -93
  19. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.d.ts +44 -44
  20. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.js +137 -137
  21. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
  22. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.scss +64 -64
  23. package/lib/cjs/imodel-components-react/color/HueSlider.d.ts +22 -22
  24. package/lib/cjs/imodel-components-react/color/HueSlider.js +199 -199
  25. package/lib/cjs/imodel-components-react/color/HueSlider.js.map +1 -1
  26. package/lib/cjs/imodel-components-react/color/HueSlider.scss +61 -61
  27. package/lib/cjs/imodel-components-react/color/SaturationPicker.d.ts +20 -20
  28. package/lib/cjs/imodel-components-react/color/SaturationPicker.js +213 -213
  29. package/lib/cjs/imodel-components-react/color/SaturationPicker.js.map +1 -1
  30. package/lib/cjs/imodel-components-react/color/SaturationPicker.scss +35 -35
  31. package/lib/cjs/imodel-components-react/color/Swatch.d.ts +22 -22
  32. package/lib/cjs/imodel-components-react/color/Swatch.js +60 -60
  33. package/lib/cjs/imodel-components-react/color/Swatch.js.map +1 -1
  34. package/lib/cjs/imodel-components-react/color/Swatch.scss +23 -23
  35. package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.d.ts +6 -6
  36. package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.js +23 -23
  37. package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.js.map +1 -1
  38. package/lib/cjs/imodel-components-react/editors/ColorEditor.d.ts +44 -44
  39. package/lib/cjs/imodel-components-react/editors/ColorEditor.js +151 -151
  40. package/lib/cjs/imodel-components-react/editors/ColorEditor.js.map +1 -1
  41. package/lib/cjs/imodel-components-react/editors/ColorEditor.scss +18 -18
  42. package/lib/cjs/imodel-components-react/editors/WeightEditor.d.ts +47 -47
  43. package/lib/cjs/imodel-components-react/editors/WeightEditor.js +160 -160
  44. package/lib/cjs/imodel-components-react/editors/WeightEditor.js.map +1 -1
  45. package/lib/cjs/imodel-components-react/editors/WeightEditor.scss +16 -16
  46. package/lib/cjs/imodel-components-react/inputs/QuantityInput.d.ts +25 -25
  47. package/lib/cjs/imodel-components-react/inputs/QuantityInput.js +96 -96
  48. package/lib/cjs/imodel-components-react/inputs/QuantityInput.js.map +1 -1
  49. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.d.ts +44 -44
  50. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js +265 -265
  51. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
  52. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.scss +107 -107
  53. package/lib/cjs/imodel-components-react/lineweight/Swatch.d.ts +33 -33
  54. package/lib/cjs/imodel-components-react/lineweight/Swatch.js +85 -85
  55. package/lib/cjs/imodel-components-react/lineweight/Swatch.js.map +1 -1
  56. package/lib/cjs/imodel-components-react/lineweight/Swatch.scss +48 -48
  57. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.d.ts +60 -60
  58. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.js +159 -159
  59. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
  60. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.scss +52 -52
  61. package/lib/cjs/imodel-components-react/navigationaids/Cube.d.ts +45 -45
  62. package/lib/cjs/imodel-components-react/navigationaids/Cube.js +127 -127
  63. package/lib/cjs/imodel-components-react/navigationaids/Cube.js.map +1 -1
  64. package/lib/cjs/imodel-components-react/navigationaids/Cube.scss +19 -19
  65. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.d.ts +174 -174
  66. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js +634 -634
  67. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
  68. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.scss +180 -180
  69. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts +145 -145
  70. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.js +647 -647
  71. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
  72. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.scss +133 -133
  73. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.d.ts +26 -26
  74. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js +99 -99
  75. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
  76. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.scss +64 -64
  77. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.d.ts +17 -17
  78. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js +53 -53
  79. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
  80. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.d.ts +18 -18
  81. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js +83 -83
  82. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
  83. package/lib/cjs/imodel-components-react/quantityformat/FormatType.d.ts +17 -17
  84. package/lib/cjs/imodel-components-react/quantityformat/FormatType.js +86 -86
  85. package/lib/cjs/imodel-components-react/quantityformat/FormatType.js.map +1 -1
  86. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.d.ts +17 -17
  87. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js +109 -109
  88. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
  89. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.d.ts +19 -19
  90. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js +133 -133
  91. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
  92. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.d.ts +21 -21
  93. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js +184 -184
  94. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
  95. package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts +22 -22
  96. package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.js +154 -154
  97. package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.js.map +1 -1
  98. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.d.ts +17 -17
  99. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.js +59 -59
  100. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.js.map +1 -1
  101. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.d.ts +17 -17
  102. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.js +47 -47
  103. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.js.map +1 -1
  104. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.d.ts +16 -16
  105. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.js +54 -54
  106. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.js.map +1 -1
  107. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.d.ts +18 -18
  108. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.js +48 -48
  109. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.js.map +1 -1
  110. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.d.ts +17 -17
  111. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.js +50 -50
  112. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.js.map +1 -1
  113. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.d.ts +17 -17
  114. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js +58 -58
  115. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js.map +1 -1
  116. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.d.ts +17 -17
  117. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.js +47 -47
  118. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.js.map +1 -1
  119. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.d.ts +17 -17
  120. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.js +56 -56
  121. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.js.map +1 -1
  122. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts +17 -17
  123. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +95 -95
  124. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
  125. package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.d.ts +23 -23
  126. package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.js +119 -119
  127. package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.js.map +1 -1
  128. package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.d.ts +52 -52
  129. package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.js +143 -143
  130. package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.js.map +1 -1
  131. package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.d.ts +31 -31
  132. package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.js +69 -69
  133. package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.js.map +1 -1
  134. package/lib/cjs/imodel-components-react/timeline/InlineEdit.d.ts +27 -27
  135. package/lib/cjs/imodel-components-react/timeline/InlineEdit.js +81 -81
  136. package/lib/cjs/imodel-components-react/timeline/InlineEdit.js.map +1 -1
  137. package/lib/cjs/imodel-components-react/timeline/InlineEdit.scss +26 -26
  138. package/lib/cjs/imodel-components-react/timeline/PlayerButton.d.ts +33 -33
  139. package/lib/cjs/imodel-components-react/timeline/PlayerButton.js +91 -91
  140. package/lib/cjs/imodel-components-react/timeline/PlayerButton.js.map +1 -1
  141. package/lib/cjs/imodel-components-react/timeline/PlayerButton.scss +25 -25
  142. package/lib/cjs/imodel-components-react/timeline/Scrubber.d.ts +54 -54
  143. package/lib/cjs/imodel-components-react/timeline/Scrubber.js +191 -191
  144. package/lib/cjs/imodel-components-react/timeline/Scrubber.js.map +1 -1
  145. package/lib/cjs/imodel-components-react/timeline/Scrubber.scss +106 -106
  146. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.d.ts +77 -77
  147. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.js +424 -424
  148. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
  149. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.scss +357 -357
  150. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.d.ts +15 -15
  151. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.js +54 -54
  152. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.js.map +1 -1
  153. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.scss +39 -39
  154. package/lib/cjs/imodel-components-react/timeline/Timeline.scss +164 -164
  155. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.d.ts +133 -133
  156. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js +358 -358
  157. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
  158. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.scss +163 -163
  159. package/lib/cjs/imodel-components-react/timeline/interfaces.d.ts +174 -174
  160. package/lib/cjs/imodel-components-react/timeline/interfaces.js +45 -45
  161. package/lib/cjs/imodel-components-react/timeline/interfaces.js.map +1 -1
  162. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.d.ts +42 -42
  163. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js +274 -274
  164. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
  165. package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.d.ts +106 -106
  166. package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.js +105 -105
  167. package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.js.map +1 -1
  168. package/lib/cjs/imodel-components-react.d.ts +82 -82
  169. package/lib/cjs/imodel-components-react.js +101 -101
  170. package/lib/cjs/imodel-components-react.js.map +1 -1
  171. package/lib/esm/imodel-components-react/UiIModelComponents.d.ts +28 -28
  172. package/lib/esm/imodel-components-react/UiIModelComponents.js +75 -75
  173. package/lib/esm/imodel-components-react/UiIModelComponents.js.map +1 -1
  174. package/lib/esm/imodel-components-react/color/AlphaSlider.d.ts +36 -36
  175. package/lib/esm/imodel-components-react/color/AlphaSlider.js +160 -160
  176. package/lib/esm/imodel-components-react/color/AlphaSlider.js.map +1 -1
  177. package/lib/esm/imodel-components-react/color/AlphaSlider.scss +63 -63
  178. package/lib/esm/imodel-components-react/color/ColorPickerButton.d.ts +37 -37
  179. package/lib/esm/imodel-components-react/color/ColorPickerButton.js +82 -82
  180. package/lib/esm/imodel-components-react/color/ColorPickerButton.js.map +1 -1
  181. package/lib/esm/imodel-components-react/color/ColorPickerButton.scss +91 -91
  182. package/lib/esm/imodel-components-react/color/ColorPickerDialog.d.ts +23 -23
  183. package/lib/esm/imodel-components-react/color/ColorPickerDialog.js +51 -51
  184. package/lib/esm/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
  185. package/lib/esm/imodel-components-react/color/ColorPickerPanel.d.ts +21 -21
  186. package/lib/esm/imodel-components-react/color/ColorPickerPanel.js +122 -122
  187. package/lib/esm/imodel-components-react/color/ColorPickerPanel.js.map +1 -1
  188. package/lib/esm/imodel-components-react/color/ColorPickerPanel.scss +93 -93
  189. package/lib/esm/imodel-components-react/color/ColorPickerPopup.d.ts +44 -44
  190. package/lib/esm/imodel-components-react/color/ColorPickerPopup.js +112 -112
  191. package/lib/esm/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
  192. package/lib/esm/imodel-components-react/color/ColorPickerPopup.scss +64 -64
  193. package/lib/esm/imodel-components-react/color/HueSlider.d.ts +22 -22
  194. package/lib/esm/imodel-components-react/color/HueSlider.js +173 -173
  195. package/lib/esm/imodel-components-react/color/HueSlider.js.map +1 -1
  196. package/lib/esm/imodel-components-react/color/HueSlider.scss +61 -61
  197. package/lib/esm/imodel-components-react/color/SaturationPicker.d.ts +20 -20
  198. package/lib/esm/imodel-components-react/color/SaturationPicker.js +187 -187
  199. package/lib/esm/imodel-components-react/color/SaturationPicker.js.map +1 -1
  200. package/lib/esm/imodel-components-react/color/SaturationPicker.scss +35 -35
  201. package/lib/esm/imodel-components-react/color/Swatch.d.ts +22 -22
  202. package/lib/esm/imodel-components-react/color/Swatch.js +34 -34
  203. package/lib/esm/imodel-components-react/color/Swatch.js.map +1 -1
  204. package/lib/esm/imodel-components-react/color/Swatch.scss +23 -23
  205. package/lib/esm/imodel-components-react/color/getCSSColorFromDef.d.ts +6 -6
  206. package/lib/esm/imodel-components-react/color/getCSSColorFromDef.js +19 -19
  207. package/lib/esm/imodel-components-react/color/getCSSColorFromDef.js.map +1 -1
  208. package/lib/esm/imodel-components-react/editors/ColorEditor.d.ts +44 -44
  209. package/lib/esm/imodel-components-react/editors/ColorEditor.js +124 -124
  210. package/lib/esm/imodel-components-react/editors/ColorEditor.js.map +1 -1
  211. package/lib/esm/imodel-components-react/editors/ColorEditor.scss +18 -18
  212. package/lib/esm/imodel-components-react/editors/WeightEditor.d.ts +47 -47
  213. package/lib/esm/imodel-components-react/editors/WeightEditor.js +133 -133
  214. package/lib/esm/imodel-components-react/editors/WeightEditor.js.map +1 -1
  215. package/lib/esm/imodel-components-react/editors/WeightEditor.scss +16 -16
  216. package/lib/esm/imodel-components-react/inputs/QuantityInput.d.ts +25 -25
  217. package/lib/esm/imodel-components-react/inputs/QuantityInput.js +70 -70
  218. package/lib/esm/imodel-components-react/inputs/QuantityInput.js.map +1 -1
  219. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.d.ts +44 -44
  220. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js +240 -240
  221. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
  222. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.scss +107 -107
  223. package/lib/esm/imodel-components-react/lineweight/Swatch.d.ts +33 -33
  224. package/lib/esm/imodel-components-react/lineweight/Swatch.js +59 -59
  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 +60 -60
  228. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.js +133 -133
  229. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
  230. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.scss +52 -52
  231. package/lib/esm/imodel-components-react/navigationaids/Cube.d.ts +45 -45
  232. package/lib/esm/imodel-components-react/navigationaids/Cube.js +100 -100
  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 +174 -174
  236. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js +606 -606
  237. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
  238. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.scss +180 -180
  239. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts +145 -145
  240. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.js +620 -620
  241. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
  242. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.scss +133 -133
  243. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.d.ts +26 -26
  244. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js +76 -76
  245. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
  246. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.scss +64 -64
  247. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.d.ts +17 -17
  248. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js +30 -30
  249. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
  250. package/lib/esm/imodel-components-react/quantityformat/FormatSample.d.ts +18 -18
  251. package/lib/esm/imodel-components-react/quantityformat/FormatSample.js +60 -60
  252. package/lib/esm/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
  253. package/lib/esm/imodel-components-react/quantityformat/FormatType.d.ts +17 -17
  254. package/lib/esm/imodel-components-react/quantityformat/FormatType.js +63 -63
  255. package/lib/esm/imodel-components-react/quantityformat/FormatType.js.map +1 -1
  256. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.d.ts +17 -17
  257. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js +83 -83
  258. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
  259. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.d.ts +19 -19
  260. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js +110 -110
  261. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
  262. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.d.ts +21 -21
  263. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js +158 -158
  264. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
  265. package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts +22 -22
  266. package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.js +131 -131
  267. package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.js.map +1 -1
  268. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.d.ts +17 -17
  269. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.js +36 -36
  270. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.js.map +1 -1
  271. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.d.ts +17 -17
  272. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.js +24 -24
  273. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.js.map +1 -1
  274. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.d.ts +16 -16
  275. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.js +31 -31
  276. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.js.map +1 -1
  277. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.d.ts +18 -18
  278. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.js +25 -25
  279. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.js.map +1 -1
  280. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.d.ts +17 -17
  281. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.js +27 -27
  282. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.js.map +1 -1
  283. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.d.ts +17 -17
  284. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js +35 -35
  285. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js.map +1 -1
  286. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.d.ts +17 -17
  287. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.js +24 -24
  288. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.js.map +1 -1
  289. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.d.ts +17 -17
  290. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.js +33 -33
  291. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.js.map +1 -1
  292. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts +17 -17
  293. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +69 -69
  294. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
  295. package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.d.ts +23 -23
  296. package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.js +96 -96
  297. package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.js.map +1 -1
  298. package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.d.ts +52 -52
  299. package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.js +139 -139
  300. package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.js.map +1 -1
  301. package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.d.ts +31 -31
  302. package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.js +65 -65
  303. package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.js.map +1 -1
  304. package/lib/esm/imodel-components-react/timeline/InlineEdit.d.ts +27 -27
  305. package/lib/esm/imodel-components-react/timeline/InlineEdit.js +55 -55
  306. package/lib/esm/imodel-components-react/timeline/InlineEdit.js.map +1 -1
  307. package/lib/esm/imodel-components-react/timeline/InlineEdit.scss +26 -26
  308. package/lib/esm/imodel-components-react/timeline/PlayerButton.d.ts +33 -33
  309. package/lib/esm/imodel-components-react/timeline/PlayerButton.js +64 -64
  310. package/lib/esm/imodel-components-react/timeline/PlayerButton.js.map +1 -1
  311. package/lib/esm/imodel-components-react/timeline/PlayerButton.scss +25 -25
  312. package/lib/esm/imodel-components-react/timeline/Scrubber.d.ts +54 -54
  313. package/lib/esm/imodel-components-react/timeline/Scrubber.js +164 -164
  314. package/lib/esm/imodel-components-react/timeline/Scrubber.js.map +1 -1
  315. package/lib/esm/imodel-components-react/timeline/Scrubber.scss +106 -106
  316. package/lib/esm/imodel-components-react/timeline/SolarTimeline.d.ts +77 -77
  317. package/lib/esm/imodel-components-react/timeline/SolarTimeline.js +398 -398
  318. package/lib/esm/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
  319. package/lib/esm/imodel-components-react/timeline/SolarTimeline.scss +357 -357
  320. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.d.ts +15 -15
  321. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.js +28 -28
  322. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.js.map +1 -1
  323. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.scss +39 -39
  324. package/lib/esm/imodel-components-react/timeline/Timeline.scss +164 -164
  325. package/lib/esm/imodel-components-react/timeline/TimelineComponent.d.ts +133 -133
  326. package/lib/esm/imodel-components-react/timeline/TimelineComponent.js +332 -332
  327. package/lib/esm/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
  328. package/lib/esm/imodel-components-react/timeline/TimelineComponent.scss +163 -163
  329. package/lib/esm/imodel-components-react/timeline/interfaces.d.ts +174 -174
  330. package/lib/esm/imodel-components-react/timeline/interfaces.js +42 -42
  331. package/lib/esm/imodel-components-react/timeline/interfaces.js.map +1 -1
  332. package/lib/esm/imodel-components-react/viewport/ViewportComponent.d.ts +42 -42
  333. package/lib/esm/imodel-components-react/viewport/ViewportComponent.js +251 -251
  334. package/lib/esm/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
  335. package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.d.ts +106 -106
  336. package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.js +95 -95
  337. package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.js.map +1 -1
  338. package/lib/esm/imodel-components-react.d.ts +82 -82
  339. package/lib/esm/imodel-components-react.js +87 -87
  340. package/lib/esm/imodel-components-react.js.map +1 -1
  341. package/lib/public/locales/en/UiIModelComponents.json +139 -139
  342. package/package.json +19 -19
@@ -1,159 +1,159 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- /** @packageDocumentation
6
- * @module QuantityFormat
7
- */
8
- import classnames from "classnames";
9
- import * as React from "react";
10
- import { SpecialKey } from "@itwin/appui-abstract";
11
- import { Checkbox } from "@itwin/itwinui-react";
12
- import { Format, FormatTraits, FormatType, getTraitString, parseFormatType, parseScientificType, parseShowSignOption, ScientificType, scientificTypeToString, showSignOptionToString, } from "@itwin/core-quantity";
13
- import { SignOptionSelector } from "./misc/SignOption";
14
- import { ThousandsSeparator } from "./misc/ThousandsSeparator";
15
- import { DecimalSeparatorSelector } from "./misc/DecimalSeparator";
16
- import { ScientificTypeSelector } from "./misc/ScientificType";
17
- import { StationSeparatorSelector } from "./misc/StationSeparatorSelector";
18
- import { StationSizeSelector } from "./misc/StationSizeSelector";
19
- import { UiIModelComponents } from "../UiIModelComponents";
20
- /** Component use to set miscellaneous properties is a Formatted Quantity.
21
- * @alpha
22
- */
23
- export function MiscFormatOptions(props) {
24
- var _a, _b;
25
- const { formatProps, onChange, showOptions, onShowHideOptions, enableMinimumProperties } = props;
26
- const handleSetFormatProps = React.useCallback((newFormatProps) => {
27
- onChange && onChange(newFormatProps);
28
- }, [onChange]);
29
- const isFormatTraitSet = React.useCallback((trait) => {
30
- return Format.isFormatTraitSetInProps(formatProps, trait);
31
- }, [formatProps]);
32
- const handleShowSignChange = React.useCallback((option) => {
33
- const newShowSignOption = showSignOptionToString(option);
34
- const newFormatProps = { ...formatProps, showSignOption: newShowSignOption };
35
- handleSetFormatProps(newFormatProps);
36
- }, [formatProps, handleSetFormatProps]);
37
- const setFormatTrait = React.useCallback((trait, setActive) => {
38
- const traitStr = getTraitString(trait);
39
- let formatTraits = [traitStr];
40
- if (setActive) { // setting trait
41
- // istanbul ignore else
42
- if (formatProps.formatTraits) {
43
- const traits = Array.isArray(formatProps.formatTraits) ? formatProps.formatTraits : /* istanbul ignore next */ formatProps.formatTraits.split(/,|;|\|/);
44
- // istanbul ignore else
45
- if (!traits.find((traitEntry) => traitStr === traitEntry)) {
46
- formatTraits = [...traits, traitStr];
47
- }
48
- }
49
- }
50
- else { // clearing trait
51
- // istanbul ignore next
52
- if (!formatProps.formatTraits)
53
- return;
54
- const traits = Array.isArray(formatProps.formatTraits) ? formatProps.formatTraits : /* istanbul ignore next */ formatProps.formatTraits.split(/,|;|\|/);
55
- formatTraits = traits.filter((traitEntry) => traitEntry !== traitStr);
56
- }
57
- const newFormatProps = { ...formatProps, formatTraits };
58
- handleSetFormatProps(newFormatProps);
59
- }, [formatProps, handleSetFormatProps]);
60
- const handleShowTrailingZeroesChange = React.useCallback((e) => {
61
- setFormatTrait(FormatTraits.TrailZeroes, e.target.checked);
62
- }, [setFormatTrait]);
63
- const handleKeepDecimalPointChange = React.useCallback((e) => {
64
- setFormatTrait(FormatTraits.KeepDecimalPoint, e.target.checked);
65
- }, [setFormatTrait]);
66
- const handleKeepSingleZeroChange = React.useCallback((e) => {
67
- setFormatTrait(FormatTraits.KeepSingleZero, e.target.checked);
68
- }, [setFormatTrait]);
69
- const handleZeroEmptyChange = React.useCallback((e) => {
70
- setFormatTrait(FormatTraits.ZeroEmpty, e.target.checked);
71
- }, [setFormatTrait]);
72
- const handleUseFractionDashChange = React.useCallback((e) => {
73
- setFormatTrait(FormatTraits.FractionDash, e.target.checked);
74
- }, [setFormatTrait]);
75
- const handleDecimalSeparatorChange = React.useCallback((decimalSeparator) => {
76
- let thousandSeparator = formatProps.thousandSeparator;
77
- // make sure 1000 and decimal separator do not match
78
- // istanbul ignore else
79
- if (isFormatTraitSet(FormatTraits.Use1000Separator)) {
80
- switch (decimalSeparator) {
81
- case ".":
82
- thousandSeparator = ",";
83
- break;
84
- case ",":
85
- thousandSeparator = ".";
86
- break;
87
- }
88
- }
89
- const newFormatProps = { ...formatProps, thousandSeparator, decimalSeparator };
90
- handleSetFormatProps(newFormatProps);
91
- }, [formatProps, isFormatTraitSet, handleSetFormatProps]);
92
- const handleScientificTypeChange = React.useCallback((type) => {
93
- const newFormatProps = { ...formatProps, scientificType: scientificTypeToString(type) };
94
- handleSetFormatProps(newFormatProps);
95
- }, [formatProps, handleSetFormatProps]);
96
- const handleFormatChange = React.useCallback((newFormatProps) => {
97
- handleSetFormatProps(newFormatProps);
98
- }, [handleSetFormatProps]);
99
- const formatType = React.useMemo(() => parseFormatType(formatProps.type, "format"), [formatProps.type]);
100
- const showSignOption = React.useMemo(() => { var _a; return parseShowSignOption((_a = formatProps.showSignOption) !== null && _a !== void 0 ? _a : "onlyNegative", "format"); }, [formatProps.showSignOption]);
101
- const handleToggleButtonClick = React.useCallback(() => {
102
- onShowHideOptions(!showOptions);
103
- }, [onShowHideOptions, showOptions]);
104
- const handleKeyUpOnLink = React.useCallback((e) => {
105
- // istanbul ignore else
106
- if (e.key === SpecialKey.Enter || e.key === SpecialKey.Space) {
107
- onShowHideOptions(!showOptions);
108
- e.preventDefault();
109
- }
110
- }, [onShowHideOptions, showOptions]);
111
- const handleStationSeparatorChange = React.useCallback((value) => {
112
- const newFormatProps = { ...formatProps, stationSeparator: value };
113
- handleSetFormatProps(newFormatProps);
114
- }, [formatProps, handleSetFormatProps]);
115
- const handleStationOffsetChange = React.useCallback((value) => {
116
- const newFormatProps = { ...formatProps, stationOffsetSize: value };
117
- handleSetFormatProps(newFormatProps);
118
- }, [formatProps, handleSetFormatProps]);
119
- const signOptionLabel = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.signOptionLabel"));
120
- const stationOffsetLabel = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.stationOffsetLabel"));
121
- const stationSeparatorLabel = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.stationSeparatorLabel"));
122
- const decimalSeparatorLabel = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.decimalSeparatorLabel"));
123
- const showTrailZerosLabel = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.showTrailZerosLabel"));
124
- const keepSingleZeroLabel = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.keepSingleZeroLabel"));
125
- const zeroEmptyLabel = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.zeroEmptyLabel"));
126
- const moreLabel = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.moreLabel"));
127
- const lessLabel = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.lessLabel"));
128
- const keepDecimalPointLabel = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.keepDecimalPointLabel"));
129
- const fractionDashLabel = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.fractionDashLabel"));
130
- const scientificTypeLabel = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.scientificTypeLabel"));
131
- return (React.createElement(React.Fragment, null,
132
- enableMinimumProperties && !showOptions && React.createElement("a", { onClick: handleToggleButtonClick, onKeyUp: handleKeyUpOnLink, className: "components-quantityFormat-more-less", role: "link", "data-testid": "quantityFormat-more", tabIndex: 0 }, moreLabel.current),
133
- (!enableMinimumProperties || showOptions) &&
134
- React.createElement(React.Fragment, null,
135
- React.createElement("span", { className: "uicore-label" }, signOptionLabel.current),
136
- React.createElement(SignOptionSelector, { "data-testid": "sign-option-selector", signOption: showSignOption, onChange: handleShowSignChange }),
137
- React.createElement("span", { className: classnames("uicore-label", formatType !== FormatType.Station && "uicore-disabled") }, stationOffsetLabel.current),
138
- React.createElement(StationSizeSelector, { "data-testid": "station-size-selector", value: ((_a = formatProps.stationOffsetSize) !== null && _a !== void 0 ? _a : 2), disabled: formatType !== FormatType.Station, onChange: handleStationOffsetChange }),
139
- React.createElement("span", { className: classnames("uicore-label", formatType !== FormatType.Station && "uicore-disabled") }, stationSeparatorLabel.current),
140
- React.createElement(StationSeparatorSelector, { "data-testid": "station-separator-selector", separator: (undefined !== formatProps.stationSeparator ? formatProps.stationSeparator : "+"), disabled: formatType !== FormatType.Station, onChange: handleStationSeparatorChange }),
141
- React.createElement(ThousandsSeparator, { formatProps: formatProps, onChange: handleFormatChange }),
142
- React.createElement("span", { className: classnames("uicore-label", formatType === FormatType.Fractional && "uicore-disabled") }, decimalSeparatorLabel.current),
143
- React.createElement(DecimalSeparatorSelector, { "data-testid": "decimal-separator-selector", separator: (_b = formatProps.decimalSeparator) !== null && _b !== void 0 ? _b : ".", onChange: handleDecimalSeparatorChange, disabled: formatType === FormatType.Fractional }),
144
- React.createElement("span", { className: "uicore-label" }, showTrailZerosLabel.current),
145
- React.createElement(Checkbox, { "data-testid": "show-trail-zeros", checked: isFormatTraitSet(FormatTraits.TrailZeroes), onChange: handleShowTrailingZeroesChange }),
146
- React.createElement("span", { className: classnames("uicore-label", formatType === FormatType.Fractional && "uicore-disabled") }, keepDecimalPointLabel.current),
147
- React.createElement(Checkbox, { "data-testid": "keep-decimal-point", checked: isFormatTraitSet(FormatTraits.KeepDecimalPoint), onChange: handleKeepDecimalPointChange }),
148
- React.createElement("span", { className: "uicore-label" }, keepSingleZeroLabel.current),
149
- React.createElement(Checkbox, { "data-testid": "keep-single-zero", checked: isFormatTraitSet(FormatTraits.KeepSingleZero), onChange: handleKeepSingleZeroChange }),
150
- React.createElement("span", { className: "uicore-label" }, zeroEmptyLabel.current),
151
- React.createElement(Checkbox, { "data-testid": "zero-empty", checked: isFormatTraitSet(FormatTraits.ZeroEmpty), onChange: handleZeroEmptyChange }),
152
- React.createElement("span", { className: classnames("uicore-label", formatType !== FormatType.Fractional && "uicore-disabled") }, fractionDashLabel.current),
153
- React.createElement(Checkbox, { "data-testid": "fraction-dash", checked: isFormatTraitSet(FormatTraits.FractionDash), onChange: handleUseFractionDashChange, disabled: formatType !== FormatType.Fractional }),
154
- React.createElement("span", { className: classnames("uicore-label", formatType !== FormatType.Scientific && "uicore-disabled") }, scientificTypeLabel.current),
155
- React.createElement(ScientificTypeSelector, { "data-testid": "scientific-type-selector", type: (formatProps.scientificType && formatProps.scientificType.length > 0) ? parseScientificType(formatProps.scientificType, "custom") : ScientificType.Normalized, disabled: formatType !== FormatType.Scientific, onChange: handleScientificTypeChange }),
156
- props.children,
157
- enableMinimumProperties && showOptions && React.createElement("a", { onClick: handleToggleButtonClick, onKeyUp: handleKeyUpOnLink, className: "components-quantityFormat-more-less", role: "link", "data-testid": "quantityFormat-less", tabIndex: 0 }, lessLabel.current))));
158
- }
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /** @packageDocumentation
6
+ * @module QuantityFormat
7
+ */
8
+ import classnames from "classnames";
9
+ import * as React from "react";
10
+ import { SpecialKey } from "@itwin/appui-abstract";
11
+ import { Checkbox } from "@itwin/itwinui-react";
12
+ import { Format, FormatTraits, FormatType, getTraitString, parseFormatType, parseScientificType, parseShowSignOption, ScientificType, scientificTypeToString, showSignOptionToString, } from "@itwin/core-quantity";
13
+ import { SignOptionSelector } from "./misc/SignOption";
14
+ import { ThousandsSeparator } from "./misc/ThousandsSeparator";
15
+ import { DecimalSeparatorSelector } from "./misc/DecimalSeparator";
16
+ import { ScientificTypeSelector } from "./misc/ScientificType";
17
+ import { StationSeparatorSelector } from "./misc/StationSeparatorSelector";
18
+ import { StationSizeSelector } from "./misc/StationSizeSelector";
19
+ import { UiIModelComponents } from "../UiIModelComponents";
20
+ /** Component use to set miscellaneous properties is a Formatted Quantity.
21
+ * @alpha
22
+ */
23
+ export function MiscFormatOptions(props) {
24
+ var _a, _b;
25
+ const { formatProps, onChange, showOptions, onShowHideOptions, enableMinimumProperties } = props;
26
+ const handleSetFormatProps = React.useCallback((newFormatProps) => {
27
+ onChange && onChange(newFormatProps);
28
+ }, [onChange]);
29
+ const isFormatTraitSet = React.useCallback((trait) => {
30
+ return Format.isFormatTraitSetInProps(formatProps, trait);
31
+ }, [formatProps]);
32
+ const handleShowSignChange = React.useCallback((option) => {
33
+ const newShowSignOption = showSignOptionToString(option);
34
+ const newFormatProps = { ...formatProps, showSignOption: newShowSignOption };
35
+ handleSetFormatProps(newFormatProps);
36
+ }, [formatProps, handleSetFormatProps]);
37
+ const setFormatTrait = React.useCallback((trait, setActive) => {
38
+ const traitStr = getTraitString(trait);
39
+ let formatTraits = [traitStr];
40
+ if (setActive) { // setting trait
41
+ // istanbul ignore else
42
+ if (formatProps.formatTraits) {
43
+ const traits = Array.isArray(formatProps.formatTraits) ? formatProps.formatTraits : /* istanbul ignore next */ formatProps.formatTraits.split(/,|;|\|/);
44
+ // istanbul ignore else
45
+ if (!traits.find((traitEntry) => traitStr === traitEntry)) {
46
+ formatTraits = [...traits, traitStr];
47
+ }
48
+ }
49
+ }
50
+ else { // clearing trait
51
+ // istanbul ignore next
52
+ if (!formatProps.formatTraits)
53
+ return;
54
+ const traits = Array.isArray(formatProps.formatTraits) ? formatProps.formatTraits : /* istanbul ignore next */ formatProps.formatTraits.split(/,|;|\|/);
55
+ formatTraits = traits.filter((traitEntry) => traitEntry !== traitStr);
56
+ }
57
+ const newFormatProps = { ...formatProps, formatTraits };
58
+ handleSetFormatProps(newFormatProps);
59
+ }, [formatProps, handleSetFormatProps]);
60
+ const handleShowTrailingZeroesChange = React.useCallback((e) => {
61
+ setFormatTrait(FormatTraits.TrailZeroes, e.target.checked);
62
+ }, [setFormatTrait]);
63
+ const handleKeepDecimalPointChange = React.useCallback((e) => {
64
+ setFormatTrait(FormatTraits.KeepDecimalPoint, e.target.checked);
65
+ }, [setFormatTrait]);
66
+ const handleKeepSingleZeroChange = React.useCallback((e) => {
67
+ setFormatTrait(FormatTraits.KeepSingleZero, e.target.checked);
68
+ }, [setFormatTrait]);
69
+ const handleZeroEmptyChange = React.useCallback((e) => {
70
+ setFormatTrait(FormatTraits.ZeroEmpty, e.target.checked);
71
+ }, [setFormatTrait]);
72
+ const handleUseFractionDashChange = React.useCallback((e) => {
73
+ setFormatTrait(FormatTraits.FractionDash, e.target.checked);
74
+ }, [setFormatTrait]);
75
+ const handleDecimalSeparatorChange = React.useCallback((decimalSeparator) => {
76
+ let thousandSeparator = formatProps.thousandSeparator;
77
+ // make sure 1000 and decimal separator do not match
78
+ // istanbul ignore else
79
+ if (isFormatTraitSet(FormatTraits.Use1000Separator)) {
80
+ switch (decimalSeparator) {
81
+ case ".":
82
+ thousandSeparator = ",";
83
+ break;
84
+ case ",":
85
+ thousandSeparator = ".";
86
+ break;
87
+ }
88
+ }
89
+ const newFormatProps = { ...formatProps, thousandSeparator, decimalSeparator };
90
+ handleSetFormatProps(newFormatProps);
91
+ }, [formatProps, isFormatTraitSet, handleSetFormatProps]);
92
+ const handleScientificTypeChange = React.useCallback((type) => {
93
+ const newFormatProps = { ...formatProps, scientificType: scientificTypeToString(type) };
94
+ handleSetFormatProps(newFormatProps);
95
+ }, [formatProps, handleSetFormatProps]);
96
+ const handleFormatChange = React.useCallback((newFormatProps) => {
97
+ handleSetFormatProps(newFormatProps);
98
+ }, [handleSetFormatProps]);
99
+ const formatType = React.useMemo(() => parseFormatType(formatProps.type, "format"), [formatProps.type]);
100
+ const showSignOption = React.useMemo(() => { var _a; return parseShowSignOption((_a = formatProps.showSignOption) !== null && _a !== void 0 ? _a : "onlyNegative", "format"); }, [formatProps.showSignOption]);
101
+ const handleToggleButtonClick = React.useCallback(() => {
102
+ onShowHideOptions(!showOptions);
103
+ }, [onShowHideOptions, showOptions]);
104
+ const handleKeyUpOnLink = React.useCallback((e) => {
105
+ // istanbul ignore else
106
+ if (e.key === SpecialKey.Enter || e.key === SpecialKey.Space) {
107
+ onShowHideOptions(!showOptions);
108
+ e.preventDefault();
109
+ }
110
+ }, [onShowHideOptions, showOptions]);
111
+ const handleStationSeparatorChange = React.useCallback((value) => {
112
+ const newFormatProps = { ...formatProps, stationSeparator: value };
113
+ handleSetFormatProps(newFormatProps);
114
+ }, [formatProps, handleSetFormatProps]);
115
+ const handleStationOffsetChange = React.useCallback((value) => {
116
+ const newFormatProps = { ...formatProps, stationOffsetSize: value };
117
+ handleSetFormatProps(newFormatProps);
118
+ }, [formatProps, handleSetFormatProps]);
119
+ const signOptionLabel = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.signOptionLabel"));
120
+ const stationOffsetLabel = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.stationOffsetLabel"));
121
+ const stationSeparatorLabel = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.stationSeparatorLabel"));
122
+ const decimalSeparatorLabel = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.decimalSeparatorLabel"));
123
+ const showTrailZerosLabel = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.showTrailZerosLabel"));
124
+ const keepSingleZeroLabel = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.keepSingleZeroLabel"));
125
+ const zeroEmptyLabel = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.zeroEmptyLabel"));
126
+ const moreLabel = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.moreLabel"));
127
+ const lessLabel = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.lessLabel"));
128
+ const keepDecimalPointLabel = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.keepDecimalPointLabel"));
129
+ const fractionDashLabel = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.fractionDashLabel"));
130
+ const scientificTypeLabel = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.scientificTypeLabel"));
131
+ return (React.createElement(React.Fragment, null,
132
+ enableMinimumProperties && !showOptions && React.createElement("a", { onClick: handleToggleButtonClick, onKeyUp: handleKeyUpOnLink, className: "components-quantityFormat-more-less", role: "link", "data-testid": "quantityFormat-more", tabIndex: 0 }, moreLabel.current),
133
+ (!enableMinimumProperties || showOptions) &&
134
+ React.createElement(React.Fragment, null,
135
+ React.createElement("span", { className: "uicore-label" }, signOptionLabel.current),
136
+ React.createElement(SignOptionSelector, { "data-testid": "sign-option-selector", signOption: showSignOption, onChange: handleShowSignChange }),
137
+ React.createElement("span", { className: classnames("uicore-label", formatType !== FormatType.Station && "uicore-disabled") }, stationOffsetLabel.current),
138
+ React.createElement(StationSizeSelector, { "data-testid": "station-size-selector", value: ((_a = formatProps.stationOffsetSize) !== null && _a !== void 0 ? _a : 2), disabled: formatType !== FormatType.Station, onChange: handleStationOffsetChange }),
139
+ React.createElement("span", { className: classnames("uicore-label", formatType !== FormatType.Station && "uicore-disabled") }, stationSeparatorLabel.current),
140
+ React.createElement(StationSeparatorSelector, { "data-testid": "station-separator-selector", separator: (undefined !== formatProps.stationSeparator ? formatProps.stationSeparator : "+"), disabled: formatType !== FormatType.Station, onChange: handleStationSeparatorChange }),
141
+ React.createElement(ThousandsSeparator, { formatProps: formatProps, onChange: handleFormatChange }),
142
+ React.createElement("span", { className: classnames("uicore-label", formatType === FormatType.Fractional && "uicore-disabled") }, decimalSeparatorLabel.current),
143
+ React.createElement(DecimalSeparatorSelector, { "data-testid": "decimal-separator-selector", separator: (_b = formatProps.decimalSeparator) !== null && _b !== void 0 ? _b : ".", onChange: handleDecimalSeparatorChange, disabled: formatType === FormatType.Fractional }),
144
+ React.createElement("span", { className: "uicore-label" }, showTrailZerosLabel.current),
145
+ React.createElement(Checkbox, { "data-testid": "show-trail-zeros", checked: isFormatTraitSet(FormatTraits.TrailZeroes), onChange: handleShowTrailingZeroesChange }),
146
+ React.createElement("span", { className: classnames("uicore-label", formatType === FormatType.Fractional && "uicore-disabled") }, keepDecimalPointLabel.current),
147
+ React.createElement(Checkbox, { "data-testid": "keep-decimal-point", checked: isFormatTraitSet(FormatTraits.KeepDecimalPoint), onChange: handleKeepDecimalPointChange }),
148
+ React.createElement("span", { className: "uicore-label" }, keepSingleZeroLabel.current),
149
+ React.createElement(Checkbox, { "data-testid": "keep-single-zero", checked: isFormatTraitSet(FormatTraits.KeepSingleZero), onChange: handleKeepSingleZeroChange }),
150
+ React.createElement("span", { className: "uicore-label" }, zeroEmptyLabel.current),
151
+ React.createElement(Checkbox, { "data-testid": "zero-empty", checked: isFormatTraitSet(FormatTraits.ZeroEmpty), onChange: handleZeroEmptyChange }),
152
+ React.createElement("span", { className: classnames("uicore-label", formatType !== FormatType.Fractional && "uicore-disabled") }, fractionDashLabel.current),
153
+ React.createElement(Checkbox, { "data-testid": "fraction-dash", checked: isFormatTraitSet(FormatTraits.FractionDash), onChange: handleUseFractionDashChange, disabled: formatType !== FormatType.Fractional }),
154
+ React.createElement("span", { className: classnames("uicore-label", formatType !== FormatType.Scientific && "uicore-disabled") }, scientificTypeLabel.current),
155
+ React.createElement(ScientificTypeSelector, { "data-testid": "scientific-type-selector", type: (formatProps.scientificType && formatProps.scientificType.length > 0) ? parseScientificType(formatProps.scientificType, "custom") : ScientificType.Normalized, disabled: formatType !== FormatType.Scientific, onChange: handleScientificTypeChange }),
156
+ props.children,
157
+ enableMinimumProperties && showOptions && React.createElement("a", { onClick: handleToggleButtonClick, onKeyUp: handleKeyUpOnLink, className: "components-quantityFormat-more-less", role: "link", "data-testid": "quantityFormat-less", tabIndex: 0 }, lessLabel.current))));
158
+ }
159
159
  //# sourceMappingURL=MiscFormatOptions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MiscFormatOptions.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/MiscFormatOptions.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAe,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,eAAe,EAAE,mBAAmB,EAC1G,mBAAmB,EAAE,cAAc,EAAE,sBAAsB,EAAkB,sBAAsB,GACpG,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAc3D;;GAEG;AACH,MAAM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U,EAChO,QAAQ,EAAE,UAAU,KAAK,UAAU,CAAC,UAAU,EAAE,QAAQ,EAAE,0BAA0B,GAAI;gBAEzF,KAAK,CAAC,QAAQ;gBAGb,uBAAuB,IAAI,WAAW,IAAI,2BAAG,OAAO,EAAE,uBAAuB,EAAE,OAAO,EAAE,iBAAiB,EACvG,SAAS,EAAE,qCAAqC,EAAE,IAAI,EAAC,MAAM,iBAAa,qBAAqB,EAAC,QAAQ,EAAE,CAAC,IAAG,SAAS,CAAC,OAAO,CAAK,CACvI,CAEJ,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module QuantityFormat\n */\n\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { SpecialKey } from \"@itwin/appui-abstract\";\nimport { CommonProps } from \"@itwin/core-react\";\nimport { Checkbox } from \"@itwin/itwinui-react\";\nimport { Format, FormatProps, FormatTraits, FormatType, getTraitString, parseFormatType, parseScientificType,\n parseShowSignOption, ScientificType, scientificTypeToString, ShowSignOption, showSignOptionToString,\n} from \"@itwin/core-quantity\";\nimport { SignOptionSelector } from \"./misc/SignOption\";\nimport { ThousandsSeparator } from \"./misc/ThousandsSeparator\";\nimport { DecimalSeparatorSelector } from \"./misc/DecimalSeparator\";\nimport { ScientificTypeSelector } from \"./misc/ScientificType\";\nimport { StationSeparatorSelector } from \"./misc/StationSeparatorSelector\";\nimport { StationSizeSelector } from \"./misc/StationSizeSelector\";\nimport { UiIModelComponents } from \"../UiIModelComponents\";\n\n/** Properties of [[MiscFormatOptions]] component.\n * @alpha\n */\nexport interface MiscFormatOptionsProps extends CommonProps {\n formatProps: FormatProps;\n onChange?: (format: FormatProps) => void;\n enableMinimumProperties?: boolean;\n showOptions: boolean;\n onShowHideOptions: (show: boolean) => void;\n children?: React.ReactNode;\n}\n\n/** Component use to set miscellaneous properties is a Formatted Quantity.\n * @alpha\n */\nexport function MiscFormatOptions(props: MiscFormatOptionsProps) {\n const { formatProps, onChange, showOptions, onShowHideOptions, enableMinimumProperties } = props;\n\n const handleSetFormatProps = React.useCallback((newFormatProps: FormatProps) => {\n onChange && onChange(newFormatProps);\n }, [onChange]);\n\n const isFormatTraitSet = React.useCallback((trait: FormatTraits) => {\n return Format.isFormatTraitSetInProps(formatProps, trait);\n }, [formatProps]);\n\n const handleShowSignChange = React.useCallback((option: ShowSignOption) => {\n const newShowSignOption = showSignOptionToString(option);\n const newFormatProps = { ...formatProps, showSignOption: newShowSignOption };\n handleSetFormatProps(newFormatProps);\n }, [formatProps, handleSetFormatProps]);\n\n const setFormatTrait = React.useCallback((trait: FormatTraits, setActive: boolean) => {\n const traitStr = getTraitString(trait);\n let formatTraits: string[] = [traitStr];\n if (setActive) {// setting trait\n // istanbul ignore else\n if (formatProps.formatTraits) {\n const traits = Array.isArray(formatProps.formatTraits) ? formatProps.formatTraits : /* istanbul ignore next */ formatProps.formatTraits.split(/,|;|\\|/);\n // istanbul ignore else\n if (!traits.find((traitEntry) => traitStr === traitEntry)) {\n formatTraits = [...traits, traitStr];\n }\n }\n } else {// clearing trait\n // istanbul ignore next\n if (!formatProps.formatTraits)\n return;\n const traits = Array.isArray(formatProps.formatTraits) ? formatProps.formatTraits : /* istanbul ignore next */ formatProps.formatTraits.split(/,|;|\\|/);\n formatTraits = traits.filter((traitEntry) => traitEntry !== traitStr);\n }\n const newFormatProps = { ...formatProps, formatTraits };\n handleSetFormatProps(newFormatProps);\n }, [formatProps, handleSetFormatProps]);\n\n const handleShowTrailingZeroesChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n setFormatTrait(FormatTraits.TrailZeroes, e.target.checked);\n }, [setFormatTrait]);\n\n const handleKeepDecimalPointChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n setFormatTrait(FormatTraits.KeepDecimalPoint, e.target.checked);\n }, [setFormatTrait]);\n\n const handleKeepSingleZeroChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n setFormatTrait(FormatTraits.KeepSingleZero, e.target.checked);\n }, [setFormatTrait]);\n\n const handleZeroEmptyChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n setFormatTrait(FormatTraits.ZeroEmpty, e.target.checked);\n }, [setFormatTrait]);\n\n const handleUseFractionDashChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n setFormatTrait(FormatTraits.FractionDash, e.target.checked);\n }, [setFormatTrait]);\n\n const handleDecimalSeparatorChange = React.useCallback((decimalSeparator: string) => {\n let thousandSeparator = formatProps.thousandSeparator;\n // make sure 1000 and decimal separator do not match\n // istanbul ignore else\n if (isFormatTraitSet(FormatTraits.Use1000Separator)) {\n switch (decimalSeparator) {\n case \".\":\n thousandSeparator = \",\";\n break;\n case \",\":\n thousandSeparator = \".\";\n break;\n }\n }\n const newFormatProps = { ...formatProps, thousandSeparator, decimalSeparator };\n handleSetFormatProps(newFormatProps);\n }, [formatProps, isFormatTraitSet, handleSetFormatProps]);\n\n const handleScientificTypeChange = React.useCallback((type: ScientificType) => {\n const newFormatProps = { ...formatProps, scientificType: scientificTypeToString(type) };\n handleSetFormatProps(newFormatProps);\n }, [formatProps, handleSetFormatProps]);\n\n const handleFormatChange = React.useCallback((newFormatProps: FormatProps) => {\n handleSetFormatProps(newFormatProps);\n }, [handleSetFormatProps]);\n\n const formatType = React.useMemo(() => parseFormatType(formatProps.type, \"format\"), [formatProps.type]);\n const showSignOption = React.useMemo(() => parseShowSignOption(formatProps.showSignOption ?? \"onlyNegative\", \"format\"), [formatProps.showSignOption]);\n\n const handleToggleButtonClick = React.useCallback(() => {\n onShowHideOptions(!showOptions);\n }, [onShowHideOptions, showOptions]);\n\n const handleKeyUpOnLink = React.useCallback((e: React.KeyboardEvent<HTMLAnchorElement>) => {\n // istanbul ignore else\n if (e.key === SpecialKey.Enter || e.key === SpecialKey.Space) {\n onShowHideOptions(!showOptions);\n e.preventDefault();\n }\n }, [onShowHideOptions, showOptions]);\n\n const handleStationSeparatorChange = React.useCallback((value: string) => {\n const newFormatProps = { ...formatProps, stationSeparator: value };\n handleSetFormatProps(newFormatProps);\n }, [formatProps, handleSetFormatProps]);\n\n const handleStationOffsetChange = React.useCallback((value: number) => {\n const newFormatProps = { ...formatProps, stationOffsetSize: value };\n handleSetFormatProps(newFormatProps);\n }, [formatProps, handleSetFormatProps]);\n\n const signOptionLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.signOptionLabel\"));\n const stationOffsetLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.stationOffsetLabel\"));\n const stationSeparatorLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.stationSeparatorLabel\"));\n const decimalSeparatorLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.decimalSeparatorLabel\"));\n const showTrailZerosLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.showTrailZerosLabel\"));\n const keepSingleZeroLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.keepSingleZeroLabel\"));\n const zeroEmptyLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.zeroEmptyLabel\"));\n const moreLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.moreLabel\"));\n const lessLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.lessLabel\"));\n const keepDecimalPointLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.keepDecimalPointLabel\"));\n const fractionDashLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.fractionDashLabel\"));\n const scientificTypeLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.scientificTypeLabel\"));\n\n return (\n <>\n { // eslint-disable-next-line jsx-a11y/anchor-is-valid\n enableMinimumProperties && !showOptions && <a onClick={handleToggleButtonClick} onKeyUp={handleKeyUpOnLink}\n className={\"components-quantityFormat-more-less\"} role=\"link\" data-testid=\"quantityFormat-more\" tabIndex={0} >{moreLabel.current}</a>}\n {\n (!enableMinimumProperties || showOptions) &&\n <>\n <span className={\"uicore-label\"}>{signOptionLabel.current}</span>\n <SignOptionSelector data-testid=\"sign-option-selector\" signOption={showSignOption} onChange={handleShowSignChange} />\n\n <span className={classnames(\"uicore-label\", formatType !== FormatType.Station && \"uicore-disabled\")}>{stationOffsetLabel.current}</span>\n <StationSizeSelector data-testid=\"station-size-selector\" value={(formatProps.stationOffsetSize ?? 2)}\n disabled={formatType !== FormatType.Station} onChange={handleStationOffsetChange} />\n\n <span className={classnames(\"uicore-label\", formatType !== FormatType.Station && \"uicore-disabled\")}>{stationSeparatorLabel.current}</span>\n <StationSeparatorSelector data-testid=\"station-separator-selector\" separator={(undefined !== formatProps.stationSeparator ? formatProps.stationSeparator : \"+\")}\n disabled={formatType !== FormatType.Station} onChange={handleStationSeparatorChange} />\n\n <ThousandsSeparator formatProps={formatProps} onChange={handleFormatChange} />\n\n <span className={classnames(\"uicore-label\", formatType === FormatType.Fractional && \"uicore-disabled\")}>{decimalSeparatorLabel.current}</span>\n <DecimalSeparatorSelector data-testid=\"decimal-separator-selector\" separator={formatProps.decimalSeparator ?? \".\"} onChange={handleDecimalSeparatorChange} disabled={formatType === FormatType.Fractional} />\n\n <span className={\"uicore-label\"}>{showTrailZerosLabel.current}</span>\n <Checkbox data-testid=\"show-trail-zeros\" checked={isFormatTraitSet(FormatTraits.TrailZeroes)} onChange={handleShowTrailingZeroesChange} />\n\n <span className={classnames(\"uicore-label\", formatType === FormatType.Fractional && \"uicore-disabled\")}>{keepDecimalPointLabel.current}</span>\n <Checkbox data-testid=\"keep-decimal-point\" checked={isFormatTraitSet(FormatTraits.KeepDecimalPoint)} onChange={handleKeepDecimalPointChange} />\n\n <span className={\"uicore-label\"}>{keepSingleZeroLabel.current}</span>\n <Checkbox data-testid=\"keep-single-zero\" checked={isFormatTraitSet(FormatTraits.KeepSingleZero)} onChange={handleKeepSingleZeroChange} />\n\n <span className={\"uicore-label\"}>{zeroEmptyLabel.current}</span>\n <Checkbox data-testid=\"zero-empty\" checked={isFormatTraitSet(FormatTraits.ZeroEmpty)} onChange={handleZeroEmptyChange} />\n\n <span className={classnames(\"uicore-label\", formatType !== FormatType.Fractional && \"uicore-disabled\")}>{fractionDashLabel.current}</span>\n <Checkbox data-testid=\"fraction-dash\" checked={isFormatTraitSet(FormatTraits.FractionDash)} onChange={handleUseFractionDashChange} disabled={formatType !== FormatType.Fractional} />\n\n <span className={classnames(\"uicore-label\", formatType !== FormatType.Scientific && \"uicore-disabled\")}>{scientificTypeLabel.current}</span>\n <ScientificTypeSelector data-testid=\"scientific-type-selector\" type={(formatProps.scientificType && formatProps.scientificType.length > 0) ? parseScientificType(formatProps.scientificType, \"custom\") : ScientificType.Normalized}\n disabled={formatType !== FormatType.Scientific} onChange={handleScientificTypeChange} />\n\n {props.children}\n\n { // eslint-disable-next-line jsx-a11y/anchor-is-valid\n enableMinimumProperties && showOptions && <a onClick={handleToggleButtonClick} onKeyUp={handleKeyUpOnLink}\n className={\"components-quantityFormat-more-less\"} role=\"link\" data-testid=\"quantityFormat-less\" tabIndex={0}>{lessLabel.current}</a>}\n </>\n }\n </>\n );\n}\n"]}
1
+ {"version":3,"file":"MiscFormatOptions.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/MiscFormatOptions.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAe,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,eAAe,EAAE,mBAAmB,EAC1G,mBAAmB,EAAE,cAAc,EAAE,sBAAsB,EA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,2BAA2B,EAAE,QAAQ,EAAE,UAAU,KAAK,UAAU,CAAC,UAAU,GAAI;gBAErL,8BAAM,SAAS,EAAE,UAAU,CAAC,cAAc,EAAE,UAAU,KAAK,UAAU,CAAC,UAAU,IAAI,iBAAiB,CAAC,IAAG,mBAAmB,CAAC,OAAO,CAAQ;gBAC5I,oBAAC,sBAAsB,mBAAa,0BAA0B,EAAC,IAAI,EAAE,CAAC,WAAW,CAAC,cAAc,IAAI,WAAW,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,WAAW,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,UAAU,EAChO,QAAQ,EAAE,UAAU,KAAK,UAAU,CAAC,UAAU,EAAE,QAAQ,EAAE,0BAA0B,GAAI;gBAEzF,KAAK,CAAC,QAAQ;gBAGb,uBAAuB,IAAI,WAAW,IAAI,2BAAG,OAAO,EAAE,uBAAuB,EAAE,OAAO,EAAE,iBAAiB,EACvG,SAAS,EAAE,qCAAqC,EAAE,IAAI,EAAC,MAAM,iBAAa,qBAAqB,EAAC,QAAQ,EAAE,CAAC,IAAG,SAAS,CAAC,OAAO,CAAK,CACvI,CAEJ,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module QuantityFormat\r\n */\r\n\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { SpecialKey } from \"@itwin/appui-abstract\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { Checkbox } from \"@itwin/itwinui-react\";\r\nimport { Format, FormatProps, FormatTraits, FormatType, getTraitString, parseFormatType, parseScientificType,\r\n parseShowSignOption, ScientificType, scientificTypeToString, ShowSignOption, showSignOptionToString,\r\n} from \"@itwin/core-quantity\";\r\nimport { SignOptionSelector } from \"./misc/SignOption\";\r\nimport { ThousandsSeparator } from \"./misc/ThousandsSeparator\";\r\nimport { DecimalSeparatorSelector } from \"./misc/DecimalSeparator\";\r\nimport { ScientificTypeSelector } from \"./misc/ScientificType\";\r\nimport { StationSeparatorSelector } from \"./misc/StationSeparatorSelector\";\r\nimport { StationSizeSelector } from \"./misc/StationSizeSelector\";\r\nimport { UiIModelComponents } from \"../UiIModelComponents\";\r\n\r\n/** Properties of [[MiscFormatOptions]] component.\r\n * @alpha\r\n */\r\nexport interface MiscFormatOptionsProps extends CommonProps {\r\n formatProps: FormatProps;\r\n onChange?: (format: FormatProps) => void;\r\n enableMinimumProperties?: boolean;\r\n showOptions: boolean;\r\n onShowHideOptions: (show: boolean) => void;\r\n children?: React.ReactNode;\r\n}\r\n\r\n/** Component use to set miscellaneous properties is a Formatted Quantity.\r\n * @alpha\r\n */\r\nexport function MiscFormatOptions(props: MiscFormatOptionsProps) {\r\n const { formatProps, onChange, showOptions, onShowHideOptions, enableMinimumProperties } = props;\r\n\r\n const handleSetFormatProps = React.useCallback((newFormatProps: FormatProps) => {\r\n onChange && onChange(newFormatProps);\r\n }, [onChange]);\r\n\r\n const isFormatTraitSet = React.useCallback((trait: FormatTraits) => {\r\n return Format.isFormatTraitSetInProps(formatProps, trait);\r\n }, [formatProps]);\r\n\r\n const handleShowSignChange = React.useCallback((option: ShowSignOption) => {\r\n const newShowSignOption = showSignOptionToString(option);\r\n const newFormatProps = { ...formatProps, showSignOption: newShowSignOption };\r\n handleSetFormatProps(newFormatProps);\r\n }, [formatProps, handleSetFormatProps]);\r\n\r\n const setFormatTrait = React.useCallback((trait: FormatTraits, setActive: boolean) => {\r\n const traitStr = getTraitString(trait);\r\n let formatTraits: string[] = [traitStr];\r\n if (setActive) {// setting trait\r\n // istanbul ignore else\r\n if (formatProps.formatTraits) {\r\n const traits = Array.isArray(formatProps.formatTraits) ? formatProps.formatTraits : /* istanbul ignore next */ formatProps.formatTraits.split(/,|;|\\|/);\r\n // istanbul ignore else\r\n if (!traits.find((traitEntry) => traitStr === traitEntry)) {\r\n formatTraits = [...traits, traitStr];\r\n }\r\n }\r\n } else {// clearing trait\r\n // istanbul ignore next\r\n if (!formatProps.formatTraits)\r\n return;\r\n const traits = Array.isArray(formatProps.formatTraits) ? formatProps.formatTraits : /* istanbul ignore next */ formatProps.formatTraits.split(/,|;|\\|/);\r\n formatTraits = traits.filter((traitEntry) => traitEntry !== traitStr);\r\n }\r\n const newFormatProps = { ...formatProps, formatTraits };\r\n handleSetFormatProps(newFormatProps);\r\n }, [formatProps, handleSetFormatProps]);\r\n\r\n const handleShowTrailingZeroesChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\r\n setFormatTrait(FormatTraits.TrailZeroes, e.target.checked);\r\n }, [setFormatTrait]);\r\n\r\n const handleKeepDecimalPointChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\r\n setFormatTrait(FormatTraits.KeepDecimalPoint, e.target.checked);\r\n }, [setFormatTrait]);\r\n\r\n const handleKeepSingleZeroChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\r\n setFormatTrait(FormatTraits.KeepSingleZero, e.target.checked);\r\n }, [setFormatTrait]);\r\n\r\n const handleZeroEmptyChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\r\n setFormatTrait(FormatTraits.ZeroEmpty, e.target.checked);\r\n }, [setFormatTrait]);\r\n\r\n const handleUseFractionDashChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\r\n setFormatTrait(FormatTraits.FractionDash, e.target.checked);\r\n }, [setFormatTrait]);\r\n\r\n const handleDecimalSeparatorChange = React.useCallback((decimalSeparator: string) => {\r\n let thousandSeparator = formatProps.thousandSeparator;\r\n // make sure 1000 and decimal separator do not match\r\n // istanbul ignore else\r\n if (isFormatTraitSet(FormatTraits.Use1000Separator)) {\r\n switch (decimalSeparator) {\r\n case \".\":\r\n thousandSeparator = \",\";\r\n break;\r\n case \",\":\r\n thousandSeparator = \".\";\r\n break;\r\n }\r\n }\r\n const newFormatProps = { ...formatProps, thousandSeparator, decimalSeparator };\r\n handleSetFormatProps(newFormatProps);\r\n }, [formatProps, isFormatTraitSet, handleSetFormatProps]);\r\n\r\n const handleScientificTypeChange = React.useCallback((type: ScientificType) => {\r\n const newFormatProps = { ...formatProps, scientificType: scientificTypeToString(type) };\r\n handleSetFormatProps(newFormatProps);\r\n }, [formatProps, handleSetFormatProps]);\r\n\r\n const handleFormatChange = React.useCallback((newFormatProps: FormatProps) => {\r\n handleSetFormatProps(newFormatProps);\r\n }, [handleSetFormatProps]);\r\n\r\n const formatType = React.useMemo(() => parseFormatType(formatProps.type, \"format\"), [formatProps.type]);\r\n const showSignOption = React.useMemo(() => parseShowSignOption(formatProps.showSignOption ?? \"onlyNegative\", \"format\"), [formatProps.showSignOption]);\r\n\r\n const handleToggleButtonClick = React.useCallback(() => {\r\n onShowHideOptions(!showOptions);\r\n }, [onShowHideOptions, showOptions]);\r\n\r\n const handleKeyUpOnLink = React.useCallback((e: React.KeyboardEvent<HTMLAnchorElement>) => {\r\n // istanbul ignore else\r\n if (e.key === SpecialKey.Enter || e.key === SpecialKey.Space) {\r\n onShowHideOptions(!showOptions);\r\n e.preventDefault();\r\n }\r\n }, [onShowHideOptions, showOptions]);\r\n\r\n const handleStationSeparatorChange = React.useCallback((value: string) => {\r\n const newFormatProps = { ...formatProps, stationSeparator: value };\r\n handleSetFormatProps(newFormatProps);\r\n }, [formatProps, handleSetFormatProps]);\r\n\r\n const handleStationOffsetChange = React.useCallback((value: number) => {\r\n const newFormatProps = { ...formatProps, stationOffsetSize: value };\r\n handleSetFormatProps(newFormatProps);\r\n }, [formatProps, handleSetFormatProps]);\r\n\r\n const signOptionLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.signOptionLabel\"));\r\n const stationOffsetLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.stationOffsetLabel\"));\r\n const stationSeparatorLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.stationSeparatorLabel\"));\r\n const decimalSeparatorLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.decimalSeparatorLabel\"));\r\n const showTrailZerosLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.showTrailZerosLabel\"));\r\n const keepSingleZeroLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.keepSingleZeroLabel\"));\r\n const zeroEmptyLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.zeroEmptyLabel\"));\r\n const moreLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.moreLabel\"));\r\n const lessLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.lessLabel\"));\r\n const keepDecimalPointLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.keepDecimalPointLabel\"));\r\n const fractionDashLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.fractionDashLabel\"));\r\n const scientificTypeLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.scientificTypeLabel\"));\r\n\r\n return (\r\n <>\r\n { // eslint-disable-next-line jsx-a11y/anchor-is-valid\r\n enableMinimumProperties && !showOptions && <a onClick={handleToggleButtonClick} onKeyUp={handleKeyUpOnLink}\r\n className={\"components-quantityFormat-more-less\"} role=\"link\" data-testid=\"quantityFormat-more\" tabIndex={0} >{moreLabel.current}</a>}\r\n {\r\n (!enableMinimumProperties || showOptions) &&\r\n <>\r\n <span className={\"uicore-label\"}>{signOptionLabel.current}</span>\r\n <SignOptionSelector data-testid=\"sign-option-selector\" signOption={showSignOption} onChange={handleShowSignChange} />\r\n\r\n <span className={classnames(\"uicore-label\", formatType !== FormatType.Station && \"uicore-disabled\")}>{stationOffsetLabel.current}</span>\r\n <StationSizeSelector data-testid=\"station-size-selector\" value={(formatProps.stationOffsetSize ?? 2)}\r\n disabled={formatType !== FormatType.Station} onChange={handleStationOffsetChange} />\r\n\r\n <span className={classnames(\"uicore-label\", formatType !== FormatType.Station && \"uicore-disabled\")}>{stationSeparatorLabel.current}</span>\r\n <StationSeparatorSelector data-testid=\"station-separator-selector\" separator={(undefined !== formatProps.stationSeparator ? formatProps.stationSeparator : \"+\")}\r\n disabled={formatType !== FormatType.Station} onChange={handleStationSeparatorChange} />\r\n\r\n <ThousandsSeparator formatProps={formatProps} onChange={handleFormatChange} />\r\n\r\n <span className={classnames(\"uicore-label\", formatType === FormatType.Fractional && \"uicore-disabled\")}>{decimalSeparatorLabel.current}</span>\r\n <DecimalSeparatorSelector data-testid=\"decimal-separator-selector\" separator={formatProps.decimalSeparator ?? \".\"} onChange={handleDecimalSeparatorChange} disabled={formatType === FormatType.Fractional} />\r\n\r\n <span className={\"uicore-label\"}>{showTrailZerosLabel.current}</span>\r\n <Checkbox data-testid=\"show-trail-zeros\" checked={isFormatTraitSet(FormatTraits.TrailZeroes)} onChange={handleShowTrailingZeroesChange} />\r\n\r\n <span className={classnames(\"uicore-label\", formatType === FormatType.Fractional && \"uicore-disabled\")}>{keepDecimalPointLabel.current}</span>\r\n <Checkbox data-testid=\"keep-decimal-point\" checked={isFormatTraitSet(FormatTraits.KeepDecimalPoint)} onChange={handleKeepDecimalPointChange} />\r\n\r\n <span className={\"uicore-label\"}>{keepSingleZeroLabel.current}</span>\r\n <Checkbox data-testid=\"keep-single-zero\" checked={isFormatTraitSet(FormatTraits.KeepSingleZero)} onChange={handleKeepSingleZeroChange} />\r\n\r\n <span className={\"uicore-label\"}>{zeroEmptyLabel.current}</span>\r\n <Checkbox data-testid=\"zero-empty\" checked={isFormatTraitSet(FormatTraits.ZeroEmpty)} onChange={handleZeroEmptyChange} />\r\n\r\n <span className={classnames(\"uicore-label\", formatType !== FormatType.Fractional && \"uicore-disabled\")}>{fractionDashLabel.current}</span>\r\n <Checkbox data-testid=\"fraction-dash\" checked={isFormatTraitSet(FormatTraits.FractionDash)} onChange={handleUseFractionDashChange} disabled={formatType !== FormatType.Fractional} />\r\n\r\n <span className={classnames(\"uicore-label\", formatType !== FormatType.Scientific && \"uicore-disabled\")}>{scientificTypeLabel.current}</span>\r\n <ScientificTypeSelector data-testid=\"scientific-type-selector\" type={(formatProps.scientificType && formatProps.scientificType.length > 0) ? parseScientificType(formatProps.scientificType, \"custom\") : ScientificType.Normalized}\r\n disabled={formatType !== FormatType.Scientific} onChange={handleScientificTypeChange} />\r\n\r\n {props.children}\r\n\r\n { // eslint-disable-next-line jsx-a11y/anchor-is-valid\r\n enableMinimumProperties && showOptions && <a onClick={handleToggleButtonClick} onKeyUp={handleKeyUpOnLink}\r\n className={\"components-quantityFormat-more-less\"} role=\"link\" data-testid=\"quantityFormat-less\" tabIndex={0}>{lessLabel.current}</a>}\r\n </>\r\n }\r\n </>\r\n );\r\n}\r\n"]}
@@ -1,23 +1,23 @@
1
- /** @packageDocumentation
2
- * @module QuantityFormat
3
- */
4
- /// <reference types="react" />
5
- import { QuantityTypeArg } from "@itwin/core-frontend";
6
- import { FormatProps } from "@itwin/core-quantity";
7
- import { CommonProps } from "@itwin/core-react";
8
- /** Properties of [[QuantityFormatPanel]] component.
9
- * @alpha
10
- */
11
- export interface QuantityFormatPanelProps extends CommonProps {
12
- quantityType: QuantityTypeArg;
13
- onFormatChange?: (format: FormatProps) => void;
14
- /** props below are to be passed on to FormatPanel */
15
- showSample?: boolean;
16
- initialMagnitude?: number;
17
- enableMinimumProperties?: boolean;
18
- }
19
- /** Component to set properties that control Quantity Formatting.
20
- * @alpha
21
- */
22
- export declare function QuantityFormatPanel(props: QuantityFormatPanelProps): JSX.Element;
1
+ /** @packageDocumentation
2
+ * @module QuantityFormat
3
+ */
4
+ /// <reference types="react" />
5
+ import { QuantityTypeArg } from "@itwin/core-frontend";
6
+ import { FormatProps } from "@itwin/core-quantity";
7
+ import { CommonProps } from "@itwin/core-react";
8
+ /** Properties of [[QuantityFormatPanel]] component.
9
+ * @alpha
10
+ */
11
+ export interface QuantityFormatPanelProps extends CommonProps {
12
+ quantityType: QuantityTypeArg;
13
+ onFormatChange?: (format: FormatProps) => void;
14
+ /** props below are to be passed on to FormatPanel */
15
+ showSample?: boolean;
16
+ initialMagnitude?: number;
17
+ enableMinimumProperties?: boolean;
18
+ }
19
+ /** Component to set properties that control Quantity Formatting.
20
+ * @alpha
21
+ */
22
+ export declare function QuantityFormatPanel(props: QuantityFormatPanelProps): JSX.Element;
23
23
  //# sourceMappingURL=QuantityFormatPanel.d.ts.map