@itwin/imodel-components-react 4.10.0-dev.1 → 4.11.0

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 (267) hide show
  1. package/CHANGELOG.md +20 -1
  2. package/lib/cjs/imodel-components-react/UiIModelComponents.d.ts +1 -1
  3. package/lib/cjs/imodel-components-react/UiIModelComponents.js +6 -6
  4. package/lib/cjs/imodel-components-react/UiIModelComponents.js.map +1 -1
  5. package/lib/cjs/imodel-components-react/color/AlphaSlider.d.ts +2 -1
  6. package/lib/cjs/imodel-components-react/color/AlphaSlider.d.ts.map +1 -1
  7. package/lib/cjs/imodel-components-react/color/AlphaSlider.js +12 -8
  8. package/lib/cjs/imodel-components-react/color/AlphaSlider.js.map +1 -1
  9. package/lib/cjs/imodel-components-react/color/ColorPickerButton.d.ts +2 -0
  10. package/lib/cjs/imodel-components-react/color/ColorPickerButton.d.ts.map +1 -1
  11. package/lib/cjs/imodel-components-react/color/ColorPickerButton.js +5 -2
  12. package/lib/cjs/imodel-components-react/color/ColorPickerButton.js.map +1 -1
  13. package/lib/cjs/imodel-components-react/color/ColorPickerDialog.d.ts +2 -0
  14. package/lib/cjs/imodel-components-react/color/ColorPickerDialog.d.ts.map +1 -1
  15. package/lib/cjs/imodel-components-react/color/ColorPickerDialog.js +1 -1
  16. package/lib/cjs/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
  17. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.d.ts +2 -0
  18. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.d.ts.map +1 -1
  19. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.js +5 -5
  20. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
  21. package/lib/cjs/imodel-components-react/color/HueSlider.d.ts +2 -0
  22. package/lib/cjs/imodel-components-react/color/HueSlider.d.ts.map +1 -1
  23. package/lib/cjs/imodel-components-react/color/HueSlider.js +12 -9
  24. package/lib/cjs/imodel-components-react/color/HueSlider.js.map +1 -1
  25. package/lib/cjs/imodel-components-react/color/SaturationPicker.d.ts +2 -0
  26. package/lib/cjs/imodel-components-react/color/SaturationPicker.d.ts.map +1 -1
  27. package/lib/cjs/imodel-components-react/color/SaturationPicker.js +12 -11
  28. package/lib/cjs/imodel-components-react/color/SaturationPicker.js.map +1 -1
  29. package/lib/cjs/imodel-components-react/color/Swatch.d.ts +2 -0
  30. package/lib/cjs/imodel-components-react/color/Swatch.d.ts.map +1 -1
  31. package/lib/cjs/imodel-components-react/color/Swatch.js +2 -0
  32. package/lib/cjs/imodel-components-react/color/Swatch.js.map +1 -1
  33. package/lib/cjs/imodel-components-react/editors/ColorEditor.js +3 -2
  34. package/lib/cjs/imodel-components-react/editors/ColorEditor.js.map +1 -1
  35. package/lib/cjs/imodel-components-react/editors/WeightEditor.d.ts.map +1 -1
  36. package/lib/cjs/imodel-components-react/editors/WeightEditor.js.map +1 -1
  37. package/lib/cjs/imodel-components-react/inputs/QuantityInput.d.ts.map +1 -1
  38. package/lib/cjs/imodel-components-react/inputs/QuantityInput.js +5 -4
  39. package/lib/cjs/imodel-components-react/inputs/QuantityInput.js.map +1 -1
  40. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js +5 -5
  41. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
  42. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.js +3 -3
  43. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
  44. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js +10 -5
  45. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
  46. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts.map +1 -1
  47. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.js +3 -3
  48. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
  49. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js +1 -1
  50. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
  51. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js +5 -4
  52. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
  53. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.d.ts.map +1 -1
  54. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js +7 -8
  55. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
  56. package/lib/cjs/imodel-components-react/quantityformat/FormatType.d.ts.map +1 -1
  57. package/lib/cjs/imodel-components-react/quantityformat/FormatType.js +10 -10
  58. package/lib/cjs/imodel-components-react/quantityformat/FormatType.js.map +1 -1
  59. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.d.ts.map +1 -1
  60. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js +15 -14
  61. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
  62. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.d.ts.map +1 -1
  63. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js +13 -9
  64. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
  65. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.d.ts.map +1 -1
  66. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js +22 -29
  67. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
  68. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.d.ts.map +1 -1
  69. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.js +18 -17
  70. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.js.map +1 -1
  71. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.d.ts.map +1 -1
  72. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.js +7 -6
  73. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.js.map +1 -1
  74. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.d.ts.map +1 -1
  75. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.js +14 -13
  76. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.js.map +1 -1
  77. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.d.ts.map +1 -1
  78. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.js +7 -6
  79. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.js.map +1 -1
  80. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.d.ts.map +1 -1
  81. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.js +9 -8
  82. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.js.map +1 -1
  83. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.d.ts.map +1 -1
  84. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js +23 -22
  85. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js.map +1 -1
  86. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.d.ts.map +1 -1
  87. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.js +7 -6
  88. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.js.map +1 -1
  89. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.d.ts.map +1 -1
  90. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.js +15 -14
  91. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.js.map +1 -1
  92. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts.map +1 -1
  93. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +6 -6
  94. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
  95. package/lib/cjs/imodel-components-react/timeline/InlineEdit.js +2 -2
  96. package/lib/cjs/imodel-components-react/timeline/InlineEdit.js.map +1 -1
  97. package/lib/cjs/imodel-components-react/timeline/PlayButton.d.ts +12 -0
  98. package/lib/cjs/imodel-components-react/timeline/PlayButton.d.ts.map +1 -0
  99. package/lib/cjs/imodel-components-react/timeline/PlayButton.js +50 -0
  100. package/lib/cjs/imodel-components-react/timeline/PlayButton.js.map +1 -0
  101. package/lib/cjs/imodel-components-react/timeline/Scrubber.d.ts +0 -1
  102. package/lib/cjs/imodel-components-react/timeline/Scrubber.d.ts.map +1 -1
  103. package/lib/cjs/imodel-components-react/timeline/Scrubber.js +1 -1
  104. package/lib/cjs/imodel-components-react/timeline/Scrubber.js.map +1 -1
  105. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.d.ts +2 -20
  106. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.d.ts.map +1 -1
  107. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.js +111 -202
  108. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
  109. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.scss +25 -333
  110. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.d.ts +33 -67
  111. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.d.ts.map +1 -1
  112. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js +226 -330
  113. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
  114. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.scss +27 -140
  115. package/lib/cjs/imodel-components-react/timeline/interfaces.d.ts +2 -2
  116. package/lib/cjs/imodel-components-react/timeline/interfaces.d.ts.map +1 -1
  117. package/lib/cjs/imodel-components-react/timeline/interfaces.js.map +1 -1
  118. package/lib/cjs/imodel-components-react/useTranslation.d.ts +10 -0
  119. package/lib/cjs/imodel-components-react/useTranslation.d.ts.map +1 -0
  120. package/lib/cjs/imodel-components-react/useTranslation.js +20 -0
  121. package/lib/cjs/imodel-components-react/useTranslation.js.map +1 -0
  122. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.d.ts.map +1 -1
  123. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js +13 -8
  124. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
  125. package/lib/cjs/imodel-components-react.d.ts +0 -1
  126. package/lib/cjs/imodel-components-react.d.ts.map +1 -1
  127. package/lib/cjs/imodel-components-react.js +0 -1
  128. package/lib/cjs/imodel-components-react.js.map +1 -1
  129. package/lib/esm/imodel-components-react/UiIModelComponents.d.ts +1 -1
  130. package/lib/esm/imodel-components-react/UiIModelComponents.js +6 -6
  131. package/lib/esm/imodel-components-react/UiIModelComponents.js.map +1 -1
  132. package/lib/esm/imodel-components-react/color/AlphaSlider.d.ts +2 -1
  133. package/lib/esm/imodel-components-react/color/AlphaSlider.d.ts.map +1 -1
  134. package/lib/esm/imodel-components-react/color/AlphaSlider.js +12 -8
  135. package/lib/esm/imodel-components-react/color/AlphaSlider.js.map +1 -1
  136. package/lib/esm/imodel-components-react/color/ColorPickerButton.d.ts +2 -0
  137. package/lib/esm/imodel-components-react/color/ColorPickerButton.d.ts.map +1 -1
  138. package/lib/esm/imodel-components-react/color/ColorPickerButton.js +5 -2
  139. package/lib/esm/imodel-components-react/color/ColorPickerButton.js.map +1 -1
  140. package/lib/esm/imodel-components-react/color/ColorPickerDialog.d.ts +2 -0
  141. package/lib/esm/imodel-components-react/color/ColorPickerDialog.d.ts.map +1 -1
  142. package/lib/esm/imodel-components-react/color/ColorPickerDialog.js +1 -1
  143. package/lib/esm/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
  144. package/lib/esm/imodel-components-react/color/ColorPickerPopup.d.ts +2 -0
  145. package/lib/esm/imodel-components-react/color/ColorPickerPopup.d.ts.map +1 -1
  146. package/lib/esm/imodel-components-react/color/ColorPickerPopup.js +5 -5
  147. package/lib/esm/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
  148. package/lib/esm/imodel-components-react/color/HueSlider.d.ts +2 -0
  149. package/lib/esm/imodel-components-react/color/HueSlider.d.ts.map +1 -1
  150. package/lib/esm/imodel-components-react/color/HueSlider.js +12 -9
  151. package/lib/esm/imodel-components-react/color/HueSlider.js.map +1 -1
  152. package/lib/esm/imodel-components-react/color/SaturationPicker.d.ts +2 -0
  153. package/lib/esm/imodel-components-react/color/SaturationPicker.d.ts.map +1 -1
  154. package/lib/esm/imodel-components-react/color/SaturationPicker.js +12 -11
  155. package/lib/esm/imodel-components-react/color/SaturationPicker.js.map +1 -1
  156. package/lib/esm/imodel-components-react/color/Swatch.d.ts +2 -0
  157. package/lib/esm/imodel-components-react/color/Swatch.d.ts.map +1 -1
  158. package/lib/esm/imodel-components-react/color/Swatch.js +2 -0
  159. package/lib/esm/imodel-components-react/color/Swatch.js.map +1 -1
  160. package/lib/esm/imodel-components-react/editors/ColorEditor.js +3 -2
  161. package/lib/esm/imodel-components-react/editors/ColorEditor.js.map +1 -1
  162. package/lib/esm/imodel-components-react/editors/WeightEditor.d.ts.map +1 -1
  163. package/lib/esm/imodel-components-react/editors/WeightEditor.js.map +1 -1
  164. package/lib/esm/imodel-components-react/inputs/QuantityInput.d.ts.map +1 -1
  165. package/lib/esm/imodel-components-react/inputs/QuantityInput.js +5 -4
  166. package/lib/esm/imodel-components-react/inputs/QuantityInput.js.map +1 -1
  167. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js +5 -5
  168. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
  169. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.js +3 -3
  170. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
  171. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js +10 -5
  172. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
  173. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts.map +1 -1
  174. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.js +3 -3
  175. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
  176. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js +1 -1
  177. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
  178. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js +5 -4
  179. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
  180. package/lib/esm/imodel-components-react/quantityformat/FormatSample.d.ts.map +1 -1
  181. package/lib/esm/imodel-components-react/quantityformat/FormatSample.js +7 -8
  182. package/lib/esm/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
  183. package/lib/esm/imodel-components-react/quantityformat/FormatType.d.ts.map +1 -1
  184. package/lib/esm/imodel-components-react/quantityformat/FormatType.js +10 -10
  185. package/lib/esm/imodel-components-react/quantityformat/FormatType.js.map +1 -1
  186. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.d.ts.map +1 -1
  187. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js +15 -14
  188. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
  189. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.d.ts.map +1 -1
  190. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js +13 -9
  191. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
  192. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.d.ts.map +1 -1
  193. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js +22 -29
  194. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
  195. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.d.ts.map +1 -1
  196. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.js +18 -17
  197. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.js.map +1 -1
  198. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.d.ts.map +1 -1
  199. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.js +7 -6
  200. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.js.map +1 -1
  201. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.d.ts.map +1 -1
  202. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.js +14 -13
  203. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.js.map +1 -1
  204. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.d.ts.map +1 -1
  205. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.js +7 -6
  206. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.js.map +1 -1
  207. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.d.ts.map +1 -1
  208. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.js +9 -8
  209. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.js.map +1 -1
  210. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.d.ts.map +1 -1
  211. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js +23 -22
  212. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js.map +1 -1
  213. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.d.ts.map +1 -1
  214. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.js +7 -6
  215. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.js.map +1 -1
  216. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.d.ts.map +1 -1
  217. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.js +15 -14
  218. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.js.map +1 -1
  219. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts.map +1 -1
  220. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +6 -6
  221. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
  222. package/lib/esm/imodel-components-react/timeline/InlineEdit.js +2 -2
  223. package/lib/esm/imodel-components-react/timeline/InlineEdit.js.map +1 -1
  224. package/lib/esm/imodel-components-react/timeline/PlayButton.d.ts +12 -0
  225. package/lib/esm/imodel-components-react/timeline/PlayButton.d.ts.map +1 -0
  226. package/lib/esm/imodel-components-react/timeline/PlayButton.js +23 -0
  227. package/lib/esm/imodel-components-react/timeline/PlayButton.js.map +1 -0
  228. package/lib/esm/imodel-components-react/timeline/Scrubber.d.ts +0 -1
  229. package/lib/esm/imodel-components-react/timeline/Scrubber.d.ts.map +1 -1
  230. package/lib/esm/imodel-components-react/timeline/Scrubber.js +1 -1
  231. package/lib/esm/imodel-components-react/timeline/Scrubber.js.map +1 -1
  232. package/lib/esm/imodel-components-react/timeline/SolarTimeline.d.ts +2 -20
  233. package/lib/esm/imodel-components-react/timeline/SolarTimeline.d.ts.map +1 -1
  234. package/lib/esm/imodel-components-react/timeline/SolarTimeline.js +112 -203
  235. package/lib/esm/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
  236. package/lib/esm/imodel-components-react/timeline/SolarTimeline.scss +25 -333
  237. package/lib/esm/imodel-components-react/timeline/TimelineComponent.d.ts +33 -67
  238. package/lib/esm/imodel-components-react/timeline/TimelineComponent.d.ts.map +1 -1
  239. package/lib/esm/imodel-components-react/timeline/TimelineComponent.js +228 -329
  240. package/lib/esm/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
  241. package/lib/esm/imodel-components-react/timeline/TimelineComponent.scss +27 -140
  242. package/lib/esm/imodel-components-react/timeline/interfaces.d.ts +2 -2
  243. package/lib/esm/imodel-components-react/timeline/interfaces.d.ts.map +1 -1
  244. package/lib/esm/imodel-components-react/timeline/interfaces.js.map +1 -1
  245. package/lib/esm/imodel-components-react/useTranslation.d.ts +10 -0
  246. package/lib/esm/imodel-components-react/useTranslation.d.ts.map +1 -0
  247. package/lib/esm/imodel-components-react/useTranslation.js +16 -0
  248. package/lib/esm/imodel-components-react/useTranslation.js.map +1 -0
  249. package/lib/esm/imodel-components-react/viewport/ViewportComponent.d.ts.map +1 -1
  250. package/lib/esm/imodel-components-react/viewport/ViewportComponent.js +13 -8
  251. package/lib/esm/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
  252. package/lib/esm/imodel-components-react.d.ts +0 -1
  253. package/lib/esm/imodel-components-react.d.ts.map +1 -1
  254. package/lib/esm/imodel-components-react.js +0 -1
  255. package/lib/esm/imodel-components-react.js.map +1 -1
  256. package/lib/public/locales/en/UiIModelComponents.json +14 -3
  257. package/package.json +20 -20
  258. package/lib/cjs/imodel-components-react/timeline/PlayerButton.d.ts +0 -34
  259. package/lib/cjs/imodel-components-react/timeline/PlayerButton.d.ts.map +0 -1
  260. package/lib/cjs/imodel-components-react/timeline/PlayerButton.js +0 -100
  261. package/lib/cjs/imodel-components-react/timeline/PlayerButton.js.map +0 -1
  262. package/lib/cjs/imodel-components-react/timeline/PlayerButton.scss +0 -28
  263. package/lib/esm/imodel-components-react/timeline/PlayerButton.d.ts +0 -34
  264. package/lib/esm/imodel-components-react/timeline/PlayerButton.d.ts.map +0 -1
  265. package/lib/esm/imodel-components-react/timeline/PlayerButton.js +0 -69
  266. package/lib/esm/imodel-components-react/timeline/PlayerButton.js.map +0 -1
  267. package/lib/esm/imodel-components-react/timeline/PlayerButton.scss +0 -28
