@itwin/imodel-components-react 3.5.0-dev.11 → 3.5.0-dev.13

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,26 +1,26 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- @import "~@itwin/core-react/lib/cjs/core-react/style/themecolors";
6
-
7
- .player-button {
8
- width: 38px;
9
- height: 38px;
10
- display: flex;
11
- align-items: center;
12
- justify-content: center;
13
- font-size: 16px;
14
- outline: none;
15
- border-radius: 3px;
16
- border: solid 1px $buic-background-5;
17
- // background-image: linear-gradient(to bottom, $buic-background-1, $buic-background-2);
18
- background-image: linear-gradient(to bottom, $buic-background-3, $buic-background-3), linear-gradient(to bottom, $buic-background-1, $buic-background-1);
19
- color: $buic-foreground-body;
20
-
21
- cursor: pointer;
22
-
23
- &:hover {
24
- color: $buic-foreground-activehover;
25
- }
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ @import "~@itwin/core-react/lib/cjs/core-react/style/themecolors";
6
+
7
+ .player-button {
8
+ width: 38px;
9
+ height: 38px;
10
+ display: flex;
11
+ align-items: center;
12
+ justify-content: center;
13
+ font-size: 16px;
14
+ outline: none;
15
+ border-radius: 3px;
16
+ border: solid 1px $buic-background-5;
17
+ // background-image: linear-gradient(to bottom, $buic-background-1, $buic-background-2);
18
+ background-image: linear-gradient(to bottom, $buic-background-3, $buic-background-3), linear-gradient(to bottom, $buic-background-1, $buic-background-1);
19
+ color: $buic-foreground-body;
20
+
21
+ cursor: pointer;
22
+
23
+ &:hover {
24
+ color: $buic-foreground-activehover;
25
+ }
26
26
  }
@@ -1,55 +1,55 @@
1
- import "./Scrubber.scss";
2
- import * as React from "react";
3
- import { CommonProps } from "@itwin/core-react";
4
- import { TimelineDateMarkerProps } from "./TimelineComponent";
5
- /**
6
- * @internal
7
- */
8
- export declare function getPercentageOfRectangle(rect: DOMRect, pointer: number): number;
9
- /**
10
- * @internal
11
- */
12
- export declare function RailMarkers({ showToolTip, percent, tooltipText, markDate }: {
13
- showToolTip: boolean;
14
- percent: number;
15
- tooltipText: string;
16
- markDate?: DateMarkerProps;
17
- }): JSX.Element;
18
- /**
19
- * Custom Timeline Thumb
20
- * @internal
21
- */
22
- export declare function CustomThumb(): JSX.Element;
23
- /**
24
- * @internal
25
- */
26
- export declare function useFocusedThumb(sliderContainer: HTMLDivElement | undefined): boolean;
27
- /** Properties for Scrubber/Slider used on timeline control
28
- * @internal
29
- */
30
- export interface ScrubberProps extends CommonProps {
31
- currentDuration: number;
32
- totalDuration: number;
33
- isPlaying: boolean;
34
- inMiniMode: boolean;
35
- startDate?: Date;
36
- endDate?: Date;
37
- showTime?: boolean;
38
- onChange?: (values: ReadonlyArray<number>) => void;
39
- onUpdate?: (values: ReadonlyArray<number>) => void;
40
- timeZoneOffset?: number;
41
- markDate?: TimelineDateMarkerProps;
42
- }
43
- /** Properties for marking current date in RailMarkers
44
- * @internal
45
- */
46
- interface DateMarkerProps {
47
- datePercentage: number;
48
- dateMarker?: React.ReactNode;
49
- }
50
- /** Scrubber/Slider for timeline control
51
- * @internal
52
- */
53
- export declare function Scrubber(props: ScrubberProps): JSX.Element;
54
- export {};
1
+ import "./Scrubber.scss";
2
+ import * as React from "react";
3
+ import { CommonProps } from "@itwin/core-react";
4
+ import { TimelineDateMarkerProps } from "./TimelineComponent";
5
+ /**
6
+ * @internal
7
+ */
8
+ export declare function getPercentageOfRectangle(rect: DOMRect, pointer: number): number;
9
+ /**
10
+ * @internal
11
+ */
12
+ export declare function RailMarkers({ showToolTip, percent, tooltipText, markDate }: {
13
+ showToolTip: boolean;
14
+ percent: number;
15
+ tooltipText: string;
16
+ markDate?: DateMarkerProps;
17
+ }): JSX.Element;
18
+ /**
19
+ * Custom Timeline Thumb
20
+ * @internal
21
+ */
22
+ export declare function CustomThumb(): JSX.Element;
23
+ /**
24
+ * @internal
25
+ */
26
+ export declare function useFocusedThumb(sliderContainer: HTMLDivElement | undefined): boolean;
27
+ /** Properties for Scrubber/Slider used on timeline control
28
+ * @internal
29
+ */
30
+ export interface ScrubberProps extends CommonProps {
31
+ currentDuration: number;
32
+ totalDuration: number;
33
+ isPlaying: boolean;
34
+ inMiniMode: boolean;
35
+ startDate?: Date;
36
+ endDate?: Date;
37
+ showTime?: boolean;
38
+ onChange?: (values: ReadonlyArray<number>) => void;
39
+ onUpdate?: (values: ReadonlyArray<number>) => void;
40
+ timeZoneOffset?: number;
41
+ markDate?: TimelineDateMarkerProps;
42
+ }
43
+ /** Properties for marking current date in RailMarkers
44
+ * @internal
45
+ */
46
+ interface DateMarkerProps {
47
+ datePercentage: number;
48
+ dateMarker?: React.ReactNode;
49
+ }
50
+ /** Scrubber/Slider for timeline control
51
+ * @internal
52
+ */
53
+ export declare function Scrubber(props: ScrubberProps): JSX.Element;
54
+ export {};
55
55
  //# sourceMappingURL=Scrubber.d.ts.map
@@ -1,192 +1,192 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.Scrubber = exports.useFocusedThumb = exports.CustomThumb = exports.RailMarkers = exports.getPercentageOfRectangle = void 0;
23
- /*---------------------------------------------------------------------------------------------
24
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
25
- * See LICENSE.md in the project root for license terms and full copyright notice.
26
- *--------------------------------------------------------------------------------------------*/
27
- require("./Scrubber.scss");
28
- const React = __importStar(require("react"));
29
- const itwinui_react_1 = require("@itwin/itwinui-react");
30
- const core_react_1 = require("@itwin/core-react");
31
- const components_react_1 = require("@itwin/components-react");
32
- /**
33
- * @internal
34
- */
35
- function getPercentageOfRectangle(rect, pointer) {
36
- const position = Math.min(rect.right, Math.max(rect.left, pointer));
37
- return (position - rect.left) / rect.width;
38
- }
39
- exports.getPercentageOfRectangle = getPercentageOfRectangle;
40
- // istanbul ignore next - WIP
41
- const formatDuration = (value) => {
42
- const addZero = (i) => {
43
- return (i < 10) ? `0${i}` : i;
44
- };
45
- const date = new Date(value);
46
- const minutes = date.getUTCMinutes();
47
- const seconds = date.getUTCSeconds();
48
- return `${addZero(minutes)}:${addZero(seconds)}`;
49
- };
50
- const formatDate = (startDate, endDate, fraction, timeZoneOffset) => {
51
- const delta = (endDate.getTime() - startDate.getTime()) * fraction;
52
- const date = new Date(startDate.getTime() + delta);
53
- return (0, components_react_1.toDateString)(date, timeZoneOffset);
54
- };
55
- // istanbul ignore next - WIP
56
- const formatTime = (startDate, endDate, fraction, timeZoneOffset) => {
57
- const delta = (endDate.getTime() - startDate.getTime()) * fraction;
58
- const date = new Date(startDate.getTime() + delta);
59
- return ` ${(0, components_react_1.toTimeString)(date, timeZoneOffset)}`;
60
- };
61
- function generateToolTipText(showTime, percent, min, max, startDate, endDate, timeZoneOffset = 0) {
62
- if (startDate && endDate)
63
- return `${formatDate(startDate, endDate, percent, timeZoneOffset)}${showTime ? formatTime(startDate, endDate, percent, timeZoneOffset) : ""} `;
64
- const val = Math.round(min + ((max - min) * percent));
65
- return formatDuration(val);
66
- }
67
- function getPercentageFromDate(startDate, endDate, date) {
68
- const newDate = date ? date : new Date();
69
- const startTime = startDate.getTime();
70
- const totalDuration = endDate.getTime() - startTime;
71
- return (newDate.getTime() - startTime) / totalDuration;
72
- }
73
- function getDateMarker(dateMarkerPropsIn, startDate, endDate) {
74
- const percentage = getPercentageFromDate(startDate, endDate, dateMarkerPropsIn.date);
75
- const marker = dateMarkerPropsIn.dateMarker ? dateMarkerPropsIn.dateMarker : React.createElement("span", { className: "date-marker-default" });
76
- return { datePercentage: percentage, dateMarker: marker };
77
- }
78
- function markDateInTimelineRange(dateMarkerProps, startDate, endDate) {
79
- // istanbul ignore else
80
- if (dateMarkerProps && startDate && endDate) {
81
- const inDate = dateMarkerProps.date ? dateMarkerProps.date : new Date();
82
- // istanbul ignore else
83
- if (inDate.getTime() >= startDate.getTime() && inDate.getTime() <= endDate.getTime())
84
- return true;
85
- }
86
- return false;
87
- }
88
- /**
89
- * @internal
90
- */
91
- function RailMarkers({ showToolTip, percent, tooltipText, markDate }) {
92
- return (React.createElement("div", { className: "components-timeline-rail-marker-container" },
93
- showToolTip &&
94
- React.createElement("div", { className: "components-timeline-tooltip", style: { left: `${Math.round(percent * 100)}% ` } },
95
- React.createElement("span", { className: "tooltip-text" }, tooltipText)),
96
- markDate &&
97
- React.createElement("div", { className: "components-timeline-date-marker", "data-testid": "test-date-marker", style: { left: `${Math.round(markDate.datePercentage * 100)}% ` } }, markDate.dateMarker)));
98
- }
99
- exports.RailMarkers = RailMarkers;
100
- /**
101
- * Custom Timeline Thumb
102
- * @internal
103
- */
104
- function CustomThumb() {
105
- return (React.createElement("div", { className: "scrubber-handle" },
106
- React.createElement("div", null),
107
- React.createElement("div", null),
108
- React.createElement("div", null)));
109
- }
110
- exports.CustomThumb = CustomThumb;
111
- /**
112
- * @internal
113
- */
114
- function useFocusedThumb(sliderContainer) {
115
- const [thumbElement, setThumbElement] = React.useState();
116
- React.useLayoutEffect(() => {
117
- // istanbul ignore else
118
- if (sliderContainer) {
119
- const element = sliderContainer.querySelector(".iui-slider-thumb");
120
- if (element && thumbElement !== element) {
121
- setThumbElement(element);
122
- }
123
- }
124
- }, [sliderContainer, thumbElement]);
125
- const [thumbHasFocus, setThumbHasFocus] = React.useState(false);
126
- const handleThumbFocus = React.useCallback(() => {
127
- setThumbHasFocus(true);
128
- }, []);
129
- const handleThumbBlur = React.useCallback(() => {
130
- setThumbHasFocus(false);
131
- }, []);
132
- (0, core_react_1.useEventListener)("focus", handleThumbFocus, thumbElement);
133
- (0, core_react_1.useEventListener)("blur", handleThumbBlur, thumbElement);
134
- return thumbHasFocus;
135
- }
136
- exports.useFocusedThumb = useFocusedThumb;
137
- /** Scrubber/Slider for timeline control
138
- * @internal
139
- */
140
- function Scrubber(props) {
141
- const { startDate, endDate, showTime, isPlaying, totalDuration, timeZoneOffset, currentDuration, className, onChange, onUpdate } = props;
142
- const thumbProps = () => {
143
- return {
144
- className: "components-timeline-thumb",
145
- children: React.createElement(CustomThumb, null),
146
- };
147
- };
148
- const sliderRef = React.useRef(null);
149
- const [sliderContainer, setSliderContainer] = React.useState();
150
- const [pointerPercent, setPointerPercent] = React.useState(0);
151
- React.useLayoutEffect(() => {
152
- // istanbul ignore else
153
- if (sliderRef.current) {
154
- const container = sliderRef.current.querySelector(".iui-slider-container");
155
- if (container && sliderContainer !== container) {
156
- setSliderContainer(container);
157
- }
158
- }
159
- }, [sliderContainer]);
160
- const tooltipProps = React.useCallback(() => {
161
- return { visible: false };
162
- }, []);
163
- const [showRailTooltip, setShowRailTooltip] = React.useState(false);
164
- // istanbul ignore next
165
- const handlePointerEnter = React.useCallback(() => {
166
- setShowRailTooltip(true);
167
- }, []);
168
- // istanbul ignore next
169
- const handlePointerLeave = React.useCallback(() => {
170
- setShowRailTooltip(false);
171
- }, []);
172
- const handlePointerMove = React.useCallback((event) => {
173
- sliderContainer &&
174
- setPointerPercent(getPercentageOfRectangle(sliderContainer.getBoundingClientRect(), event.clientX));
175
- }, [sliderContainer]);
176
- const thumbHasFocus = useFocusedThumb(sliderContainer);
177
- const tickLabel = React.useMemo(() => {
178
- const showTip = isPlaying || showRailTooltip || thumbHasFocus;
179
- const percent = (isPlaying || thumbHasFocus) ? currentDuration / totalDuration : pointerPercent;
180
- const markDateInRange = markDateInTimelineRange(props.markDate, startDate, endDate);
181
- const currentDateMarker = props.markDate && markDateInRange && startDate && endDate ? getDateMarker(props.markDate, startDate, endDate) : undefined;
182
- const tooltipText = generateToolTipText(!!showTime, percent, 0, totalDuration, startDate, endDate, timeZoneOffset);
183
- return (React.createElement(RailMarkers, { showToolTip: showTip, percent: percent, tooltipText: tooltipText, markDate: currentDateMarker }));
184
- }, [isPlaying, showRailTooltip, currentDuration, totalDuration, pointerPercent, startDate, endDate, timeZoneOffset, showTime, thumbHasFocus, props.markDate]);
185
- return (React.createElement(itwinui_react_1.Slider, { ref: sliderRef, className: className, step: 1, min: 0, max: totalDuration, minLabel: "", maxLabel: "", onUpdate: onUpdate, onChange: onChange, values: [currentDuration], tooltipProps: tooltipProps, thumbProps: thumbProps, tickLabels: tickLabel, railContainerProps: {
186
- onPointerEnter: handlePointerEnter,
187
- onPointerMove: handlePointerMove,
188
- onPointerLeave: handlePointerLeave,
189
- } }));
190
- }
191
- exports.Scrubber = Scrubber;
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.Scrubber = exports.useFocusedThumb = exports.CustomThumb = exports.RailMarkers = exports.getPercentageOfRectangle = void 0;
23
+ /*---------------------------------------------------------------------------------------------
24
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
25
+ * See LICENSE.md in the project root for license terms and full copyright notice.
26
+ *--------------------------------------------------------------------------------------------*/
27
+ require("./Scrubber.scss");
28
+ const React = __importStar(require("react"));
29
+ const itwinui_react_1 = require("@itwin/itwinui-react");
30
+ const core_react_1 = require("@itwin/core-react");
31
+ const components_react_1 = require("@itwin/components-react");
32
+ /**
33
+ * @internal
34
+ */
35
+ function getPercentageOfRectangle(rect, pointer) {
36
+ const position = Math.min(rect.right, Math.max(rect.left, pointer));
37
+ return (position - rect.left) / rect.width;
38
+ }
39
+ exports.getPercentageOfRectangle = getPercentageOfRectangle;
40
+ // istanbul ignore next - WIP
41
+ const formatDuration = (value) => {
42
+ const addZero = (i) => {
43
+ return (i < 10) ? `0${i}` : i;
44
+ };
45
+ const date = new Date(value);
46
+ const minutes = date.getUTCMinutes();
47
+ const seconds = date.getUTCSeconds();
48
+ return `${addZero(minutes)}:${addZero(seconds)}`;
49
+ };
50
+ const formatDate = (startDate, endDate, fraction, timeZoneOffset) => {
51
+ const delta = (endDate.getTime() - startDate.getTime()) * fraction;
52
+ const date = new Date(startDate.getTime() + delta);
53
+ return (0, components_react_1.toDateString)(date, timeZoneOffset);
54
+ };
55
+ // istanbul ignore next - WIP
56
+ const formatTime = (startDate, endDate, fraction, timeZoneOffset) => {
57
+ const delta = (endDate.getTime() - startDate.getTime()) * fraction;
58
+ const date = new Date(startDate.getTime() + delta);
59
+ return ` ${(0, components_react_1.toTimeString)(date, timeZoneOffset)}`;
60
+ };
61
+ function generateToolTipText(showTime, percent, min, max, startDate, endDate, timeZoneOffset = 0) {
62
+ if (startDate && endDate)
63
+ return `${formatDate(startDate, endDate, percent, timeZoneOffset)}${showTime ? formatTime(startDate, endDate, percent, timeZoneOffset) : ""} `;
64
+ const val = Math.round(min + ((max - min) * percent));
65
+ return formatDuration(val);
66
+ }
67
+ function getPercentageFromDate(startDate, endDate, date) {
68
+ const newDate = date ? date : new Date();
69
+ const startTime = startDate.getTime();
70
+ const totalDuration = endDate.getTime() - startTime;
71
+ return (newDate.getTime() - startTime) / totalDuration;
72
+ }
73
+ function getDateMarker(dateMarkerPropsIn, startDate, endDate) {
74
+ const percentage = getPercentageFromDate(startDate, endDate, dateMarkerPropsIn.date);
75
+ const marker = dateMarkerPropsIn.dateMarker ? dateMarkerPropsIn.dateMarker : React.createElement("span", { className: "date-marker-default" });
76
+ return { datePercentage: percentage, dateMarker: marker };
77
+ }
78
+ function markDateInTimelineRange(dateMarkerProps, startDate, endDate) {
79
+ // istanbul ignore else
80
+ if (dateMarkerProps && startDate && endDate) {
81
+ const inDate = dateMarkerProps.date ? dateMarkerProps.date : new Date();
82
+ // istanbul ignore else
83
+ if (inDate.getTime() >= startDate.getTime() && inDate.getTime() <= endDate.getTime())
84
+ return true;
85
+ }
86
+ return false;
87
+ }
88
+ /**
89
+ * @internal
90
+ */
91
+ function RailMarkers({ showToolTip, percent, tooltipText, markDate }) {
92
+ return (React.createElement("div", { className: "components-timeline-rail-marker-container" },
93
+ showToolTip &&
94
+ React.createElement("div", { className: "components-timeline-tooltip", style: { left: `${Math.round(percent * 100)}% ` } },
95
+ React.createElement("span", { className: "tooltip-text" }, tooltipText)),
96
+ markDate &&
97
+ React.createElement("div", { className: "components-timeline-date-marker", "data-testid": "test-date-marker", style: { left: `${Math.round(markDate.datePercentage * 100)}% ` } }, markDate.dateMarker)));
98
+ }
99
+ exports.RailMarkers = RailMarkers;
100
+ /**
101
+ * Custom Timeline Thumb
102
+ * @internal
103
+ */
104
+ function CustomThumb() {
105
+ return (React.createElement("div", { className: "scrubber-handle" },
106
+ React.createElement("div", null),
107
+ React.createElement("div", null),
108
+ React.createElement("div", null)));
109
+ }
110
+ exports.CustomThumb = CustomThumb;
111
+ /**
112
+ * @internal
113
+ */
114
+ function useFocusedThumb(sliderContainer) {
115
+ const [thumbElement, setThumbElement] = React.useState();
116
+ React.useLayoutEffect(() => {
117
+ // istanbul ignore else
118
+ if (sliderContainer) {
119
+ const element = sliderContainer.querySelector(".iui-slider-thumb");
120
+ if (element && thumbElement !== element) {
121
+ setThumbElement(element);
122
+ }
123
+ }
124
+ }, [sliderContainer, thumbElement]);
125
+ const [thumbHasFocus, setThumbHasFocus] = React.useState(false);
126
+ const handleThumbFocus = React.useCallback(() => {
127
+ setThumbHasFocus(true);
128
+ }, []);
129
+ const handleThumbBlur = React.useCallback(() => {
130
+ setThumbHasFocus(false);
131
+ }, []);
132
+ (0, core_react_1.useEventListener)("focus", handleThumbFocus, thumbElement);
133
+ (0, core_react_1.useEventListener)("blur", handleThumbBlur, thumbElement);
134
+ return thumbHasFocus;
135
+ }
136
+ exports.useFocusedThumb = useFocusedThumb;
137
+ /** Scrubber/Slider for timeline control
138
+ * @internal
139
+ */
140
+ function Scrubber(props) {
141
+ const { startDate, endDate, showTime, isPlaying, totalDuration, timeZoneOffset, currentDuration, className, onChange, onUpdate } = props;
142
+ const thumbProps = () => {
143
+ return {
144
+ className: "components-timeline-thumb",
145
+ children: React.createElement(CustomThumb, null),
146
+ };
147
+ };
148
+ const sliderRef = React.useRef(null);
149
+ const [sliderContainer, setSliderContainer] = React.useState();
150
+ const [pointerPercent, setPointerPercent] = React.useState(0);
151
+ React.useLayoutEffect(() => {
152
+ // istanbul ignore else
153
+ if (sliderRef.current) {
154
+ const container = sliderRef.current.querySelector(".iui-slider-container");
155
+ if (container && sliderContainer !== container) {
156
+ setSliderContainer(container);
157
+ }
158
+ }
159
+ }, [sliderContainer]);
160
+ const tooltipProps = React.useCallback(() => {
161
+ return { visible: false };
162
+ }, []);
163
+ const [showRailTooltip, setShowRailTooltip] = React.useState(false);
164
+ // istanbul ignore next
165
+ const handlePointerEnter = React.useCallback(() => {
166
+ setShowRailTooltip(true);
167
+ }, []);
168
+ // istanbul ignore next
169
+ const handlePointerLeave = React.useCallback(() => {
170
+ setShowRailTooltip(false);
171
+ }, []);
172
+ const handlePointerMove = React.useCallback((event) => {
173
+ sliderContainer &&
174
+ setPointerPercent(getPercentageOfRectangle(sliderContainer.getBoundingClientRect(), event.clientX));
175
+ }, [sliderContainer]);
176
+ const thumbHasFocus = useFocusedThumb(sliderContainer);
177
+ const tickLabel = React.useMemo(() => {
178
+ const showTip = isPlaying || showRailTooltip || thumbHasFocus;
179
+ const percent = (isPlaying || thumbHasFocus) ? currentDuration / totalDuration : pointerPercent;
180
+ const markDateInRange = markDateInTimelineRange(props.markDate, startDate, endDate);
181
+ const currentDateMarker = props.markDate && markDateInRange && startDate && endDate ? getDateMarker(props.markDate, startDate, endDate) : undefined;
182
+ const tooltipText = generateToolTipText(!!showTime, percent, 0, totalDuration, startDate, endDate, timeZoneOffset);
183
+ return (React.createElement(RailMarkers, { showToolTip: showTip, percent: percent, tooltipText: tooltipText, markDate: currentDateMarker }));
184
+ }, [isPlaying, showRailTooltip, currentDuration, totalDuration, pointerPercent, startDate, endDate, timeZoneOffset, showTime, thumbHasFocus, props.markDate]);
185
+ return (React.createElement(itwinui_react_1.Slider, { ref: sliderRef, className: className, step: 1, min: 0, max: totalDuration, minLabel: "", maxLabel: "", onUpdate: onUpdate, onChange: onChange, values: [currentDuration], tooltipProps: tooltipProps, thumbProps: thumbProps, tickLabels: tickLabel, railContainerProps: {
186
+ onPointerEnter: handlePointerEnter,
187
+ onPointerMove: handlePointerMove,
188
+ onPointerLeave: handlePointerLeave,
189
+ } }));
190
+ }
191
+ exports.Scrubber = Scrubber;
192
192
  //# sourceMappingURL=Scrubber.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Scrubber.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/timeline/Scrubber.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,2BAAyB;AACzB,6CAA+B;AAC/B,wDAA8C;AAC9C,kDAAkE;AAClE,8DAAqE;AAGrE;;GAEG;AACH,SAAgB,wBAAwB,CAAC,IAAa,EAAE,OAAe;IACrE,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;IACpE,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,IAAI,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C,CAAC;IAC1H,CAAC,EAAE,CAAC,SAAS,EAAE,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,aAAa,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;IAE9J,OAAO,CACL,oBAAC,sBAAM,IAAC,GAAG,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,CAAC,EACP,GAAG,EAAE,CAAC,EACN,GAAG,EAAE,aAAa,EAClB,QAAQ,EAAC,EAAE,EACX,QAAQ,EAAC,EAAE,EACX,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,CAAC,eAAe,CAAC,EACzB,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,SAAS,EACrB,kBAAkB,EAAE;YAClB,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,iBAAiB;YAChC,cAAc,EAAE,kBAAkB;SACnC,GACD,CACH,CAAC;AACJ,CAAC;AA9ED,4BA8EC","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\nimport \"./Scrubber.scss\";\r\nimport * as React from \"react\";\r\nimport { Slider } from \"@itwin/itwinui-react\";\r\nimport { CommonProps, useEventListener } from \"@itwin/core-react\";\r\nimport { toDateString, toTimeString } from \"@itwin/components-react\";\r\nimport { TimelineDateMarkerProps } from \"./TimelineComponent\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function getPercentageOfRectangle(rect: DOMRect, pointer: number) {\r\n const position = Math.min(rect.right, Math.max(rect.left, pointer));\r\n return (position - rect.left) / rect.width;\r\n}\r\n\r\n// istanbul ignore next - WIP\r\nconst formatDuration = (value: number) => {\r\n const addZero = (i: number) => {\r\n return (i < 10) ? `0${i}` : i;\r\n };\r\n\r\n const date = new Date(value);\r\n const minutes = date.getUTCMinutes();\r\n const seconds = date.getUTCSeconds();\r\n return `${addZero(minutes)}:${addZero(seconds)}`;\r\n};\r\n\r\nconst formatDate = (startDate: Date, endDate: Date, fraction: number, timeZoneOffset?: number) => {\r\n const delta = (endDate.getTime() - startDate.getTime()) * fraction;\r\n const date = new Date(startDate.getTime() + delta);\r\n return toDateString(date, timeZoneOffset);\r\n};\r\n\r\n// istanbul ignore next - WIP\r\nconst formatTime = (startDate: Date, endDate: Date, fraction: number, timeZoneOffset?: number) => {\r\n const delta = (endDate.getTime() - startDate.getTime()) * fraction;\r\n const date = new Date(startDate.getTime() + delta);\r\n return ` ${toTimeString(date, timeZoneOffset)}`;\r\n};\r\n\r\nfunction generateToolTipText(showTime: boolean, percent: number, min: number, max: number, startDate?: Date, endDate?: Date, timeZoneOffset = 0) {\r\n if (startDate && endDate)\r\n return `${formatDate(startDate, endDate, percent, timeZoneOffset)}${showTime ? formatTime(startDate, endDate, percent, timeZoneOffset) : \"\"} `;\r\n\r\n const val = Math.round(min + ((max - min) * percent));\r\n return formatDuration(val);\r\n}\r\n\r\nfunction getPercentageFromDate(startDate: Date, endDate: Date, date?: Date) {\r\n const newDate = date ? date : new Date();\r\n const startTime = startDate.getTime();\r\n const totalDuration = endDate.getTime() - startTime;\r\n return (newDate.getTime() - startTime) / totalDuration;\r\n}\r\n\r\nfunction getDateMarker(dateMarkerPropsIn: TimelineDateMarkerProps, startDate: Date, endDate: Date): DateMarkerProps {\r\n const percentage = getPercentageFromDate(startDate, endDate, dateMarkerPropsIn.date);\r\n const marker = dateMarkerPropsIn.dateMarker ? dateMarkerPropsIn.dateMarker : <span className=\"date-marker-default\"></span>;\r\n return { datePercentage: percentage, dateMarker: marker };\r\n}\r\n\r\nfunction markDateInTimelineRange(dateMarkerProps?: TimelineDateMarkerProps, startDate?: Date, endDate?: Date): boolean {\r\n // istanbul ignore else\r\n if (dateMarkerProps && startDate && endDate) {\r\n const inDate = dateMarkerProps.date ? dateMarkerProps.date : new Date();\r\n // istanbul ignore else\r\n if (inDate.getTime() >= startDate.getTime() && inDate.getTime() <= endDate.getTime())\r\n return true;\r\n }\r\n return false;\r\n}\r\n/**\r\n * @internal\r\n */\r\nexport function RailMarkers({ showToolTip, percent, tooltipText, markDate }: {\r\n showToolTip: boolean;\r\n percent: number;\r\n tooltipText: string;\r\n markDate?: DateMarkerProps;\r\n}) {\r\n\r\n return (\r\n <div className=\"components-timeline-rail-marker-container\">\r\n {showToolTip &&\r\n <div className=\"components-timeline-tooltip\" style={{ left: `${Math.round(percent * 100)}% ` }}>\r\n <span className=\"tooltip-text\">{tooltipText}</span>\r\n </div>}\r\n {markDate &&\r\n <div className=\"components-timeline-date-marker\" data-testid=\"test-date-marker\" style={{ left: `${Math.round(markDate.datePercentage * 100)}% ` }}>\r\n {markDate.dateMarker}\r\n </div>}\r\n </div>\r\n );\r\n}\r\n\r\n/**\r\n * Custom Timeline Thumb\r\n * @internal\r\n */\r\nexport function CustomThumb() {\r\n return (\r\n <div className=\"scrubber-handle\">\r\n <div /><div /><div />\r\n </div>\r\n );\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function useFocusedThumb(sliderContainer: HTMLDivElement | undefined) {\r\n const [thumbElement, setThumbElement] = React.useState<HTMLDivElement>();\r\n\r\n React.useLayoutEffect(() => {\r\n // istanbul ignore else\r\n if (sliderContainer) {\r\n const element = sliderContainer.querySelector(\".iui-slider-thumb\");\r\n if (element && thumbElement !== element) {\r\n setThumbElement(element as HTMLDivElement);\r\n }\r\n }\r\n }, [sliderContainer, thumbElement]);\r\n\r\n const [thumbHasFocus, setThumbHasFocus] = React.useState(false);\r\n\r\n const handleThumbFocus = React.useCallback(() => {\r\n setThumbHasFocus(true);\r\n }, []);\r\n\r\n const handleThumbBlur = React.useCallback(() => {\r\n setThumbHasFocus(false);\r\n }, []);\r\n\r\n useEventListener(\"focus\", handleThumbFocus, thumbElement);\r\n useEventListener(\"blur\", handleThumbBlur, thumbElement);\r\n return thumbHasFocus;\r\n}\r\n\r\n/** Properties for Scrubber/Slider used on timeline control\r\n * @internal\r\n */\r\nexport interface ScrubberProps extends CommonProps {\r\n currentDuration: number;\r\n totalDuration: number;\r\n isPlaying: boolean;\r\n inMiniMode: boolean;\r\n startDate?: Date;\r\n endDate?: Date;\r\n showTime?: boolean;\r\n onChange?: (values: ReadonlyArray<number>) => void;\r\n onUpdate?: (values: ReadonlyArray<number>) => void;\r\n timeZoneOffset?: number;\r\n markDate?: TimelineDateMarkerProps;\r\n}\r\n\r\n/** Properties for marking current date in RailMarkers\r\n * @internal\r\n */\r\ninterface DateMarkerProps {\r\n datePercentage: number;\r\n dateMarker?: React.ReactNode;\r\n}\r\n/** Scrubber/Slider for timeline control\r\n * @internal\r\n */\r\nexport function Scrubber(props: ScrubberProps) {\r\n const { startDate, endDate, showTime, isPlaying, totalDuration, timeZoneOffset,\r\n currentDuration, className, onChange, onUpdate } = props;\r\n\r\n const thumbProps = () => {\r\n return {\r\n className: \"components-timeline-thumb\",\r\n children: <CustomThumb />,\r\n };\r\n };\r\n\r\n const sliderRef = React.useRef<HTMLDivElement>(null);\r\n const [sliderContainer, setSliderContainer] = React.useState<HTMLDivElement>();\r\n const [pointerPercent, setPointerPercent] = React.useState(0);\r\n\r\n React.useLayoutEffect(() => {\r\n // istanbul ignore else\r\n if (sliderRef.current) {\r\n const container = sliderRef.current.querySelector(\".iui-slider-container\");\r\n if (container && sliderContainer !== container) {\r\n setSliderContainer(container as HTMLDivElement);\r\n }\r\n }\r\n }, [sliderContainer]);\r\n\r\n const tooltipProps = React.useCallback(() => {\r\n return { visible: false };\r\n }, []);\r\n\r\n const [showRailTooltip, setShowRailTooltip] = React.useState(false);\r\n\r\n // istanbul ignore next\r\n const handlePointerEnter = React.useCallback(() => {\r\n setShowRailTooltip(true);\r\n }, []);\r\n\r\n // istanbul ignore next\r\n const handlePointerLeave = React.useCallback(() => {\r\n setShowRailTooltip(false);\r\n }, []);\r\n\r\n const handlePointerMove = React.useCallback((event: React.PointerEvent) => {\r\n sliderContainer &&\r\n setPointerPercent(getPercentageOfRectangle(sliderContainer.getBoundingClientRect(), event.clientX));\r\n }, [sliderContainer]);\r\n\r\n const thumbHasFocus = useFocusedThumb(sliderContainer);\r\n\r\n const tickLabel = React.useMemo(() => {\r\n const showTip = isPlaying || showRailTooltip || thumbHasFocus;\r\n const percent = (isPlaying || thumbHasFocus) ? currentDuration / totalDuration : pointerPercent;\r\n const markDateInRange = markDateInTimelineRange(props.markDate, startDate, endDate);\r\n const currentDateMarker = props.markDate && markDateInRange && startDate && endDate ? getDateMarker(props.markDate, startDate, endDate) : undefined;\r\n const tooltipText = generateToolTipText(!!showTime, percent, 0, totalDuration, startDate, endDate, timeZoneOffset);\r\n return (<RailMarkers showToolTip={showTip} percent={percent} tooltipText={tooltipText} markDate={currentDateMarker} />);\r\n }, [isPlaying, showRailTooltip, currentDuration, totalDuration, pointerPercent, startDate, endDate, timeZoneOffset, showTime, thumbHasFocus, props.markDate]);\r\n\r\n return (\r\n <Slider ref={sliderRef}\r\n className={className}\r\n step={1}\r\n min={0}\r\n max={totalDuration}\r\n minLabel=\"\"\r\n maxLabel=\"\"\r\n onUpdate={onUpdate}\r\n onChange={onChange}\r\n values={[currentDuration]}\r\n tooltipProps={tooltipProps}\r\n thumbProps={thumbProps}\r\n tickLabels={tickLabel}\r\n railContainerProps={{\r\n onPointerEnter: handlePointerEnter,\r\n onPointerMove: handlePointerMove,\r\n onPointerLeave: handlePointerLeave,\r\n }}\r\n />\r\n );\r\n}\r\n"]}
1
+ {"version":3,"file":"Scrubber.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/timeline/Scrubber.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,2BAAyB;AACzB,6CAA+B;AAC/B,wDAA8C;AAC9C,kDAAkE;AAClE,8DAAqE;AAGrE;;GAEG;AACH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AC,QAAQ,EAAE,OAAO,EAAE,CAAC,EAAE,aAAa,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QACnH,OAAO,CAAC,oBAAC,WAAW,IAAC,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,iBAAiB,GAAI,CAAC,CAAC;IAC1H,CAAC,EAAE,CAAC,SAAS,EAAE,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,aAAa,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;IAE9J,OAAO,CACL,oBAAC,sBAAM,IAAC,GAAG,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,CAAC,EACP,GAAG,EAAE,CAAC,EACN,GAAG,EAAE,aAAa,EAClB,QAAQ,EAAC,EAAE,EACX,QAAQ,EAAC,EAAE,EACX,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,CAAC,eAAe,CAAC,EACzB,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,SAAS,EACrB,kBAAkB,EAAE;YAClB,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,iBAAiB;YAChC,cAAc,EAAE,kBAAkB;SACnC,GACD,CACH,CAAC;AACJ,CAAC;AA9ED,4BA8EC","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*--------------------------------------------------------------------------------------------*/\nimport \"./Scrubber.scss\";\nimport * as React from \"react\";\nimport { Slider } from \"@itwin/itwinui-react\";\nimport { CommonProps, useEventListener } from \"@itwin/core-react\";\nimport { toDateString, toTimeString } from \"@itwin/components-react\";\nimport { TimelineDateMarkerProps } from \"./TimelineComponent\";\n\n/**\n * @internal\n */\nexport function getPercentageOfRectangle(rect: DOMRect, pointer: number) {\n const position = Math.min(rect.right, Math.max(rect.left, pointer));\n return (position - rect.left) / rect.width;\n}\n\n// istanbul ignore next - WIP\nconst formatDuration = (value: number) => {\n const addZero = (i: number) => {\n return (i < 10) ? `0${i}` : i;\n };\n\n const date = new Date(value);\n const minutes = date.getUTCMinutes();\n const seconds = date.getUTCSeconds();\n return `${addZero(minutes)}:${addZero(seconds)}`;\n};\n\nconst formatDate = (startDate: Date, endDate: Date, fraction: number, timeZoneOffset?: number) => {\n const delta = (endDate.getTime() - startDate.getTime()) * fraction;\n const date = new Date(startDate.getTime() + delta);\n return toDateString(date, timeZoneOffset);\n};\n\n// istanbul ignore next - WIP\nconst formatTime = (startDate: Date, endDate: Date, fraction: number, timeZoneOffset?: number) => {\n const delta = (endDate.getTime() - startDate.getTime()) * fraction;\n const date = new Date(startDate.getTime() + delta);\n return ` ${toTimeString(date, timeZoneOffset)}`;\n};\n\nfunction generateToolTipText(showTime: boolean, percent: number, min: number, max: number, startDate?: Date, endDate?: Date, timeZoneOffset = 0) {\n if (startDate && endDate)\n return `${formatDate(startDate, endDate, percent, timeZoneOffset)}${showTime ? formatTime(startDate, endDate, percent, timeZoneOffset) : \"\"} `;\n\n const val = Math.round(min + ((max - min) * percent));\n return formatDuration(val);\n}\n\nfunction getPercentageFromDate(startDate: Date, endDate: Date, date?: Date) {\n const newDate = date ? date : new Date();\n const startTime = startDate.getTime();\n const totalDuration = endDate.getTime() - startTime;\n return (newDate.getTime() - startTime) / totalDuration;\n}\n\nfunction getDateMarker(dateMarkerPropsIn: TimelineDateMarkerProps, startDate: Date, endDate: Date): DateMarkerProps {\n const percentage = getPercentageFromDate(startDate, endDate, dateMarkerPropsIn.date);\n const marker = dateMarkerPropsIn.dateMarker ? dateMarkerPropsIn.dateMarker : <span className=\"date-marker-default\"></span>;\n return { datePercentage: percentage, dateMarker: marker };\n}\n\nfunction markDateInTimelineRange(dateMarkerProps?: TimelineDateMarkerProps, startDate?: Date, endDate?: Date): boolean {\n // istanbul ignore else\n if (dateMarkerProps && startDate && endDate) {\n const inDate = dateMarkerProps.date ? dateMarkerProps.date : new Date();\n // istanbul ignore else\n if (inDate.getTime() >= startDate.getTime() && inDate.getTime() <= endDate.getTime())\n return true;\n }\n return false;\n}\n/**\n * @internal\n */\nexport function RailMarkers({ showToolTip, percent, tooltipText, markDate }: {\n showToolTip: boolean;\n percent: number;\n tooltipText: string;\n markDate?: DateMarkerProps;\n}) {\n\n return (\n <div className=\"components-timeline-rail-marker-container\">\n {showToolTip &&\n <div className=\"components-timeline-tooltip\" style={{ left: `${Math.round(percent * 100)}% ` }}>\n <span className=\"tooltip-text\">{tooltipText}</span>\n </div>}\n {markDate &&\n <div className=\"components-timeline-date-marker\" data-testid=\"test-date-marker\" style={{ left: `${Math.round(markDate.datePercentage * 100)}% ` }}>\n {markDate.dateMarker}\n </div>}\n </div>\n );\n}\n\n/**\n * Custom Timeline Thumb\n * @internal\n */\nexport function CustomThumb() {\n return (\n <div className=\"scrubber-handle\">\n <div /><div /><div />\n </div>\n );\n}\n\n/**\n * @internal\n */\nexport function useFocusedThumb(sliderContainer: HTMLDivElement | undefined) {\n const [thumbElement, setThumbElement] = React.useState<HTMLDivElement>();\n\n React.useLayoutEffect(() => {\n // istanbul ignore else\n if (sliderContainer) {\n const element = sliderContainer.querySelector(\".iui-slider-thumb\");\n if (element && thumbElement !== element) {\n setThumbElement(element as HTMLDivElement);\n }\n }\n }, [sliderContainer, thumbElement]);\n\n const [thumbHasFocus, setThumbHasFocus] = React.useState(false);\n\n const handleThumbFocus = React.useCallback(() => {\n setThumbHasFocus(true);\n }, []);\n\n const handleThumbBlur = React.useCallback(() => {\n setThumbHasFocus(false);\n }, []);\n\n useEventListener(\"focus\", handleThumbFocus, thumbElement);\n useEventListener(\"blur\", handleThumbBlur, thumbElement);\n return thumbHasFocus;\n}\n\n/** Properties for Scrubber/Slider used on timeline control\n * @internal\n */\nexport interface ScrubberProps extends CommonProps {\n currentDuration: number;\n totalDuration: number;\n isPlaying: boolean;\n inMiniMode: boolean;\n startDate?: Date;\n endDate?: Date;\n showTime?: boolean;\n onChange?: (values: ReadonlyArray<number>) => void;\n onUpdate?: (values: ReadonlyArray<number>) => void;\n timeZoneOffset?: number;\n markDate?: TimelineDateMarkerProps;\n}\n\n/** Properties for marking current date in RailMarkers\n * @internal\n */\ninterface DateMarkerProps {\n datePercentage: number;\n dateMarker?: React.ReactNode;\n}\n/** Scrubber/Slider for timeline control\n * @internal\n */\nexport function Scrubber(props: ScrubberProps) {\n const { startDate, endDate, showTime, isPlaying, totalDuration, timeZoneOffset,\n currentDuration, className, onChange, onUpdate } = props;\n\n const thumbProps = () => {\n return {\n className: \"components-timeline-thumb\",\n children: <CustomThumb />,\n };\n };\n\n const sliderRef = React.useRef<HTMLDivElement>(null);\n const [sliderContainer, setSliderContainer] = React.useState<HTMLDivElement>();\n const [pointerPercent, setPointerPercent] = React.useState(0);\n\n React.useLayoutEffect(() => {\n // istanbul ignore else\n if (sliderRef.current) {\n const container = sliderRef.current.querySelector(\".iui-slider-container\");\n if (container && sliderContainer !== container) {\n setSliderContainer(container as HTMLDivElement);\n }\n }\n }, [sliderContainer]);\n\n const tooltipProps = React.useCallback(() => {\n return { visible: false };\n }, []);\n\n const [showRailTooltip, setShowRailTooltip] = React.useState(false);\n\n // istanbul ignore next\n const handlePointerEnter = React.useCallback(() => {\n setShowRailTooltip(true);\n }, []);\n\n // istanbul ignore next\n const handlePointerLeave = React.useCallback(() => {\n setShowRailTooltip(false);\n }, []);\n\n const handlePointerMove = React.useCallback((event: React.PointerEvent) => {\n sliderContainer &&\n setPointerPercent(getPercentageOfRectangle(sliderContainer.getBoundingClientRect(), event.clientX));\n }, [sliderContainer]);\n\n const thumbHasFocus = useFocusedThumb(sliderContainer);\n\n const tickLabel = React.useMemo(() => {\n const showTip = isPlaying || showRailTooltip || thumbHasFocus;\n const percent = (isPlaying || thumbHasFocus) ? currentDuration / totalDuration : pointerPercent;\n const markDateInRange = markDateInTimelineRange(props.markDate, startDate, endDate);\n const currentDateMarker = props.markDate && markDateInRange && startDate && endDate ? getDateMarker(props.markDate, startDate, endDate) : undefined;\n const tooltipText = generateToolTipText(!!showTime, percent, 0, totalDuration, startDate, endDate, timeZoneOffset);\n return (<RailMarkers showToolTip={showTip} percent={percent} tooltipText={tooltipText} markDate={currentDateMarker} />);\n }, [isPlaying, showRailTooltip, currentDuration, totalDuration, pointerPercent, startDate, endDate, timeZoneOffset, showTime, thumbHasFocus, props.markDate]);\n\n return (\n <Slider ref={sliderRef}\n className={className}\n step={1}\n min={0}\n max={totalDuration}\n minLabel=\"\"\n maxLabel=\"\"\n onUpdate={onUpdate}\n onChange={onChange}\n values={[currentDuration]}\n tooltipProps={tooltipProps}\n thumbProps={thumbProps}\n tickLabels={tickLabel}\n railContainerProps={{\n onPointerEnter: handlePointerEnter,\n onPointerMove: handlePointerMove,\n onPointerLeave: handlePointerLeave,\n }}\n />\n );\n}\n"]}