@itwin/imodel-components-react 4.0.0-dev.1 → 4.0.0-dev.10

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 (347) hide show
  1. package/CHANGELOG.md +1 -91
  2. package/lib/cjs/imodel-components-react/UiIModelComponents.d.ts +28 -28
  3. package/lib/cjs/imodel-components-react/UiIModelComponents.js +79 -79
  4. package/lib/cjs/imodel-components-react/UiIModelComponents.js.map +1 -1
  5. package/lib/cjs/imodel-components-react/color/AlphaSlider.d.ts +36 -36
  6. package/lib/cjs/imodel-components-react/color/AlphaSlider.js +186 -186
  7. package/lib/cjs/imodel-components-react/color/AlphaSlider.js.map +1 -1
  8. package/lib/cjs/imodel-components-react/color/AlphaSlider.scss +63 -63
  9. package/lib/cjs/imodel-components-react/color/ColorPickerButton.d.ts +37 -37
  10. package/lib/cjs/imodel-components-react/color/ColorPickerButton.js +107 -107
  11. package/lib/cjs/imodel-components-react/color/ColorPickerButton.js.map +1 -1
  12. package/lib/cjs/imodel-components-react/color/ColorPickerButton.scss +90 -92
  13. package/lib/cjs/imodel-components-react/color/ColorPickerDialog.d.ts +23 -23
  14. package/lib/cjs/imodel-components-react/color/ColorPickerDialog.js +74 -74
  15. package/lib/cjs/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
  16. package/lib/cjs/imodel-components-react/color/ColorPickerPanel.d.ts +21 -21
  17. package/lib/cjs/imodel-components-react/color/ColorPickerPanel.js +145 -145
  18. package/lib/cjs/imodel-components-react/color/ColorPickerPanel.js.map +1 -1
  19. package/lib/cjs/imodel-components-react/color/ColorPickerPanel.scss +93 -93
  20. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.d.ts +44 -44
  21. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.js +137 -137
  22. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
  23. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.scss +63 -64
  24. package/lib/cjs/imodel-components-react/color/HueSlider.d.ts +22 -22
  25. package/lib/cjs/imodel-components-react/color/HueSlider.js +199 -199
  26. package/lib/cjs/imodel-components-react/color/HueSlider.js.map +1 -1
  27. package/lib/cjs/imodel-components-react/color/HueSlider.scss +61 -61
  28. package/lib/cjs/imodel-components-react/color/SaturationPicker.d.ts +20 -20
  29. package/lib/cjs/imodel-components-react/color/SaturationPicker.js +213 -213
  30. package/lib/cjs/imodel-components-react/color/SaturationPicker.js.map +1 -1
  31. package/lib/cjs/imodel-components-react/color/SaturationPicker.scss +35 -35
  32. package/lib/cjs/imodel-components-react/color/Swatch.d.ts +22 -22
  33. package/lib/cjs/imodel-components-react/color/Swatch.js +60 -60
  34. package/lib/cjs/imodel-components-react/color/Swatch.js.map +1 -1
  35. package/lib/cjs/imodel-components-react/color/Swatch.scss +23 -24
  36. package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.d.ts +6 -6
  37. package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.js +23 -23
  38. package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.js.map +1 -1
  39. package/lib/cjs/imodel-components-react/editors/ColorEditor.d.ts +44 -44
  40. package/lib/cjs/imodel-components-react/editors/ColorEditor.js +151 -151
  41. package/lib/cjs/imodel-components-react/editors/ColorEditor.js.map +1 -1
  42. package/lib/cjs/imodel-components-react/editors/ColorEditor.scss +18 -19
  43. package/lib/cjs/imodel-components-react/editors/WeightEditor.d.ts +47 -47
  44. package/lib/cjs/imodel-components-react/editors/WeightEditor.js +160 -160
  45. package/lib/cjs/imodel-components-react/editors/WeightEditor.js.map +1 -1
  46. package/lib/cjs/imodel-components-react/editors/WeightEditor.scss +16 -17
  47. package/lib/cjs/imodel-components-react/inputs/QuantityInput.d.ts +25 -25
  48. package/lib/cjs/imodel-components-react/inputs/QuantityInput.js +96 -96
  49. package/lib/cjs/imodel-components-react/inputs/QuantityInput.js.map +1 -1
  50. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.d.ts +44 -44
  51. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js +265 -265
  52. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
  53. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.scss +107 -107
  54. package/lib/cjs/imodel-components-react/lineweight/Swatch.d.ts +33 -33
  55. package/lib/cjs/imodel-components-react/lineweight/Swatch.js +85 -85
  56. package/lib/cjs/imodel-components-react/lineweight/Swatch.js.map +1 -1
  57. package/lib/cjs/imodel-components-react/lineweight/Swatch.scss +48 -49
  58. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.d.ts +60 -60
  59. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.js +159 -159
  60. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
  61. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.scss +52 -53
  62. package/lib/cjs/imodel-components-react/navigationaids/Cube.d.ts +45 -45
  63. package/lib/cjs/imodel-components-react/navigationaids/Cube.js +127 -127
  64. package/lib/cjs/imodel-components-react/navigationaids/Cube.js.map +1 -1
  65. package/lib/cjs/imodel-components-react/navigationaids/Cube.scss +19 -19
  66. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.d.ts +174 -174
  67. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.d.ts.map +1 -1
  68. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js +634 -634
  69. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
  70. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.scss +182 -181
  71. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts +145 -145
  72. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.js +647 -647
  73. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
  74. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.scss +134 -134
  75. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.d.ts +26 -26
  76. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js +99 -99
  77. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
  78. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.scss +63 -65
  79. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.d.ts +17 -17
  80. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js +53 -53
  81. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
  82. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.d.ts +18 -18
  83. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js +83 -83
  84. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
  85. package/lib/cjs/imodel-components-react/quantityformat/FormatType.d.ts +17 -17
  86. package/lib/cjs/imodel-components-react/quantityformat/FormatType.js +86 -86
  87. package/lib/cjs/imodel-components-react/quantityformat/FormatType.js.map +1 -1
  88. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.d.ts +17 -17
  89. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js +109 -109
  90. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
  91. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.d.ts +19 -19
  92. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js +133 -133
  93. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
  94. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.d.ts +21 -21
  95. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js +184 -184
  96. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
  97. package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts +22 -22
  98. package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts.map +1 -1
  99. package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.js +145 -154
  100. package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.js.map +1 -1
  101. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.d.ts +17 -17
  102. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.js +59 -59
  103. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.js.map +1 -1
  104. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.d.ts +17 -17
  105. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.js +47 -47
  106. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.js.map +1 -1
  107. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.d.ts +16 -16
  108. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.js +54 -54
  109. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.js.map +1 -1
  110. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.d.ts +18 -18
  111. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.js +48 -48
  112. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.js.map +1 -1
  113. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.d.ts +17 -17
  114. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.js +50 -50
  115. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.js.map +1 -1
  116. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.d.ts +17 -17
  117. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js +58 -58
  118. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js.map +1 -1
  119. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.d.ts +17 -17
  120. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.js +47 -47
  121. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.js.map +1 -1
  122. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.d.ts +17 -17
  123. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.js +56 -56
  124. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.js.map +1 -1
  125. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts +17 -17
  126. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +95 -95
  127. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
  128. package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.d.ts +23 -23
  129. package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.js +119 -119
  130. package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.js.map +1 -1
  131. package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.d.ts +52 -52
  132. package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.js +143 -143
  133. package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.js.map +1 -1
  134. package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.d.ts +31 -31
  135. package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.js +69 -69
  136. package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.js.map +1 -1
  137. package/lib/cjs/imodel-components-react/timeline/InlineEdit.d.ts +27 -27
  138. package/lib/cjs/imodel-components-react/timeline/InlineEdit.js +81 -81
  139. package/lib/cjs/imodel-components-react/timeline/InlineEdit.js.map +1 -1
  140. package/lib/cjs/imodel-components-react/timeline/InlineEdit.scss +26 -26
  141. package/lib/cjs/imodel-components-react/timeline/PlayerButton.d.ts +33 -33
  142. package/lib/cjs/imodel-components-react/timeline/PlayerButton.js +91 -91
  143. package/lib/cjs/imodel-components-react/timeline/PlayerButton.js.map +1 -1
  144. package/lib/cjs/imodel-components-react/timeline/PlayerButton.scss +31 -26
  145. package/lib/cjs/imodel-components-react/timeline/Scrubber.d.ts +54 -54
  146. package/lib/cjs/imodel-components-react/timeline/Scrubber.js +191 -191
  147. package/lib/cjs/imodel-components-react/timeline/Scrubber.js.map +1 -1
  148. package/lib/cjs/imodel-components-react/timeline/Scrubber.scss +112 -107
  149. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.d.ts +77 -77
  150. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.js +424 -424
  151. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
  152. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.scss +356 -358
  153. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.d.ts +15 -15
  154. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.js +54 -54
  155. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.js.map +1 -1
  156. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.scss +39 -39
  157. package/lib/cjs/imodel-components-react/timeline/Timeline.scss +164 -164
  158. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.d.ts +133 -133
  159. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js +358 -358
  160. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
  161. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.scss +164 -164
  162. package/lib/cjs/imodel-components-react/timeline/interfaces.d.ts +174 -174
  163. package/lib/cjs/imodel-components-react/timeline/interfaces.js +45 -45
  164. package/lib/cjs/imodel-components-react/timeline/interfaces.js.map +1 -1
  165. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.d.ts +42 -42
  166. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js +274 -274
  167. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
  168. package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.d.ts +106 -106
  169. package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.js +105 -105
  170. package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.js.map +1 -1
  171. package/lib/cjs/imodel-components-react.d.ts +82 -82
  172. package/lib/cjs/imodel-components-react.js +101 -101
  173. package/lib/cjs/imodel-components-react.js.map +1 -1
  174. package/lib/esm/imodel-components-react/UiIModelComponents.d.ts +28 -28
  175. package/lib/esm/imodel-components-react/UiIModelComponents.js +75 -75
  176. package/lib/esm/imodel-components-react/UiIModelComponents.js.map +1 -1
  177. package/lib/esm/imodel-components-react/color/AlphaSlider.d.ts +36 -36
  178. package/lib/esm/imodel-components-react/color/AlphaSlider.js +160 -160
  179. package/lib/esm/imodel-components-react/color/AlphaSlider.js.map +1 -1
  180. package/lib/esm/imodel-components-react/color/AlphaSlider.scss +63 -63
  181. package/lib/esm/imodel-components-react/color/ColorPickerButton.d.ts +37 -37
  182. package/lib/esm/imodel-components-react/color/ColorPickerButton.js +82 -82
  183. package/lib/esm/imodel-components-react/color/ColorPickerButton.js.map +1 -1
  184. package/lib/esm/imodel-components-react/color/ColorPickerButton.scss +90 -92
  185. package/lib/esm/imodel-components-react/color/ColorPickerDialog.d.ts +23 -23
  186. package/lib/esm/imodel-components-react/color/ColorPickerDialog.js +51 -51
  187. package/lib/esm/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
  188. package/lib/esm/imodel-components-react/color/ColorPickerPanel.d.ts +21 -21
  189. package/lib/esm/imodel-components-react/color/ColorPickerPanel.js +122 -122
  190. package/lib/esm/imodel-components-react/color/ColorPickerPanel.js.map +1 -1
  191. package/lib/esm/imodel-components-react/color/ColorPickerPanel.scss +93 -93
  192. package/lib/esm/imodel-components-react/color/ColorPickerPopup.d.ts +44 -44
  193. package/lib/esm/imodel-components-react/color/ColorPickerPopup.js +112 -112
  194. package/lib/esm/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
  195. package/lib/esm/imodel-components-react/color/ColorPickerPopup.scss +63 -64
  196. package/lib/esm/imodel-components-react/color/HueSlider.d.ts +22 -22
  197. package/lib/esm/imodel-components-react/color/HueSlider.js +173 -173
  198. package/lib/esm/imodel-components-react/color/HueSlider.js.map +1 -1
  199. package/lib/esm/imodel-components-react/color/HueSlider.scss +61 -61
  200. package/lib/esm/imodel-components-react/color/SaturationPicker.d.ts +20 -20
  201. package/lib/esm/imodel-components-react/color/SaturationPicker.js +187 -187
  202. package/lib/esm/imodel-components-react/color/SaturationPicker.js.map +1 -1
  203. package/lib/esm/imodel-components-react/color/SaturationPicker.scss +35 -35
  204. package/lib/esm/imodel-components-react/color/Swatch.d.ts +22 -22
  205. package/lib/esm/imodel-components-react/color/Swatch.js +34 -34
  206. package/lib/esm/imodel-components-react/color/Swatch.js.map +1 -1
  207. package/lib/esm/imodel-components-react/color/Swatch.scss +23 -24
  208. package/lib/esm/imodel-components-react/color/getCSSColorFromDef.d.ts +6 -6
  209. package/lib/esm/imodel-components-react/color/getCSSColorFromDef.js +19 -19
  210. package/lib/esm/imodel-components-react/color/getCSSColorFromDef.js.map +1 -1
  211. package/lib/esm/imodel-components-react/editors/ColorEditor.d.ts +44 -44
  212. package/lib/esm/imodel-components-react/editors/ColorEditor.js +124 -124
  213. package/lib/esm/imodel-components-react/editors/ColorEditor.js.map +1 -1
  214. package/lib/esm/imodel-components-react/editors/ColorEditor.scss +18 -19
  215. package/lib/esm/imodel-components-react/editors/WeightEditor.d.ts +47 -47
  216. package/lib/esm/imodel-components-react/editors/WeightEditor.js +133 -133
  217. package/lib/esm/imodel-components-react/editors/WeightEditor.js.map +1 -1
  218. package/lib/esm/imodel-components-react/editors/WeightEditor.scss +16 -17
  219. package/lib/esm/imodel-components-react/inputs/QuantityInput.d.ts +25 -25
  220. package/lib/esm/imodel-components-react/inputs/QuantityInput.js +70 -70
  221. package/lib/esm/imodel-components-react/inputs/QuantityInput.js.map +1 -1
  222. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.d.ts +44 -44
  223. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js +240 -240
  224. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
  225. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.scss +107 -107
  226. package/lib/esm/imodel-components-react/lineweight/Swatch.d.ts +33 -33
  227. package/lib/esm/imodel-components-react/lineweight/Swatch.js +59 -59
  228. package/lib/esm/imodel-components-react/lineweight/Swatch.js.map +1 -1
  229. package/lib/esm/imodel-components-react/lineweight/Swatch.scss +48 -49
  230. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.d.ts +60 -60
  231. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.js +133 -133
  232. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
  233. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.scss +52 -53
  234. package/lib/esm/imodel-components-react/navigationaids/Cube.d.ts +45 -45
  235. package/lib/esm/imodel-components-react/navigationaids/Cube.js +100 -100
  236. package/lib/esm/imodel-components-react/navigationaids/Cube.js.map +1 -1
  237. package/lib/esm/imodel-components-react/navigationaids/Cube.scss +19 -19
  238. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.d.ts +174 -174
  239. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.d.ts.map +1 -1
  240. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js +606 -606
  241. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
  242. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.scss +182 -181
  243. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts +145 -145
  244. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.js +620 -620
  245. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
  246. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.scss +134 -134
  247. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.d.ts +26 -26
  248. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js +76 -76
  249. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
  250. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.scss +63 -65
  251. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.d.ts +17 -17
  252. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js +30 -30
  253. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
  254. package/lib/esm/imodel-components-react/quantityformat/FormatSample.d.ts +18 -18
  255. package/lib/esm/imodel-components-react/quantityformat/FormatSample.js +60 -60
  256. package/lib/esm/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
  257. package/lib/esm/imodel-components-react/quantityformat/FormatType.d.ts +17 -17
  258. package/lib/esm/imodel-components-react/quantityformat/FormatType.js +63 -63
  259. package/lib/esm/imodel-components-react/quantityformat/FormatType.js.map +1 -1
  260. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.d.ts +17 -17
  261. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js +83 -83
  262. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
  263. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.d.ts +19 -19
  264. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js +110 -110
  265. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
  266. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.d.ts +21 -21
  267. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js +158 -158
  268. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
  269. package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts +22 -22
  270. package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts.map +1 -1
  271. package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.js +122 -131
  272. package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.js.map +1 -1
  273. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.d.ts +17 -17
  274. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.js +36 -36
  275. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.js.map +1 -1
  276. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.d.ts +17 -17
  277. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.js +24 -24
  278. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.js.map +1 -1
  279. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.d.ts +16 -16
  280. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.js +31 -31
  281. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.js.map +1 -1
  282. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.d.ts +18 -18
  283. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.js +25 -25
  284. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.js.map +1 -1
  285. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.d.ts +17 -17
  286. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.js +27 -27
  287. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.js.map +1 -1
  288. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.d.ts +17 -17
  289. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js +35 -35
  290. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js.map +1 -1
  291. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.d.ts +17 -17
  292. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.js +24 -24
  293. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.js.map +1 -1
  294. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.d.ts +17 -17
  295. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.js +33 -33
  296. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.js.map +1 -1
  297. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts +17 -17
  298. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +69 -69
  299. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
  300. package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.d.ts +23 -23
  301. package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.js +96 -96
  302. package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.js.map +1 -1
  303. package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.d.ts +52 -52
  304. package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.js +139 -139
  305. package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.js.map +1 -1
  306. package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.d.ts +31 -31
  307. package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.js +65 -65
  308. package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.js.map +1 -1
  309. package/lib/esm/imodel-components-react/timeline/InlineEdit.d.ts +27 -27
  310. package/lib/esm/imodel-components-react/timeline/InlineEdit.js +55 -55
  311. package/lib/esm/imodel-components-react/timeline/InlineEdit.js.map +1 -1
  312. package/lib/esm/imodel-components-react/timeline/InlineEdit.scss +26 -26
  313. package/lib/esm/imodel-components-react/timeline/PlayerButton.d.ts +33 -33
  314. package/lib/esm/imodel-components-react/timeline/PlayerButton.js +64 -64
  315. package/lib/esm/imodel-components-react/timeline/PlayerButton.js.map +1 -1
  316. package/lib/esm/imodel-components-react/timeline/PlayerButton.scss +31 -26
  317. package/lib/esm/imodel-components-react/timeline/Scrubber.d.ts +54 -54
  318. package/lib/esm/imodel-components-react/timeline/Scrubber.js +164 -164
  319. package/lib/esm/imodel-components-react/timeline/Scrubber.js.map +1 -1
  320. package/lib/esm/imodel-components-react/timeline/Scrubber.scss +112 -107
  321. package/lib/esm/imodel-components-react/timeline/SolarTimeline.d.ts +77 -77
  322. package/lib/esm/imodel-components-react/timeline/SolarTimeline.js +398 -398
  323. package/lib/esm/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
  324. package/lib/esm/imodel-components-react/timeline/SolarTimeline.scss +356 -358
  325. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.d.ts +15 -15
  326. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.js +28 -28
  327. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.js.map +1 -1
  328. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.scss +39 -39
  329. package/lib/esm/imodel-components-react/timeline/Timeline.scss +164 -164
  330. package/lib/esm/imodel-components-react/timeline/TimelineComponent.d.ts +133 -133
  331. package/lib/esm/imodel-components-react/timeline/TimelineComponent.js +332 -332
  332. package/lib/esm/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
  333. package/lib/esm/imodel-components-react/timeline/TimelineComponent.scss +164 -164
  334. package/lib/esm/imodel-components-react/timeline/interfaces.d.ts +174 -174
  335. package/lib/esm/imodel-components-react/timeline/interfaces.js +42 -42
  336. package/lib/esm/imodel-components-react/timeline/interfaces.js.map +1 -1
  337. package/lib/esm/imodel-components-react/viewport/ViewportComponent.d.ts +42 -42
  338. package/lib/esm/imodel-components-react/viewport/ViewportComponent.js +251 -251
  339. package/lib/esm/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
  340. package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.d.ts +106 -106
  341. package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.js +95 -95
  342. package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.js.map +1 -1
  343. package/lib/esm/imodel-components-react.d.ts +82 -82
  344. package/lib/esm/imodel-components-react.js +87 -87
  345. package/lib/esm/imodel-components-react.js.map +1 -1
  346. package/lib/public/locales/en/UiIModelComponents.json +139 -139
  347. package/package.json +31 -38