@@ -22,370 +22,266 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
25
  Object.defineProperty(exports, "__esModule", { value: true });
29
26
  exports.TimelineComponent = void 0;
27
+ /*---------------------------------------------------------------------------------------------
28
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
29
+ * See LICENSE.md in the project root for license terms and full copyright notice.
30
+ *--------------------------------------------------------------------------------------------*/
31
+ /** @packageDocumentation
32
+ * @module Timeline
33
+ */
34
+ require("./TimelineComponent.scss");
35
+ const React = __importStar(require("react"));
30
36
  const appui_abstract_1 = require("@itwin/appui-abstract");
31
37
  const components_react_1 = require("@itwin/components-react");
32
- const core_react_1 = require("@itwin/core-react");
33
38
  const itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
34
39
  const itwinui_react_1 = require("@itwin/itwinui-react");
35
- const classnames_1 = __importDefault(require("classnames"));
36
- const React = __importStar(require("react"));
37
- const UiIModelComponents_1 = require("../UiIModelComponents");
38
40
  const InlineEdit_1 = require("./InlineEdit");
39
41
  const interfaces_1 = require("./interfaces");
40
- const PlayerButton_1 = require("./PlayerButton");
42
+ const PlayButton_1 = require("./PlayButton");
41
43
  const Scrubber_1 = require("./Scrubber");