@@ -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,165 +1,165 @@
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 "./Scrubber.scss";
6
- import * as React from "react";
7
- import { Slider } from "@itwin/itwinui-react";
8
- import { useEventListener } from "@itwin/core-react";
9
- import { toDateString, toTimeString } from "@itwin/components-react";
10
- /**
11
- * @internal
12
- */
13
- export function getPercentageOfRectangle(rect, pointer) {
14
- const position = Math.min(rect.right, Math.max(rect.left, pointer));
15
- return (position - rect.left) / rect.width;
16
- }
17
- // istanbul ignore next - WIP
18
- const formatDuration = (value) => {
19
- const addZero = (i) => {
20
- return (i < 10) ? `0${i}` : i;
21
- };
22
- const date = new Date(value);
23
- const minutes = date.getUTCMinutes();
24
- const seconds = date.getUTCSeconds();
25
- return `${addZero(minutes)}:${addZero(seconds)}`;
26
- };
27
- const formatDate = (startDate, endDate, fraction, timeZoneOffset) => {
28
- const delta = (endDate.getTime() - startDate.getTime()) * fraction;
29
- const date = new Date(startDate.getTime() + delta);
30
- return toDateString(date, timeZoneOffset);
31
- };
32
- // istanbul ignore next - WIP
33
- const formatTime = (startDate, endDate, fraction, timeZoneOffset) => {
34
- const delta = (endDate.getTime() - startDate.getTime()) * fraction;
35
- const date = new Date(startDate.getTime() + delta);
36
- return ` ${toTimeString(date, timeZoneOffset)}`;
37
- };
38
- function generateToolTipText(showTime, percent, min, max, startDate, endDate, timeZoneOffset = 0) {
39
- if (startDate && endDate)
40
- return `${formatDate(startDate, endDate, percent, timeZoneOffset)}${showTime ? formatTime(startDate, endDate, percent, timeZoneOffset) : ""} `;
41
- const val = Math.round(min + ((max - min) * percent));
42
- return formatDuration(val);
43
- }
44
- function getPercentageFromDate(startDate, endDate, date) {
45
- const newDate = date ? date : new Date();
46
- const startTime = startDate.getTime();
47
- const totalDuration = endDate.getTime() - startTime;
48
- return (newDate.getTime() - startTime) / totalDuration;
49
- }
50
- function getDateMarker(dateMarkerPropsIn, startDate, endDate) {
51
- const percentage = getPercentageFromDate(startDate, endDate, dateMarkerPropsIn.date);
52
- const marker = dateMarkerPropsIn.dateMarker ? dateMarkerPropsIn.dateMarker : React.createElement("span", { className: "date-marker-default" });
53
- return { datePercentage: percentage, dateMarker: marker };
54
- }
55
- function markDateInTimelineRange(dateMarkerProps, startDate, endDate) {
56
- // istanbul ignore else
57
- if (dateMarkerProps && startDate && endDate) {
58
- const inDate = dateMarkerProps.date ? dateMarkerProps.date : new Date();
59
- // istanbul ignore else
60
- if (inDate.getTime() >= startDate.getTime() && inDate.getTime() <= endDate.getTime())
61
- return true;
62
- }
63
- return false;
64
- }
65
- /**
66
- * @internal
67
- */
68
- export function RailMarkers({ showToolTip, percent, tooltipText, markDate }) {
69
- return (React.createElement("div", { className: "components-timeline-rail-marker-container" },
70
- showToolTip &&
71
- React.createElement("div", { className: "components-timeline-tooltip", style: { left: `${Math.round(percent * 100)}% ` } },
72
- React.createElement("span", { className: "tooltip-text" }, tooltipText)),
73
- markDate &&
74
- React.createElement("div", { className: "components-timeline-date-marker", "data-testid": "test-date-marker", style: { left: `${Math.round(markDate.datePercentage * 100)}% ` } }, markDate.dateMarker)));
75
- }
76
- /**
77
- * Custom Timeline Thumb
78
- * @internal
79
- */
80
- export function CustomThumb() {
81
- return (React.createElement("div", { className: "scrubber-handle" },
82
- React.createElement("div", null),
83
- React.createElement("div", null),
84
- React.createElement("div", null)));
85
- }
86
- /**
87
- * @internal
88
- */
89
- export function useFocusedThumb(sliderContainer) {
90
- const [thumbElement, setThumbElement] = React.useState();
91
- React.useLayoutEffect(() => {
92
- // istanbul ignore else
93
- if (sliderContainer) {
94
- const element = sliderContainer.querySelector(".iui-slider-thumb");
95
- if (element && thumbElement !== element) {
96
- setThumbElement(element);
97
- }
98
- }
99
- }, [sliderContainer, thumbElement]);
100
- const [thumbHasFocus, setThumbHasFocus] = React.useState(false);
101
- const handleThumbFocus = React.useCallback(() => {
102
- setThumbHasFocus(true);
103
- }, []);
104
- const handleThumbBlur = React.useCallback(() => {
105
- setThumbHasFocus(false);
106
- }, []);
107
- useEventListener("focus", handleThumbFocus, thumbElement);
108
- useEventListener("blur", handleThumbBlur, thumbElement);
109
- return thumbHasFocus;
110
- }
111
- /** Scrubber/Slider for timeline control
112
- * @internal
113
- */
114
- export function Scrubber(props) {
115
- const { startDate, endDate, showTime, isPlaying, totalDuration, timeZoneOffset, currentDuration, className, onChange, onUpdate } = props;
116
- const thumbProps = () => {
117
- return {
118
- className: "components-timeline-thumb",
119
- children: React.createElement(CustomThumb, null),
120
- };
121
- };
122
- const sliderRef = React.useRef(null);
123
- const [sliderContainer, setSliderContainer] = React.useState();
124
- const [pointerPercent, setPointerPercent] = React.useState(0);
125
- React.useLayoutEffect(() => {
126
- // istanbul ignore else
127
- if (sliderRef.current) {
128
- const container = sliderRef.current.querySelector(".iui-slider-container");
129
- if (container && sliderContainer !== container) {
130
- setSliderContainer(container);
131
- }
132
- }
133
- }, [sliderContainer]);
134
- const tooltipProps = React.useCallback(() => {
135
- return { visible: false };
136
- }, []);
137
- const [showRailTooltip, setShowRailTooltip] = React.useState(false);
138
- // istanbul ignore next
139
- const handlePointerEnter = React.useCallback(() => {
140
- setShowRailTooltip(true);
141
- }, []);
142
- // istanbul ignore next
143
- const handlePointerLeave = React.useCallback(() => {
144
- setShowRailTooltip(false);
145
- }, []);
146
- const handlePointerMove = React.useCallback((event) => {
147
- sliderContainer &&
148
- setPointerPercent(getPercentageOfRectangle(sliderContainer.getBoundingClientRect(), event.clientX));
149
- }, [sliderContainer]);
150
- const thumbHasFocus = useFocusedThumb(sliderContainer);
151
- const tickLabel = React.useMemo(() => {
152
- const showTip = isPlaying || showRailTooltip || thumbHasFocus;
153
- const percent = (isPlaying || thumbHasFocus) ? currentDuration / totalDuration : pointerPercent;
154
- const markDateInRange = markDateInTimelineRange(props.markDate, startDate, endDate);
155
- const currentDateMarker = props.markDate && markDateInRange && startDate && endDate ? getDateMarker(props.markDate, startDate, endDate) : undefined;
156
- const tooltipText = generateToolTipText(!!showTime, percent, 0, totalDuration, startDate, endDate, timeZoneOffset);
157
- return (React.createElement(RailMarkers, { showToolTip: showTip, percent: percent, tooltipText: tooltipText, markDate: currentDateMarker }));
158
- }, [isPlaying, showRailTooltip, currentDuration, totalDuration, pointerPercent, startDate, endDate, timeZoneOffset, showTime, thumbHasFocus, props.markDate]);
159
- return (React.createElement(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: {
160
- onPointerEnter: handlePointerEnter,
161
- onPointerMove: handlePointerMove,
162
- onPointerLeave: handlePointerLeave,
163
- } }));
164
- }
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 "./Scrubber.scss";
6
+ import * as React from "react";
7
+ import { Slider } from "@itwin/itwinui-react";
8
+ import { useEventListener } from "@itwin/core-react";
9
+ import { toDateString, toTimeString } from "@itwin/components-react";
10
+ /**
11
+ * @internal
12
+ */
13
+ export function getPercentageOfRectangle(rect, pointer) {
14
+ const position = Math.min(rect.right, Math.max(rect.left, pointer));
15
+ return (position - rect.left) / rect.width;
16
+ }
17
+ // istanbul ignore next - WIP
18
+ const formatDuration = (value) => {
19
+ const addZero = (i) => {
20
+ return (i < 10) ? `0${i}` : i;
21
+ };
22
+ const date = new Date(value);
23
+ const minutes = date.getUTCMinutes();
24
+ const seconds = date.getUTCSeconds();
25
+ return `${addZero(minutes)}:${addZero(seconds)}`;
26
+ };
27
+ const formatDate = (startDate, endDate, fraction, timeZoneOffset) => {
28
+ const delta = (endDate.getTime() - startDate.getTime()) * fraction;
29
+ const date = new Date(startDate.getTime() + delta);
30
+ return toDateString(date, timeZoneOffset);
31
+ };
32
+ // istanbul ignore next - WIP
33
+ const formatTime = (startDate, endDate, fraction, timeZoneOffset) => {
34
+ const delta = (endDate.getTime() - startDate.getTime()) * fraction;
35
+ const date = new Date(startDate.getTime() + delta);
36
+ return ` ${toTimeString(date, timeZoneOffset)}`;
37
+ };
38
+ function generateToolTipText(showTime, percent, min, max, startDate, endDate, timeZoneOffset = 0) {
39
+ if (startDate && endDate)
40
+ return `${formatDate(startDate, endDate, percent, timeZoneOffset)}${showTime ? formatTime(startDate, endDate, percent, timeZoneOffset) : ""} `;
41
+ const val = Math.round(min + ((max - min) * percent));
42
+ return formatDuration(val);
43
+ }
44
+ function getPercentageFromDate(startDate, endDate, date) {
45
+ const newDate = date ? date : new Date();
46
+ const startTime = startDate.getTime();
47
+ const totalDuration = endDate.getTime() - startTime;
48
+ return (newDate.getTime() - startTime) / totalDuration;
49
+ }
50
+ function getDateMarker(dateMarkerPropsIn, startDate, endDate) {
51
+ const percentage = getPercentageFromDate(startDate, endDate, dateMarkerPropsIn.date);
52
+ const marker = dateMarkerPropsIn.dateMarker ? dateMarkerPropsIn.dateMarker : React.createElement("span", { className: "date-marker-default" });
53
+ return { datePercentage: percentage, dateMarker: marker };
54
+ }
55
+ function markDateInTimelineRange(dateMarkerProps, startDate, endDate) {
56
+ // istanbul ignore else
57
+ if (dateMarkerProps && startDate && endDate) {
58
+ const inDate = dateMarkerProps.date ? dateMarkerProps.date : new Date();
59
+ // istanbul ignore else
60
+ if (inDate.getTime() >= startDate.getTime() && inDate.getTime() <= endDate.getTime())
61
+ return true;
62
+ }
63
+ return false;
64
+ }
65
+ /**
66
+ * @internal
67
+ */
68
+ export function RailMarkers({ showToolTip, percent, tooltipText, markDate }) {
69
+ return (React.createElement("div", { className: "components-timeline-rail-marker-container" },
70
+ showToolTip &&
71
+ React.createElement("div", { className: "components-timeline-tooltip", style: { left: `${Math.round(percent * 100)}% ` } },
72
+ React.createElement("span", { className: "tooltip-text" }, tooltipText)),
73
+ markDate &&
74
+ React.createElement("div", { className: "components-timeline-date-marker", "data-testid": "test-date-marker", style: { left: `${Math.round(markDate.datePercentage * 100)}% ` } }, markDate.dateMarker)));
75
+ }
76
+ /**
77
+ * Custom Timeline Thumb
78
+ * @internal
79
+ */
80
+ export function CustomThumb() {
81
+ return (React.createElement("div", { className: "scrubber-handle" },
82
+ React.createElement("div", null),
83
+ React.createElement("div", null),
84
+ React.createElement("div", null)));
85
+ }
86
+ /**
87
+ * @internal
88
+ */
89
+ export function useFocusedThumb(sliderContainer) {
90
+ const [thumbElement, setThumbElement] = React.useState();
91
+ React.useLayoutEffect(() => {
92
+ // istanbul ignore else
93
+ if (sliderContainer) {
94
+ const element = sliderContainer.querySelector(".iui-slider-thumb");
95
+ if (element && thumbElement !== element) {
96
+ setThumbElement(element);
97
+ }
98
+ }
99
+ }, [sliderContainer, thumbElement]);
100
+ const [thumbHasFocus, setThumbHasFocus] = React.useState(false);
101
+ const handleThumbFocus = React.useCallback(() => {
102
+ setThumbHasFocus(true);
103
+ }, []);
104
+ const handleThumbBlur = React.useCallback(() => {
105
+ setThumbHasFocus(false);
106
+ }, []);
107
+ useEventListener("focus", handleThumbFocus, thumbElement);
108
+ useEventListener("blur", handleThumbBlur, thumbElement);
109
+ return thumbHasFocus;
110
+ }
111
+ /** Scrubber/Slider for timeline control
112
+ * @internal
113
+ */
114
+ export function Scrubber(props) {
115
+ const { startDate, endDate, showTime, isPlaying, totalDuration, timeZoneOffset, currentDuration, className, onChange, onUpdate } = props;
116
+ const thumbProps = () => {
117
+ return {
118
+ className: "components-timeline-thumb",
119
+ children: React.createElement(CustomThumb, null),
120
+ };
121
+ };
122
+ const sliderRef = React.useRef(null);
123
+ const [sliderContainer, setSliderContainer] = React.useState();
124
+ const [pointerPercent, setPointerPercent] = React.useState(0);
125
+ React.useLayoutEffect(() => {
126
+ // istanbul ignore else
127
+ if (sliderRef.current) {
128
+ const container = sliderRef.current.querySelector(".iui-slider-container");
129
+ if (container && sliderContainer !== container) {
130
+ setSliderContainer(container);
131
+ }
132
+ }
133
+ }, [sliderContainer]);
134
+ const tooltipProps = React.useCallback(() => {
135
+ return { visible: false };
136
+ }, []);
137
+ const [showRailTooltip, setShowRailTooltip] = React.useState(false);
138
+ // istanbul ignore next
139
+ const handlePointerEnter = React.useCallback(() => {
140
+ setShowRailTooltip(true);
141
+ }, []);
142
+ // istanbul ignore next
143
+ const handlePointerLeave = React.useCallback(() => {
144
+ setShowRailTooltip(false);
145
+ }, []);
146
+ const handlePointerMove = React.useCallback((event) => {
147
+ sliderContainer &&
148
+ setPointerPercent(getPercentageOfRectangle(sliderContainer.getBoundingClientRect(), event.clientX));
149
+ }, [sliderContainer]);
150
+ const thumbHasFocus = useFocusedThumb(sliderContainer);
151
+ const tickLabel = React.useMemo(() => {
152
+ const showTip = isPlaying || showRailTooltip || thumbHasFocus;
153
+ const percent = (isPlaying || thumbHasFocus) ? currentDuration / totalDuration : pointerPercent;
154
+ const markDateInRange = markDateInTimelineRange(props.markDate, startDate, endDate);
155
+ const currentDateMarker = props.markDate && markDateInRange && startDate && endDate ? getDateMarker(props.markDate, startDate, endDate) : undefined;
156
+ const tooltipText = generateToolTipText(!!showTime, percent, 0, totalDuration, startDate, endDate, timeZoneOffset);
157
+ return (React.createElement(RailMarkers, { showToolTip: showTip, percent: percent, tooltipText: tooltipText, markDate: currentDateMarker }));
158
+ }, [isPlaying, showRailTooltip, currentDuration, totalDuration, pointerPercent, startDate, endDate, timeZoneOffset, showTime, thumbHasFocus, props.markDate]);
159
+ return (React.createElement(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: {
160
+ onPointerEnter: handlePointerEnter,
161
+ onPointerMove: handlePointerMove,
162
+ onPointerLeave: handlePointerLeave,
163
+ } }));
164
+ }
165
165
  //# 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,OAAO,iBAAiB,CAAC;AACzB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAe,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGrE;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,IAAa,EAAE,OAAe;IACrE,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC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AE,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,MAAM,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","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,OAAO,iBAAiB,CAAC;AACzB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,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EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACpJ,MAAM,WAAW,GAAG,mBAAmB,CAAC,CAAC,CAAC,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,MAAM,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","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"]}