42
- require("./TimelineComponent.scss");
43
- // cspell:ignore millisec
44
+ const useTranslation_1 = require("../useTranslation");
44
45
  const slowSpeed = 60 * 1000;
45
46
  const mediumSpeed = 20 * 1000;
46
47
  const fastSpeed = 10 * 1000;
47
- /**
48
- * [[TimelineComponent]] is used to playback timeline data
48
+ /** [[TimelineComponent]] is used to playback timeline data
49
49
  * @public
50
50
  */
51
- class TimelineComponent extends React.Component {
52
- constructor(props) {
53
- super(props);
54
- this._timeLastCycle = 0;
55
- this._requestFrame = 0;
56
- this._unmounted = false;
57
- this._standardTimelineMenuItems = [
58
- {
59
- label: UiIModelComponents_1.UiIModelComponents.translate("timeline.slow"),
60
- timelineDuration: slowSpeed,
61
- },
62
- {
63
- label: UiIModelComponents_1.UiIModelComponents.translate("timeline.medium"),
64
- timelineDuration: mediumSpeed,
65
- },
66
- {
67
- label: UiIModelComponents_1.UiIModelComponents.translate("timeline.fast"),
68
- timelineDuration: fastSpeed,
69
- },
70
- ];
71
- this._handleTimelinePausePlayEvent = (args) => {
51
+ function TimelineComponent(props) {
52
+ var _a, _b, _c, _d;
53
+ const { appMenuItemOption = "replace", startDate, endDate, showDuration, timeZoneOffset, dateFormatOptions, timeFormatOptions, includeRepeat = true, onSettingsChange, onChange, onPlayPause, } = props;
54
+ const [isPlaying, setIsPlaying] = React.useState(!!props.isPlaying);
55
+ const [currentDuration, setCurrentDuration] = React.useState((_a = props.initialDuration) !== null && _a !== void 0 ? _a : 0);
56
+ const [totalDuration, setTotalDuration] = React.useState(props.totalDuration);
57
+ const [repeat, setRepeat] = React.useState((_b = props.repeat) !== null && _b !== void 0 ? _b : false);
58
+ const playOrReplay = React.useCallback(() => {
59
+ if (isPlaying)
60
+ return;
61
+ if (currentDuration >= totalDuration) {
62
+ setCurrentDuration(0);
63
+ }
64
+ setIsPlaying(true);
65
+ onPlayPause === null || onPlayPause === void 0 ? void 0 : onPlayPause(true);
66
+ }, [isPlaying, onPlayPause, currentDuration, totalDuration]);
67
+ const pause = React.useCallback(() => {
68
+ if (!isPlaying)
69
+ return;
70
+ setIsPlaying(false);
71
+ onPlayPause === null || onPlayPause === void 0 ? void 0 : onPlayPause(false);
72
+ }, [isPlaying, onPlayPause]);
73
+ const updateTotalDuration = (newTotalDuration) => {
74
+ if (newTotalDuration === totalDuration)
75
+ return;
76
+ const fraction = currentDuration / totalDuration;
77
+ const newCurrentDuration = fraction * newTotalDuration;
78
+ setTotalDuration(newTotalDuration);
79
+ setCurrentDuration(newCurrentDuration);
80
+ onSettingsChange === null || onSettingsChange === void 0 ? void 0 : onSettingsChange({ duration: newTotalDuration });
81
+ };
82
+ const updateDuration = (newDuration, currentTotalDuration = totalDuration) => {
83
+ newDuration = Math.max(newDuration, 0);
84
+ newDuration = Math.min(newDuration, currentTotalDuration);
85
+ if (newDuration === currentDuration)
86
+ return;
87
+ setCurrentDuration(newDuration);
88
+ const fraction = newDuration / currentTotalDuration;
89
+ onChange === null || onChange === void 0 ? void 0 : onChange(fraction);
90
+ };
91
+ const updateRepeat = (newRepeat) => {
92
+ if (newRepeat === repeat)
93
+ return;
94
+ setRepeat(newRepeat);
95
+ onSettingsChange === null || onSettingsChange === void 0 ? void 0 : onSettingsChange({ loop: newRepeat });
96
+ };
97
+ const [prevTotalDuration, setPrevTotalDuration] = React.useState(props.totalDuration);
98
+ if (prevTotalDuration !== props.totalDuration) {
99
+ setPrevTotalDuration(props.totalDuration);
100
+ updateTotalDuration(props.totalDuration);
101
+ }
102
+ const [prevInitialDuration, setPrevInitialDuration] = React.useState(props.initialDuration);
103
+ if (prevInitialDuration !== props.initialDuration) {
104
+ setPrevInitialDuration(props.initialDuration);
105
+ updateDuration((_c = props.initialDuration) !== null && _c !== void 0 ? _c : 0, props.totalDuration);
106
+ }
107
+ const [prevRepeat, setPrevRepeat] = React.useState(props.repeat);
108
+ if (prevRepeat !== props.repeat) {
109
+ setPrevRepeat(props.repeat);
110
+ updateRepeat((_d = props.repeat) !== null && _d !== void 0 ? _d : repeat);
111
+ }
112
+ React.useEffect(() => {
113
+ // eslint-disable-next-line deprecation/deprecation
114
+ if (!props.componentId)
115
+ return;
116
+ return appui_abstract_1.UiAdmin.onGenericUiEvent.addListener((args) => {
72
117
  const timelineArgs = args;
73
- // istanbul ignore else
74
118
  if (!timelineArgs ||
75
- this.props.componentId !== timelineArgs.uiComponentId ||
119
+ // eslint-disable-next-line deprecation/deprecation
120
+ props.componentId !== timelineArgs.uiComponentId ||
76
121
  timelineArgs.timelineAction === undefined)
77
122
  return;
78
- let startPlaying;
79
123
  switch (timelineArgs.timelineAction) {
80
124
  case interfaces_1.TimelinePausePlayAction.Play:
81
- startPlaying = true;
125
+ playOrReplay();
82
126
  break;
83
127
  case interfaces_1.TimelinePausePlayAction.Pause:
84
- startPlaying = false;
128
+ pause();
85
129
  break;
86
130
  case interfaces_1.TimelinePausePlayAction.Toggle:
87
- startPlaying = !this.state.isPlaying;
131
+ if (isPlaying) {
132
+ pause();
133
+ }
134
+ else {
135
+ playOrReplay();
136
+ }
88
137
  break;
89
- // istanbul ignore next
90
- default:
91
- return; // throw error?
92
- }
93
- if (startPlaying)
94
- this._onPlay();
95
- else
96
- this._onPause();
97
- };
98
- // user clicked backward button
99
- this._onBackward = () => {
100
- // istanbul ignore else
101
- if (this.props.onJump)
102
- this.props.onJump(false);
103
- };
104
- // user clicked forward button
105
- this._onForward = () => {
106
- // istanbul ignore else
107
- if (this.props.onJump)
108
- this.props.onJump(true);
109
- };
110
- // user clicked play button
111
- this._onPlay = () => {
112
- // istanbul ignore if
113
- if (this.state.isPlaying)
114
- return;
115
- // timeline was complete, restart from the beginning
116
- if (this.state.currentDuration >= this.state.totalDuration) {
117
- this._replay();
118
- }
119
- else
120
- this._play();
121
- // istanbul ignore else
122
- if (this.props.onPlayPause)
123
- this.props.onPlayPause(true);
124
- };
125
- // user clicked pause button
126
- this._onPause = () => {
127
- // istanbul ignore if
128
- if (!this.state.isPlaying)
129
- return;
130
- // stop requesting frames
131
- window.cancelAnimationFrame(this._requestFrame);
132
- // stop playing
133
- this.setState({ isPlaying: false });
134
- // istanbul ignore else
135
- if (this.props.onPlayPause)
136
- this.props.onPlayPause(false);
137
- };
138
- // user clicked on timeline rail or dragged scrubber handle
139
- this._onTimelineChange = (values) => {
140
- const currentDuration = values[0];
141
- this._setDuration(currentDuration);
142
- };
143
- // set the current duration, which will call the OnChange callback
144
- this._setDuration = (currentDuration, updatedTotal) => {
145
- const actualDuration = Math.min(updatedTotal ?? this.state.totalDuration, Math.max(currentDuration, 0));
146
- this._timeLastCycle = new Date().getTime();
147
- // istanbul ignore else
148
- if (!this._unmounted)
149
- this.setState({ currentDuration: actualDuration });
150
- // istanbul ignore else
151
- if (this.props.onChange) {
152
- const fraction = actualDuration / (updatedTotal ?? this.state.totalDuration);
153
- this.props.onChange(fraction);
154
138
  }
155
- };
156
- // recursively update the animation until we hit the end or the pause button is clicked
157
- this._updateAnimation = (_timestamp) => {
158
- // istanbul ignore else
159
- if (!this.state.isPlaying && !this._unmounted) {
160
- return;
161
- }
162
- // update duration
163
- const currentTime = new Date().getTime();
164
- const millisecondsElapsed = currentTime - this._timeLastCycle;
165
- const duration = this.state.currentDuration + millisecondsElapsed;
166
- this._setDuration(duration);
167
- // stop the animation!
168
- if (duration >= this.state.totalDuration) {
169
- window.cancelAnimationFrame(this._requestFrame);
170
- this.setState({ isPlaying: false });
171
- if (this.state.repeat)
172
- this._replay();
173
- else {
174
- // istanbul ignore else
175
- if (this.props.onPlayPause)
176
- this.props.onPlayPause(false);
177
- }
139
+ });
140
+ // eslint-disable-next-line deprecation/deprecation
141
+ }, [isPlaying, pause, playOrReplay, props.componentId]);
142
+ useAnimation(({ delta }) => {
143
+ const duration = currentDuration + delta;
144
+ updateDuration(duration);
145
+ if (duration >= totalDuration) {
146
+ if (repeat) {
147
+ setCurrentDuration(0);
178
148
  return;
179
149
  }
180
- // continue the animation - request the next frame
181
- this._requestFrame = window.requestAnimationFrame(this._updateAnimation);
182
- };
183
- this._replay = () => {
184
- // timeline was complete, restart from the beginning
185
- this.setState({ currentDuration: 0 }, () => this._play());
186
- };
187
- // user changed the total duration
188
- this._onTotalDurationChange = (value) => {
189
- // NOTE: we should reset the current duration to 0
190
- const milliseconds = this._getMilliseconds(value);
191
- this._onSetTotalDuration(milliseconds);
192
- };
193
- this._changeRepeatSetting = (newValue) => {
194
- // istanbul ignore else
195
- if (newValue !== undefined) {
196
- this.setState(() => ({ repeat: newValue }), () => {
197
- // istanbul ignore else
198
- if (this.props.onSettingsChange) {
199
- this.props.onSettingsChange({ loop: this.state.repeat });
200
- }
201
- });
202
- }
203
- };
204
- this._onRepeatChanged = () => {
205
- this.setState((prevState) => ({ repeat: !prevState.repeat }), () => {
206
- // istanbul ignore else
207
- if (this.props.onSettingsChange) {
208
- this.props.onSettingsChange({ loop: this.state.repeat });
209
- }
210
- });
211
- };
212
- this._currentDate = () => {
213
- const fraction = this.state.currentDuration / this.state.totalDuration;
214
- if (this.props.endDate && this.props.startDate) {
215
- const timeElapsed = (this.props.endDate.getTime() - this.props.startDate.getTime()) *
216
- fraction;
217
- return new Date(this.props.startDate.getTime() + timeElapsed);
218
- }
219
- return new Date();
220
- };
221
- this._onSetTotalDuration = (milliseconds) => {
222
- this.setState({ totalDuration: milliseconds }, () => {
223
- // istanbul ignore else
224
- if (this.props.onSettingsChange) {
225
- this.props.onSettingsChange({ duration: milliseconds });
226
- }
227
- });
228
- };
229
- this._renderSettings = () => {
230
- const createMenuItemNodes = (close) => {
231
- const { totalDuration } = this.state;
232
- let contextMenuItems = [];
233
- if (!this.props.appMenuItems) {
234
- contextMenuItems = this._standardTimelineMenuItems;
235
- }
236
- else {
237
- if (this.props.appMenuItemOption === "append") {
238
- contextMenuItems = this._standardTimelineMenuItems.concat(this.props.appMenuItems);
239
- }
240
- else if (this.props.appMenuItemOption === "prefix") {
241
- contextMenuItems = this.props.appMenuItems.concat(this._standardTimelineMenuItems);
242
- }
243
- else {
244
- contextMenuItems = this.props.appMenuItems;
245
- }
246
- }
247
- const itemNodes = [];
248
- let keyIndex = 0;
249
- if (this.state.includeRepeat) {
250
- const checked = this.state.repeat;
251
- const icon = checked ? (React.createElement("span", { className: "icon" },
252
- React.createElement(core_react_1.Icon, { iconSpec: React.createElement(itwinui_icons_react_1.SvgCheckmark, null) }),
253
- " ")) : (React.createElement("span", null));
254
- itemNodes.push(React.createElement(itwinui_react_1.MenuItem, { key: ++keyIndex, onClick: () => {
255
- this._onRepeatChanged();
256
- close();
257
- }, startIcon: icon }, this._repeatLabel));
258
- itemNodes.push(React.createElement(itwinui_react_1.MenuDivider, { key: ++keyIndex }));
259
- }
260
- contextMenuItems.forEach((item, index) => {
261
- itemNodes.push(this._createMenuItemNode(item, index + keyIndex + 1, totalDuration, close));
262
- });
263
- return itemNodes;
264
- };
265
- return (React.createElement(itwinui_react_1.DropdownMenu, { menuItems: createMenuItemNodes, placement: "top-start" },
266
- React.createElement("span", { "data-testid": "timeline-settings", className: "timeline-settings icon", role: "button", tabIndex: -1, title: components_react_1.UiComponents.translate("button.label.settings") },
267
- React.createElement(core_react_1.Icon, { iconSpec: React.createElement(itwinui_icons_react_1.SvgMoreVertical, null) }))));
268
- };
269
- this.state = {
270
- isPlaying: false,
271
- minimized: true,
272
- currentDuration: props.initialDuration
273
- ? props.initialDuration
274
- : /* istanbul ignore next */ 0,
275
- totalDuration: this.props.totalDuration,
276
- repeat: this.props.repeat ? true : false,
277
- includeRepeat: this.props.includeRepeat || this.props.includeRepeat === undefined
278
- ? true
279
- : false,
280
- };
281
- this._repeatLabel = UiIModelComponents_1.UiIModelComponents.translate("timeline.repeat");
282
- // istanbul ignore else
283
- if (this.props.componentId) {
284
- // can't handle an event if we have no id
285
- this._removeListener = appui_abstract_1.UiAdmin.onGenericUiEvent.addListener(this._handleTimelinePausePlayEvent);
150
+ pause();
286
151
  }
287
- }
288
- componentWillUnmount() {
289
- if (this._removeListener)
290
- this._removeListener();
291
- window.cancelAnimationFrame(this._requestFrame);
292
- this._unmounted = true;
293
- }
294
- shouldComponentUpdate(nextProps, nextState) {
295
- let result = false;
296
- // istanbul ignore next
297
- if (nextState !== this.state ||
298
- nextProps !== this.props ||
299
- nextProps.startDate !== this.props.startDate ||
300
- nextProps.endDate !== this.props.endDate ||
301
- nextProps.initialDuration !== this.props.initialDuration ||
302
- nextProps.repeat !== this.props.repeat)
303
- result = true;
304
- return result;
305
- }
306
- componentDidUpdate(prevProps) {
307
- // istanbul ignore else
308
- if (this.props.initialDuration !== prevProps.initialDuration) {
309
- this._setDuration(this.props.initialDuration
310
- ? this.props.initialDuration
311
- : /* istanbul ignore next */ 0, this.props.totalDuration !== prevProps.totalDuration
312
- ? this.props.totalDuration
313
- : undefined);
152
+ }, isPlaying);
153
+ React.useEffect(() => {
154
+ if (props.isPlaying)
155
+ playOrReplay();
156
+ if (props.isPlaying === false)
157
+ pause();
158
+ }, [props.isPlaying, playOrReplay, pause]);
159
+ const onTimelineChange = (values) => {
160
+ const newDuration = values[0];
161
+ updateDuration(newDuration);
162
+ };
163
+ const currentDurationStr = toDisplayTime(currentDuration);
164
+ const totalDurationStr = toDisplayTime(totalDuration);
165
+ const hasDates = !!startDate && !!endDate;
166
+ return (React.createElement("div", { "data-testid": "timeline-component", className: "timeline-component" },
167
+ React.createElement(PlayButton_1.PlayButton, { isPlaying: isPlaying, onPlay: playOrReplay, onPause: pause }),
168
+ React.createElement("div", { className: "time-container" },
169
+ hasDates && (React.createElement("span", { "data-testid": "test-start-date", className: "timeline-date" }, (0, components_react_1.toDateString)(startDate, timeZoneOffset, dateFormatOptions))),
170
+ hasDates && !showDuration && (React.createElement("span", { "data-testid": "test-start-time", className: "timeline-time" }, (0, components_react_1.toTimeString)(startDate, timeZoneOffset, timeFormatOptions))),
171
+ showDuration && (React.createElement("span", { className: "timeline-duration-time" }, currentDurationStr))),
172
+ React.createElement(Scrubber_1.Scrubber, { className: "slider", currentDuration: currentDuration, totalDuration: totalDuration, startDate: startDate, endDate: endDate, isPlaying: isPlaying, showTime: !showDuration, onChange: onTimelineChange, onUpdate: onTimelineChange, timeZoneOffset: props.timeZoneOffset, markDate: props.markDate }),
173
+ React.createElement("div", { className: "time-container" },
174
+ hasDates && (React.createElement("span", { "data-testid": "test-end-date", className: "timeline-date" }, (0, components_react_1.toDateString)(endDate, timeZoneOffset))),
175
+ hasDates && !showDuration && (React.createElement("span", { className: "timeline-time" }, (0, components_react_1.toTimeString)(endDate, timeZoneOffset, timeFormatOptions))),
176
+ showDuration && (React.createElement(InlineEdit_1.InlineEdit, { className: "timeline-duration-time", defaultValue: totalDurationStr, onChange: (value) => {
177
+ const newTotalDuration = timeToMs(value);
178
+ updateTotalDuration(newTotalDuration);
179
+ } }))),
180
+ React.createElement(SettingsMenu, { appMenuItems: props.appMenuItems, appMenuItemOption: appMenuItemOption, includeRepeat: includeRepeat, repeat: repeat, totalDuration: totalDuration, onRepeatClick: () => {
181
+ updateRepeat(!repeat);
182
+ }, onTotalDurationChange: (newTotalDuration) => {
183
+ updateTotalDuration(newTotalDuration);
184
+ } })));
185
+ }
186
+ exports.TimelineComponent = TimelineComponent;
187
+ function SettingsMenu({ appMenuItems, appMenuItemOption, includeRepeat, repeat, totalDuration, onRepeatClick, onTotalDurationChange, }) {
188
+ const { translate } = (0, useTranslation_1.useTranslation)();
189
+ const menuItems = React.useMemo(() => {
190
+ const standardItems = [
191
+ {
192
+ label: translate("timeline.slow"),
193
+ timelineDuration: slowSpeed,
194
+ },
195
+ {
196
+ label: translate("timeline.medium"),
197
+ timelineDuration: mediumSpeed,
198
+ },
199
+ {
200
+ label: translate("timeline.fast"),
201
+ timelineDuration: fastSpeed,
202
+ },
203
+ ];
204
+ if (!appMenuItems) {
205
+ return standardItems;
314
206
  }
315
- // istanbul ignore else
316
- if (this.props.repeat !== prevProps.repeat) {
317
- this._changeRepeatSetting(this.props.repeat);
207
+ if (appMenuItemOption === "append") {
208
+ return [...standardItems, ...appMenuItems];
318
209
  }
319
- // istanbul ignore else
320
- if (this.props.totalDuration !== prevProps.totalDuration) {
321
- this._onSetTotalDuration(this.props.totalDuration);
210
+ if (appMenuItemOption === "prefix") {
211
+ return [...appMenuItems, ...standardItems];
322
212
  }
323
- }
324
- _play() {
325
- // start playing
326
- this.setState({ isPlaying: true }, () => {
327
- // request the next frame
328
- this._timeLastCycle = new Date().getTime();
329
- this._requestFrame = window.requestAnimationFrame(this._updateAnimation);
330
- });
331
- }
332
- _displayTime(millisec) {
333
- const addZero = (i) => {
334
- return i < 10 ? `0${i}` : i;
213
+ // Replace
214
+ return appMenuItems;
215
+ }, [appMenuItemOption, appMenuItems, translate]);
216
+ return (React.createElement(itwinui_react_1.DropdownMenu, { menuItems: (close) => {
217
+ return [
218
+ ...(includeRepeat
219
+ ? [
220
+ React.createElement(itwinui_react_1.MenuItem, { key: "repeat", onClick: () => {
221
+ onRepeatClick();
222
+ close();
223
+ }, startIcon: repeat ? React.createElement(itwinui_icons_react_1.SvgCheckmark, null) : React.createElement(React.Fragment, null) }, translate("timeline.repeat")),
224
+ React.createElement(itwinui_react_1.MenuDivider, { key: "divider" }),
225
+ ]
226
+ : []),
227
+ ...menuItems.map((item, index) => {
228
+ const checked = totalDuration === item.timelineDuration;
229
+ return (React.createElement(itwinui_react_1.MenuItem, { key: index, startIcon: checked ? React.createElement(itwinui_icons_react_1.SvgCheckmark, null) : React.createElement(React.Fragment, null), onClick: () => {
230
+ onTotalDurationChange(item.timelineDuration);
231
+ close();
232
+ } }, item.label));
233
+ }),
234
+ ];
235
+ }, placement: "top-start" },
236
+ React.createElement(itwinui_react_1.IconButton, { "data-testid": "timeline-settings", label: translate("button.label.settings"), styleType: "borderless" },
237
+ React.createElement(itwinui_icons_react_1.SvgMoreVertical, null))));
238
+ }
239
+ function useAnimation(onAnimate, playing = true) {
240
+ const onAnimateRef = React.useRef(onAnimate);
241
+ onAnimateRef.current = onAnimate;
242
+ const lastTimeRef = React.useRef();
243
+ React.useEffect(() => {
244
+ if (!playing)
245
+ return;
246
+ let handle = 0;
247
+ let didCancel = false;
248
+ const animate = (time) => {
249
+ if (lastTimeRef.current === undefined) {
250
+ lastTimeRef.current = time;
251
+ }
252
+ const delta = time - lastTimeRef.current;
253
+ lastTimeRef.current = time;
254
+ onAnimateRef.current({
255
+ delta,
256
+ });
257
+ if (didCancel)
258
+ return;
259
+ handle = window.requestAnimationFrame(animate);
335
260
  };
336
- const date = new Date(millisec);
337
- // const hours = date.getUTCHours();
338
- const minutes = date.getUTCMinutes();
339
- const seconds = date.getUTCSeconds();
340
- return `${addZero(minutes)}:${addZero(seconds)}`;
341
- }
342
- _getMilliseconds(time) {
343
- // istanbul ignore else - WIP
344
- if (time.indexOf(":") !== -1) {
345
- return ((Number(time.split(":")[0]) * 60 + Number(time.split(":")[1])) * 1000);
346
- }
347
- else {
348
- return Number(time) * 1000;
349
- }
350
- }
351
- _createMenuItemNode(item, index, currentTimelineDuration, close) {
352
- const label = item.label;
353
- const checked = currentTimelineDuration === item.timelineDuration;
354
- const icon = checked ? (React.createElement("span", { className: "icon" },
355
- React.createElement(core_react_1.Icon, { iconSpec: React.createElement(itwinui_icons_react_1.SvgCheckmark, null) }),
356
- " ")) : (React.createElement("span", null));
357
- return (React.createElement(itwinui_react_1.MenuItem, { key: index, startIcon: icon, onClick: () => {
358
- this._onSetTotalDuration(item.timelineDuration);
359
- close();
360
- } }, label));
261
+ handle = window.requestAnimationFrame(animate);
262
+ return () => {
263
+ didCancel = true;
264
+ lastTimeRef.current = undefined;
265
+ window.cancelAnimationFrame(handle);
266
+ };
267
+ }, [playing]);
268
+ }
269
+ function timeToMs(time) {
270
+ if (time.indexOf(":") !== -1) {
271
+ return ((Number(time.split(":")[0]) * 60 + Number(time.split(":")[1])) * 1000);
361
272
  }
362
- render() {
363
- const { startDate, endDate, showDuration, timeZoneOffset, dateFormatOptions, timeFormatOptions, } = this.props;
364
- const { currentDuration, totalDuration, minimized } = this.state;
365
- const currentDate = this._currentDate();
366
- const durationString = this._displayTime(currentDuration);
367
- const totalDurationString = this._displayTime(totalDuration);
368
- const hasDates = !!startDate && !!endDate;
369
- return (React.createElement("div", { "data-testid": "timeline-component", className: (0, classnames_1.default)("timeline-component", !!minimized && "minimized", hasDates && "has-dates") },
370
- React.createElement("div", { className: "header" },
371
- React.createElement(PlayerButton_1.PlayButton, { className: "play-button", isPlaying: this.state.isPlaying, onPlay: this._onPlay, onPause: this._onPause, "data-testid": "timeline-play" }),
372
- React.createElement(PlayerButton_1.PlayerButton, { className: "play-backward", icon: React.createElement(itwinui_icons_react_1.SvgCaretLeft, null), onClick: this._onBackward, title: UiIModelComponents_1.UiIModelComponents.translate("timeline.backward") }),
373
- React.createElement(PlayerButton_1.PlayerButton, { className: "play-button-step", icon: React.createElement(itwinui_icons_react_1.SvgPlayCircular, null), isPlaying: this.state.isPlaying, onPlay: this._onPlay, onPause: this._onPause, title: UiIModelComponents_1.UiIModelComponents.translate("timeline.step") }),
374
- React.createElement(PlayerButton_1.PlayerButton, { className: "play-forward", icon: React.createElement(itwinui_icons_react_1.SvgCaretRight, null), onClick: this._onForward, title: UiIModelComponents_1.UiIModelComponents.translate("timeline.backward") }),
375
- React.createElement("span", { className: "current-date" }, (0, components_react_1.toDateString)(currentDate, timeZoneOffset, dateFormatOptions))),
376
- React.createElement("div", { className: "scrubber" },
377
- React.createElement(PlayerButton_1.PlayButton, { className: "play-button", isPlaying: this.state.isPlaying, onPlay: this._onPlay, onPause: this._onPause }),
378
- React.createElement("div", { className: "start-time-container" },
379
- hasDates && (React.createElement("span", { "data-testid": "test-start-date", className: "start-date" }, (0, components_react_1.toDateString)(startDate, timeZoneOffset, dateFormatOptions))),
380
- hasDates && !showDuration && (React.createElement("span", { "data-testid": "test-start-time", className: "start-time" }, (0, components_react_1.toTimeString)(startDate, timeZoneOffset, timeFormatOptions))),
381
- showDuration && (React.createElement("span", { className: "duration-start-time" }, durationString))),
382
- React.createElement(Scrubber_1.Scrubber, { className: "slider", currentDuration: this.state.currentDuration, totalDuration: totalDuration, startDate: startDate, endDate: endDate, isPlaying: this.state.isPlaying, inMiniMode: !!minimized, showTime: !showDuration, onChange: this._onTimelineChange, onUpdate: this._onTimelineChange, timeZoneOffset: this.props.timeZoneOffset, markDate: this.props.markDate }),
383
- React.createElement("div", { className: "end-time-container" },
384
- hasDates && (React.createElement("span", { className: "end-date" }, (0, components_react_1.toDateString)(endDate, timeZoneOffset))),
385
- hasDates && !showDuration && (React.createElement("span", { className: "end-time" }, (0, components_react_1.toTimeString)(endDate, timeZoneOffset, timeFormatOptions))),
386
- showDuration && (React.createElement(InlineEdit_1.InlineEdit, { className: "duration-end-time", defaultValue: totalDurationString, onChange: this._onTotalDurationChange }))),
387
- minimized && this._renderSettings())));
273
+ else {
274
+ return Number(time) * 1000;
388
275
  }
389
276
  }
390
- exports.TimelineComponent = TimelineComponent;
277
+ function toDisplayTime(ms) {
278
+ const addZero = (i) => {
279
+ return i < 10 ? `0${i}` : i;
280
+ };
281
+ const date = new Date(ms);
282
+ // const hours = date.getUTCHours();
283
+ const minutes = date.getUTCMinutes();
284
+ const seconds = date.getUTCSeconds();
285
+ return `${addZero(minutes)}:${addZero(seconds)}`;
286
+ }
391
287
  //# sourceMappingURL=TimelineComponent.js.map