@itwin/imodel-components-react 3.4.1 → 3.4.2

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 (343) hide show
  1. package/CHANGELOG.md +6 -1
  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 +91 -91
  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 +64 -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 -23
  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 -18
  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 -16
  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 -48
  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 -52
  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.js +634 -634
  68. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
  69. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.scss +180 -180
  70. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts +145 -145
  71. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.js +647 -647
  72. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
  73. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.scss +133 -133
  74. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.d.ts +26 -26
  75. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js +99 -99
  76. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
  77. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.scss +64 -64
  78. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.d.ts +17 -17
  79. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js +53 -53
  80. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
  81. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.d.ts +18 -18
  82. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js +83 -83
  83. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
  84. package/lib/cjs/imodel-components-react/quantityformat/FormatType.d.ts +17 -17
  85. package/lib/cjs/imodel-components-react/quantityformat/FormatType.js +86 -86
  86. package/lib/cjs/imodel-components-react/quantityformat/FormatType.js.map +1 -1
  87. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.d.ts +17 -17
  88. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js +109 -109
  89. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
  90. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.d.ts +19 -19
  91. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js +133 -133
  92. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
  93. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.d.ts +21 -21
  94. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js +184 -184
  95. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
  96. package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts +22 -22
  97. package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.js +154 -154
  98. package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.js.map +1 -1
  99. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.d.ts +17 -17
  100. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.js +59 -59
  101. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.js.map +1 -1
  102. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.d.ts +17 -17
  103. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.js +47 -47
  104. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.js.map +1 -1
  105. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.d.ts +16 -16
  106. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.js +54 -54
  107. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.js.map +1 -1
  108. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.d.ts +18 -18
  109. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.js +48 -48
  110. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.js.map +1 -1
  111. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.d.ts +17 -17
  112. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.js +50 -50
  113. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.js.map +1 -1
  114. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.d.ts +17 -17
  115. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js +58 -58
  116. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js.map +1 -1
  117. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.d.ts +17 -17
  118. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.js +47 -47
  119. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.js.map +1 -1
  120. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.d.ts +17 -17
  121. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.js +56 -56
  122. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.js.map +1 -1
  123. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts +17 -17
  124. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +95 -95
  125. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
  126. package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.d.ts +23 -23
  127. package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.js +119 -119
  128. package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.js.map +1 -1
  129. package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.d.ts +52 -52
  130. package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.js +143 -143
  131. package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.js.map +1 -1
  132. package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.d.ts +31 -31
  133. package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.js +69 -69
  134. package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.js.map +1 -1
  135. package/lib/cjs/imodel-components-react/timeline/InlineEdit.d.ts +27 -27
  136. package/lib/cjs/imodel-components-react/timeline/InlineEdit.js +81 -81
  137. package/lib/cjs/imodel-components-react/timeline/InlineEdit.js.map +1 -1
  138. package/lib/cjs/imodel-components-react/timeline/InlineEdit.scss +26 -26
  139. package/lib/cjs/imodel-components-react/timeline/PlayerButton.d.ts +33 -33
  140. package/lib/cjs/imodel-components-react/timeline/PlayerButton.js +91 -91
  141. package/lib/cjs/imodel-components-react/timeline/PlayerButton.js.map +1 -1
  142. package/lib/cjs/imodel-components-react/timeline/PlayerButton.scss +25 -25
  143. package/lib/cjs/imodel-components-react/timeline/Scrubber.d.ts +54 -54
  144. package/lib/cjs/imodel-components-react/timeline/Scrubber.js +191 -191
  145. package/lib/cjs/imodel-components-react/timeline/Scrubber.js.map +1 -1
  146. package/lib/cjs/imodel-components-react/timeline/Scrubber.scss +106 -106
  147. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.d.ts +77 -77
  148. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.js +424 -424
  149. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
  150. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.scss +357 -357
  151. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.d.ts +15 -15
  152. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.js +54 -54
  153. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.js.map +1 -1
  154. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.scss +39 -39
  155. package/lib/cjs/imodel-components-react/timeline/Timeline.scss +164 -164
  156. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.d.ts +133 -133
  157. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js +358 -358
  158. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
  159. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.scss +163 -163
  160. package/lib/cjs/imodel-components-react/timeline/interfaces.d.ts +174 -174
  161. package/lib/cjs/imodel-components-react/timeline/interfaces.js +45 -45
  162. package/lib/cjs/imodel-components-react/timeline/interfaces.js.map +1 -1
  163. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.d.ts +42 -42
  164. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js +274 -274
  165. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
  166. package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.d.ts +106 -106
  167. package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.js +105 -105
  168. package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.js.map +1 -1
  169. package/lib/cjs/imodel-components-react.d.ts +82 -82
  170. package/lib/cjs/imodel-components-react.js +101 -101
  171. package/lib/cjs/imodel-components-react.js.map +1 -1
  172. package/lib/esm/imodel-components-react/UiIModelComponents.d.ts +28 -28
  173. package/lib/esm/imodel-components-react/UiIModelComponents.js +75 -75
  174. package/lib/esm/imodel-components-react/UiIModelComponents.js.map +1 -1
  175. package/lib/esm/imodel-components-react/color/AlphaSlider.d.ts +36 -36
  176. package/lib/esm/imodel-components-react/color/AlphaSlider.js +160 -160
  177. package/lib/esm/imodel-components-react/color/AlphaSlider.js.map +1 -1
  178. package/lib/esm/imodel-components-react/color/AlphaSlider.scss +63 -63
  179. package/lib/esm/imodel-components-react/color/ColorPickerButton.d.ts +37 -37
  180. package/lib/esm/imodel-components-react/color/ColorPickerButton.js +82 -82
  181. package/lib/esm/imodel-components-react/color/ColorPickerButton.js.map +1 -1
  182. package/lib/esm/imodel-components-react/color/ColorPickerButton.scss +91 -91
  183. package/lib/esm/imodel-components-react/color/ColorPickerDialog.d.ts +23 -23
  184. package/lib/esm/imodel-components-react/color/ColorPickerDialog.js +51 -51
  185. package/lib/esm/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
  186. package/lib/esm/imodel-components-react/color/ColorPickerPanel.d.ts +21 -21
  187. package/lib/esm/imodel-components-react/color/ColorPickerPanel.js +122 -122
  188. package/lib/esm/imodel-components-react/color/ColorPickerPanel.js.map +1 -1
  189. package/lib/esm/imodel-components-react/color/ColorPickerPanel.scss +93 -93
  190. package/lib/esm/imodel-components-react/color/ColorPickerPopup.d.ts +44 -44
  191. package/lib/esm/imodel-components-react/color/ColorPickerPopup.js +112 -112
  192. package/lib/esm/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
  193. package/lib/esm/imodel-components-react/color/ColorPickerPopup.scss +64 -64
  194. package/lib/esm/imodel-components-react/color/HueSlider.d.ts +22 -22
  195. package/lib/esm/imodel-components-react/color/HueSlider.js +173 -173
  196. package/lib/esm/imodel-components-react/color/HueSlider.js.map +1 -1
  197. package/lib/esm/imodel-components-react/color/HueSlider.scss +61 -61
  198. package/lib/esm/imodel-components-react/color/SaturationPicker.d.ts +20 -20
  199. package/lib/esm/imodel-components-react/color/SaturationPicker.js +187 -187
  200. package/lib/esm/imodel-components-react/color/SaturationPicker.js.map +1 -1
  201. package/lib/esm/imodel-components-react/color/SaturationPicker.scss +35 -35
  202. package/lib/esm/imodel-components-react/color/Swatch.d.ts +22 -22
  203. package/lib/esm/imodel-components-react/color/Swatch.js +34 -34
  204. package/lib/esm/imodel-components-react/color/Swatch.js.map +1 -1
  205. package/lib/esm/imodel-components-react/color/Swatch.scss +23 -23
  206. package/lib/esm/imodel-components-react/color/getCSSColorFromDef.d.ts +6 -6
  207. package/lib/esm/imodel-components-react/color/getCSSColorFromDef.js +19 -19
  208. package/lib/esm/imodel-components-react/color/getCSSColorFromDef.js.map +1 -1
  209. package/lib/esm/imodel-components-react/editors/ColorEditor.d.ts +44 -44
  210. package/lib/esm/imodel-components-react/editors/ColorEditor.js +124 -124
  211. package/lib/esm/imodel-components-react/editors/ColorEditor.js.map +1 -1
  212. package/lib/esm/imodel-components-react/editors/ColorEditor.scss +18 -18
  213. package/lib/esm/imodel-components-react/editors/WeightEditor.d.ts +47 -47
  214. package/lib/esm/imodel-components-react/editors/WeightEditor.js +133 -133
  215. package/lib/esm/imodel-components-react/editors/WeightEditor.js.map +1 -1
  216. package/lib/esm/imodel-components-react/editors/WeightEditor.scss +16 -16
  217. package/lib/esm/imodel-components-react/inputs/QuantityInput.d.ts +25 -25
  218. package/lib/esm/imodel-components-react/inputs/QuantityInput.js +70 -70
  219. package/lib/esm/imodel-components-react/inputs/QuantityInput.js.map +1 -1
  220. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.d.ts +44 -44
  221. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js +240 -240
  222. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
  223. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.scss +107 -107
  224. package/lib/esm/imodel-components-react/lineweight/Swatch.d.ts +33 -33
  225. package/lib/esm/imodel-components-react/lineweight/Swatch.js +59 -59
  226. package/lib/esm/imodel-components-react/lineweight/Swatch.js.map +1 -1
  227. package/lib/esm/imodel-components-react/lineweight/Swatch.scss +48 -48
  228. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.d.ts +60 -60
  229. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.js +133 -133
  230. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
  231. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.scss +52 -52
  232. package/lib/esm/imodel-components-react/navigationaids/Cube.d.ts +45 -45
  233. package/lib/esm/imodel-components-react/navigationaids/Cube.js +100 -100
  234. package/lib/esm/imodel-components-react/navigationaids/Cube.js.map +1 -1
  235. package/lib/esm/imodel-components-react/navigationaids/Cube.scss +19 -19
  236. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.d.ts +174 -174
  237. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js +606 -606
  238. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
  239. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.scss +180 -180
  240. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts +145 -145
  241. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.js +620 -620
  242. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
  243. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.scss +133 -133
  244. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.d.ts +26 -26
  245. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js +76 -76
  246. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
  247. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.scss +64 -64
  248. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.d.ts +17 -17
  249. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js +30 -30
  250. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
  251. package/lib/esm/imodel-components-react/quantityformat/FormatSample.d.ts +18 -18
  252. package/lib/esm/imodel-components-react/quantityformat/FormatSample.js +60 -60
  253. package/lib/esm/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
  254. package/lib/esm/imodel-components-react/quantityformat/FormatType.d.ts +17 -17
  255. package/lib/esm/imodel-components-react/quantityformat/FormatType.js +63 -63
  256. package/lib/esm/imodel-components-react/quantityformat/FormatType.js.map +1 -1
  257. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.d.ts +17 -17
  258. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js +83 -83
  259. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
  260. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.d.ts +19 -19
  261. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js +110 -110
  262. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
  263. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.d.ts +21 -21
  264. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js +158 -158
  265. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
  266. package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts +22 -22
  267. package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.js +131 -131
  268. package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.js.map +1 -1
  269. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.d.ts +17 -17
  270. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.js +36 -36
  271. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.js.map +1 -1
  272. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.d.ts +17 -17
  273. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.js +24 -24
  274. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.js.map +1 -1
  275. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.d.ts +16 -16
  276. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.js +31 -31
  277. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.js.map +1 -1
  278. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.d.ts +18 -18
  279. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.js +25 -25
  280. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.js.map +1 -1
  281. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.d.ts +17 -17
  282. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.js +27 -27
  283. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.js.map +1 -1
  284. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.d.ts +17 -17
  285. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js +35 -35
  286. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js.map +1 -1
  287. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.d.ts +17 -17
  288. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.js +24 -24
  289. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.js.map +1 -1
  290. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.d.ts +17 -17
  291. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.js +33 -33
  292. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.js.map +1 -1
  293. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts +17 -17
  294. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +69 -69
  295. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
  296. package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.d.ts +23 -23
  297. package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.js +96 -96
  298. package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.js.map +1 -1
  299. package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.d.ts +52 -52
  300. package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.js +139 -139
  301. package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.js.map +1 -1
  302. package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.d.ts +31 -31
  303. package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.js +65 -65
  304. package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.js.map +1 -1
  305. package/lib/esm/imodel-components-react/timeline/InlineEdit.d.ts +27 -27
  306. package/lib/esm/imodel-components-react/timeline/InlineEdit.js +55 -55
  307. package/lib/esm/imodel-components-react/timeline/InlineEdit.js.map +1 -1
  308. package/lib/esm/imodel-components-react/timeline/InlineEdit.scss +26 -26
  309. package/lib/esm/imodel-components-react/timeline/PlayerButton.d.ts +33 -33
  310. package/lib/esm/imodel-components-react/timeline/PlayerButton.js +64 -64
  311. package/lib/esm/imodel-components-react/timeline/PlayerButton.js.map +1 -1
  312. package/lib/esm/imodel-components-react/timeline/PlayerButton.scss +25 -25
  313. package/lib/esm/imodel-components-react/timeline/Scrubber.d.ts +54 -54
  314. package/lib/esm/imodel-components-react/timeline/Scrubber.js +164 -164
  315. package/lib/esm/imodel-components-react/timeline/Scrubber.js.map +1 -1
  316. package/lib/esm/imodel-components-react/timeline/Scrubber.scss +106 -106
  317. package/lib/esm/imodel-components-react/timeline/SolarTimeline.d.ts +77 -77
  318. package/lib/esm/imodel-components-react/timeline/SolarTimeline.js +398 -398
  319. package/lib/esm/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
  320. package/lib/esm/imodel-components-react/timeline/SolarTimeline.scss +357 -357
  321. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.d.ts +15 -15
  322. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.js +28 -28
  323. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.js.map +1 -1
  324. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.scss +39 -39
  325. package/lib/esm/imodel-components-react/timeline/Timeline.scss +164 -164
  326. package/lib/esm/imodel-components-react/timeline/TimelineComponent.d.ts +133 -133
  327. package/lib/esm/imodel-components-react/timeline/TimelineComponent.js +332 -332
  328. package/lib/esm/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
  329. package/lib/esm/imodel-components-react/timeline/TimelineComponent.scss +163 -163
  330. package/lib/esm/imodel-components-react/timeline/interfaces.d.ts +174 -174
  331. package/lib/esm/imodel-components-react/timeline/interfaces.js +42 -42
  332. package/lib/esm/imodel-components-react/timeline/interfaces.js.map +1 -1
  333. package/lib/esm/imodel-components-react/viewport/ViewportComponent.d.ts +42 -42
  334. package/lib/esm/imodel-components-react/viewport/ViewportComponent.js +251 -251
  335. package/lib/esm/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
  336. package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.d.ts +106 -106
  337. package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.js +95 -95
  338. package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.js.map +1 -1
  339. package/lib/esm/imodel-components-react.d.ts +82 -82
  340. package/lib/esm/imodel-components-react.js +87 -87
  341. package/lib/esm/imodel-components-react.js.map +1 -1
  342. package/lib/public/locales/en/UiIModelComponents.json +139 -139
  343. package/package.json +19 -19
@@ -1 +1 @@
1
- {"version":3,"file":"UiIModelComponents.js","sourceRoot":"","sources":["../../../src/imodel-components-react/UiIModelComponents.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,YAAY,EAA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AC;IAED,gBAAgB;IACT,MAAM,KAAK,WAAW;QAC3B,OAAO,yBAAyB,CAAC;IACnC,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,SAAS,CAAC,GAAsB;QAC5C,IAAI,CAAC,kBAAkB,CAAC,WAAW,IAAI,0BAA0B,CAAC,CAAC,SAAS,CAAC,YAAY,EAAE;YACzF,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,+EAA+E,CAAC,CAAC;YAC1I,OAAO,EAAE,CAAC;SACX;QACD,OAAO,SAAS,CAAC,YAAY,CAAC,+BAA+B,CAAC,kBAAkB,CAAC,qBAAqB,EAAE,GAAG,CAAC,CAAC;IAC/G,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,cAAc,CAAC,GAAQ;QACnC,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;QACpC,MAAM,QAAQ,GAAG,kBAAkB,CAAC,WAAW,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACrF,OAAO,QAAQ,CAAC;IAClB,CAAC;;AA9Dc,+BAAY,GAAG,KAAK,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Common\n */\n\nimport { enablePatches } from \"immer\";\nimport { Logger } from \"@itwin/core-bentley\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { getClassName } from \"@itwin/appui-abstract\";\nimport { UiComponents } from \"@itwin/components-react\";\nimport { EmptyLocalization } from \"@itwin/core-common\";\n\n/**\n * Manages the localization service for the imodel-components-react package.\n * @public\n */\nexport class UiIModelComponents {\n private static _initialized = false;\n\n /**\n * initialize UiIModelComponents.\n */\n public static async initialize(): Promise<void> {\n if (UiIModelComponents._initialized) {\n Logger.logInfo(UiIModelComponents.loggerCategory(UiIModelComponents), `UiIModelComponents.initialize already called`);\n return;\n }\n\n enablePatches();\n await IModelApp.localization?.registerNamespace(UiIModelComponents.localizationNamespace);\n\n if (!IModelApp.localization) {\n // it should only get here in unit test where IModelApp is not setup\n const localization = new EmptyLocalization();\n await localization.initialize();\n await UiComponents.initialize(localization);\n } else {\n await UiComponents.initialize(IModelApp.localization);\n }\n\n UiIModelComponents._initialized = true;\n }\n\n /** Unregisters the UiIModelComponents localization namespace */\n public static terminate() {\n IModelApp.localization?.unregisterNamespace(UiIModelComponents.localizationNamespace);\n UiComponents.terminate();\n UiIModelComponents._initialized = false;\n }\n\n /** Determines if UiIModelComponents has been initialized */\n public static get initialized(): boolean { return UiIModelComponents._initialized; }\n\n /** The internationalization service namespace. */\n public static get localizationNamespace(): string {\n return \"UiIModelComponents\";\n }\n\n /** @internal */\n public static get packageName(): string {\n return \"imodel-components-react\";\n }\n\n /** Calls localization.getLocalizedStringWithNamespace with the \"UiIModelComponents\" namespace. Do NOT include the namespace in the key.\n * @internal\n */\n public static translate(key: string | string[]): string {\n if (!UiIModelComponents.initialized || /* istanbul ignore next */ !IModelApp.localization) {\n Logger.logError(UiIModelComponents.loggerCategory(this), `translate: IModelApp.localization has not been setup. Returning blank string.`);\n return \"\";\n }\n return IModelApp.localization.getLocalizedStringWithNamespace(UiIModelComponents.localizationNamespace, key);\n }\n\n /** @internal */\n public static loggerCategory(obj: any): string {\n const className = getClassName(obj);\n const category = UiIModelComponents.packageName + (className ? `.${className}` : \"\");\n return category;\n }\n\n}\n"]}
1
+ {"version":3,"file":"UiIModelComponents.js","sourceRoot":"","sources":["../../../src/imodel-components-react/UiIModelComponents.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,S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C,MAAM,KAAK,qBAAqB;QACrC,OAAO,oBAAoB,CAAC;IAC9B,CAAC;IAED,gBAAgB;IACT,MAAM,KAAK,WAAW;QAC3B,OAAO,yBAAyB,CAAC;IACnC,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,SAAS,CAAC,GAAsB;QAC5C,IAAI,CAAC,kBAAkB,CAAC,WAAW,IAAI,0BAA0B,CAAC,CAAC,SAAS,CAAC,YAAY,EAAE;YACzF,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,+EAA+E,CAAC,CAAC;YAC1I,OAAO,EAAE,CAAC;SACX;QACD,OAAO,SAAS,CAAC,YAAY,CAAC,+BAA+B,CAAC,kBAAkB,CAAC,qBAAqB,EAAE,GAAG,CAAC,CAAC;IAC/G,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,cAAc,CAAC,GAAQ;QACnC,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;QACpC,MAAM,QAAQ,GAAG,kBAAkB,CAAC,WAAW,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACrF,OAAO,QAAQ,CAAC;IAClB,CAAC;;AA9Dc,+BAAY,GAAG,KAAK,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Common\r\n */\r\n\r\nimport { enablePatches } from \"immer\";\r\nimport { Logger } from \"@itwin/core-bentley\";\r\nimport { IModelApp } from \"@itwin/core-frontend\";\r\nimport { getClassName } from \"@itwin/appui-abstract\";\r\nimport { UiComponents } from \"@itwin/components-react\";\r\nimport { EmptyLocalization } from \"@itwin/core-common\";\r\n\r\n/**\r\n * Manages the localization service for the imodel-components-react package.\r\n * @public\r\n */\r\nexport class UiIModelComponents {\r\n private static _initialized = false;\r\n\r\n /**\r\n * initialize UiIModelComponents.\r\n */\r\n public static async initialize(): Promise<void> {\r\n if (UiIModelComponents._initialized) {\r\n Logger.logInfo(UiIModelComponents.loggerCategory(UiIModelComponents), `UiIModelComponents.initialize already called`);\r\n return;\r\n }\r\n\r\n enablePatches();\r\n await IModelApp.localization?.registerNamespace(UiIModelComponents.localizationNamespace);\r\n\r\n if (!IModelApp.localization) {\r\n // it should only get here in unit test where IModelApp is not setup\r\n const localization = new EmptyLocalization();\r\n await localization.initialize();\r\n await UiComponents.initialize(localization);\r\n } else {\r\n await UiComponents.initialize(IModelApp.localization);\r\n }\r\n\r\n UiIModelComponents._initialized = true;\r\n }\r\n\r\n /** Unregisters the UiIModelComponents localization namespace */\r\n public static terminate() {\r\n IModelApp.localization?.unregisterNamespace(UiIModelComponents.localizationNamespace);\r\n UiComponents.terminate();\r\n UiIModelComponents._initialized = false;\r\n }\r\n\r\n /** Determines if UiIModelComponents has been initialized */\r\n public static get initialized(): boolean { return UiIModelComponents._initialized; }\r\n\r\n /** The internationalization service namespace. */\r\n public static get localizationNamespace(): string {\r\n return \"UiIModelComponents\";\r\n }\r\n\r\n /** @internal */\r\n public static get packageName(): string {\r\n return \"imodel-components-react\";\r\n }\r\n\r\n /** Calls localization.getLocalizedStringWithNamespace with the \"UiIModelComponents\" namespace. Do NOT include the namespace in the key.\r\n * @internal\r\n */\r\n public static translate(key: string | string[]): string {\r\n if (!UiIModelComponents.initialized || /* istanbul ignore next */ !IModelApp.localization) {\r\n Logger.logError(UiIModelComponents.loggerCategory(this), `translate: IModelApp.localization has not been setup. Returning blank string.`);\r\n return \"\";\r\n }\r\n return IModelApp.localization.getLocalizedStringWithNamespace(UiIModelComponents.localizationNamespace, key);\r\n }\r\n\r\n /** @internal */\r\n public static loggerCategory(obj: any): string {\r\n const className = getClassName(obj);\r\n const category = UiIModelComponents.packageName + (className ? `.${className}` : \"\");\r\n return category;\r\n }\r\n\r\n}\r\n"]}
@@ -1,37 +1,37 @@
1
- /** @packageDocumentation
2
- * @module Color
3
- */
4
- import "./AlphaSlider.scss";
5
- import * as React from "react";
6
- import { CommonProps } from "@itwin/core-react";
7
- /** Properties for the [[AlphaSlider]] React component
8
- * @beta
9
- */
10
- export interface AlphaSliderProps extends React.HTMLAttributes<HTMLDivElement>, CommonProps {
11
- /** true if slider is oriented horizontal, else vertical orientation is assumed */
12
- isHorizontal?: boolean;
13
- /** function to run when user selects color swatch */
14
- onAlphaChange?: ((alpha: number) => void) | undefined;
15
- /** Alpha value between 0 (transparent) and 1 (opaque) */
16
- alpha: number;
17
- }
18
- /** AlphaSlider component used to set the alpha value.
19
- * @beta
20
- */
21
- export declare class AlphaSlider extends React.PureComponent<AlphaSliderProps> {
22
- private _container;
23
- private _transparencyLabel;
24
- /** @internal */
25
- constructor(props: AlphaSliderProps);
26
- private _calculateChange;
27
- /** @internal */
28
- componentWillUnmount(): void;
29
- private _onChange;
30
- private _onMouseDown;
31
- private _onKeyDown;
32
- private _onMouseUp;
33
- private _unbindEventListeners;
34
- /** @internal */
35
- render(): React.ReactNode;
36
- }
1
+ /** @packageDocumentation
2
+ * @module Color
3
+ */
4
+ import "./AlphaSlider.scss";
5
+ import * as React from "react";
6
+ import { CommonProps } from "@itwin/core-react";
7
+ /** Properties for the [[AlphaSlider]] React component
8
+ * @beta
9
+ */
10
+ export interface AlphaSliderProps extends React.HTMLAttributes<HTMLDivElement>, CommonProps {
11
+ /** true if slider is oriented horizontal, else vertical orientation is assumed */
12
+ isHorizontal?: boolean;
13
+ /** function to run when user selects color swatch */
14
+ onAlphaChange?: ((alpha: number) => void) | undefined;
15
+ /** Alpha value between 0 (transparent) and 1 (opaque) */
16
+ alpha: number;
17
+ }
18
+ /** AlphaSlider component used to set the alpha value.
19
+ * @beta
20
+ */
21
+ export declare class AlphaSlider extends React.PureComponent<AlphaSliderProps> {
22
+ private _container;
23
+ private _transparencyLabel;
24
+ /** @internal */
25
+ constructor(props: AlphaSliderProps);
26
+ private _calculateChange;
27
+ /** @internal */
28
+ componentWillUnmount(): void;
29
+ private _onChange;
30
+ private _onMouseDown;
31
+ private _onKeyDown;
32
+ private _onMouseUp;
33
+ private _unbindEventListeners;
34
+ /** @internal */
35
+ render(): React.ReactNode;
36
+ }
37
37
  //# sourceMappingURL=AlphaSlider.d.ts.map
@@ -1,161 +1,161 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- /** @packageDocumentation
6
- * @module Color
7
- */
8
- import "./AlphaSlider.scss";
9
- import classnames from "classnames";
10
- import * as React from "react";
11
- import { UiIModelComponents } from "../UiIModelComponents";
12
- import { SpecialKey } from "@itwin/appui-abstract";
13
- /** AlphaSlider component used to set the alpha value.
14
- * @beta
15
- */
16
- export class AlphaSlider extends React.PureComponent {
17
- /** @internal */
18
- constructor(props) {
19
- super(props);
20
- this._container = null;
21
- this._transparencyLabel = UiIModelComponents.translate("color.transparency");
22
- this._calculateChange = (e, isHorizontal, alpha, container) => {
23
- e.preventDefault();
24
- const { width: containerWidth, height: containerHeight } = container.getBoundingClientRect();
25
- let x = 0;
26
- if ("pageX" in e) {
27
- x = e.pageX;
28
- }
29
- else {
30
- // istanbul ignore if
31
- if (undefined === e.touches)
32
- return undefined;
33
- x = e.touches[0].pageX;
34
- }
35
- // istanbul ignore if
36
- if (undefined === x)
37
- return undefined;
38
- let y = 0;
39
- if ("pageY" in e) {
40
- y = e.pageY;
41
- }
42
- else {
43
- // istanbul ignore if
44
- if (undefined === e.touches)
45
- return;
46
- y = e.touches[0].pageY;
47
- }
48
- // istanbul ignore if
49
- if (undefined === y)
50
- return undefined;
51
- const left = x - (container.getBoundingClientRect().left + window.scrollX);
52
- const top = y - (container.getBoundingClientRect().top + window.scrollY);
53
- let t = 0;
54
- if (!isHorizontal) {
55
- // istanbul ignore next
56
- if (top < 0) {
57
- t = 1;
58
- }
59
- else if (top > containerHeight) {
60
- t = 0;
61
- }
62
- else {
63
- t = 1 - (top / containerHeight);
64
- }
65
- }
66
- else { // horizontal
67
- // istanbul ignore next
68
- if (left < 0) {
69
- t = 0;
70
- }
71
- else if (left > containerWidth) {
72
- t = 1;
73
- }
74
- else {
75
- t = left / containerWidth;
76
- }
77
- }
78
- // istanbul ignore if
79
- if (t < 0)
80
- t = 0;
81
- // istanbul ignore if
82
- if (t > 1)
83
- t = 1;
84
- // istanbul ignore next
85
- return (alpha !== t) ? t : undefined;
86
- };
87
- this._onChange = (e) => {
88
- // istanbul ignore else
89
- if (this._container && this.props.onAlphaChange) {
90
- const change = this._calculateChange(e, this.props.isHorizontal ? this.props.isHorizontal : false, this.props.alpha, this._container);
91
- undefined !== change && typeof this.props.onAlphaChange === "function" && this.props.onAlphaChange(change);
92
- }
93
- };
94
- this._onMouseDown = (e) => {
95
- this._onChange(e);
96
- // istanbul ignore else
97
- if (this._container)
98
- this._container.focus();
99
- window.addEventListener("mousemove", this._onChange);
100
- window.addEventListener("mouseup", this._onMouseUp);
101
- };
102
- this._onKeyDown = (evt) => {
103
- let newTransparency;
104
- if (evt.key === SpecialKey.ArrowLeft || evt.key === SpecialKey.ArrowDown) {
105
- newTransparency = this.props.alpha - (evt.ctrlKey ? .1 : .05);
106
- }
107
- else if (evt.key === SpecialKey.ArrowRight || evt.key === SpecialKey.ArrowUp) {
108
- newTransparency = this.props.alpha + (evt.ctrlKey ? .1 : .05);
109
- }
110
- else if (evt.key === SpecialKey.PageDown) {
111
- newTransparency = this.props.alpha - (evt.ctrlKey ? .5 : .25);
112
- }
113
- else if (evt.key === SpecialKey.PageUp) {
114
- newTransparency = this.props.alpha + (evt.ctrlKey ? .5 : .25);
115
- }
116
- else if (evt.key === SpecialKey.Home) {
117
- newTransparency = 0;
118
- }
119
- else {
120
- // istanbul ignore else
121
- if (evt.key === SpecialKey.End) {
122
- newTransparency = 1;
123
- }
124
- }
125
- // istanbul ignore else
126
- if (undefined !== newTransparency) {
127
- // istanbul ignore if
128
- if (newTransparency > 1)
129
- newTransparency = 1;
130
- // istanbul ignore if
131
- if (newTransparency < 0)
132
- newTransparency = 0;
133
- // istanbul ignore else
134
- if (this.props.onAlphaChange)
135
- this.props.onAlphaChange(newTransparency);
136
- }
137
- };
138
- this._onMouseUp = () => {
139
- this._unbindEventListeners();
140
- };
141
- }
142
- /** @internal */
143
- componentWillUnmount() {
144
- this._unbindEventListeners();
145
- }
146
- _unbindEventListeners() {
147
- window.removeEventListener("mousemove", this._onChange);
148
- window.removeEventListener("mouseup", this._onMouseUp);
149
- }
150
- /** @internal */
151
- render() {
152
- const containerClasses = classnames(this.props.isHorizontal ? "components-alpha-container-horizontal" : "components-alpha-container-vertical", this.props.className);
153
- const pointerStyle = this.props.isHorizontal ?
154
- { left: `${(this.props.alpha * 100)}%` } :
155
- { left: `0px`, top: `${-(this.props.alpha * 100) + 100}%` };
156
- return (React.createElement("div", { className: containerClasses, style: this.props.style, "data-testid": "alpha-container" },
157
- React.createElement("div", { "data-testid": "alpha-slider", role: "slider", "aria-label": this._transparencyLabel, "aria-valuemin": 0, "aria-valuemax": 1, "aria-valuenow": this.props.alpha, className: "components-alpha-slider", ref: (container) => this._container = container, onMouseDown: this._onMouseDown, onTouchMove: this._onChange, onTouchStart: this._onChange, tabIndex: 0, onKeyDown: this._onKeyDown },
158
- React.createElement("div", { style: pointerStyle, className: "components-alpha-pointer", "data-testid": "alpha-pointer" }))));
159
- }
160
- }
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /** @packageDocumentation
6
+ * @module Color
7
+ */
8
+ import "./AlphaSlider.scss";
9
+ import classnames from "classnames";
10
+ import * as React from "react";
11
+ import { UiIModelComponents } from "../UiIModelComponents";
12
+ import { SpecialKey } from "@itwin/appui-abstract";
13
+ /** AlphaSlider component used to set the alpha value.
14
+ * @beta
15
+ */
16
+ export class AlphaSlider extends React.PureComponent {
17
+ /** @internal */
18
+ constructor(props) {
19
+ super(props);
20
+ this._container = null;
21
+ this._transparencyLabel = UiIModelComponents.translate("color.transparency");
22
+ this._calculateChange = (e, isHorizontal, alpha, container) => {
23
+ e.preventDefault();
24
+ const { width: containerWidth, height: containerHeight } = container.getBoundingClientRect();
25
+ let x = 0;
26
+ if ("pageX" in e) {
27
+ x = e.pageX;
28
+ }
29
+ else {
30
+ // istanbul ignore if
31
+ if (undefined === e.touches)
32
+ return undefined;
33
+ x = e.touches[0].pageX;
34
+ }
35
+ // istanbul ignore if
36
+ if (undefined === x)
37
+ return undefined;
38
+ let y = 0;
39
+ if ("pageY" in e) {
40
+ y = e.pageY;
41
+ }
42
+ else {
43
+ // istanbul ignore if
44
+ if (undefined === e.touches)
45
+ return;
46
+ y = e.touches[0].pageY;
47
+ }
48
+ // istanbul ignore if
49
+ if (undefined === y)
50
+ return undefined;
51
+ const left = x - (container.getBoundingClientRect().left + window.scrollX);
52
+ const top = y - (container.getBoundingClientRect().top + window.scrollY);
53
+ let t = 0;
54
+ if (!isHorizontal) {
55
+ // istanbul ignore next
56
+ if (top < 0) {
57
+ t = 1;
58
+ }
59
+ else if (top > containerHeight) {
60
+ t = 0;
61
+ }
62
+ else {
63
+ t = 1 - (top / containerHeight);
64
+ }
65
+ }
66
+ else { // horizontal
67
+ // istanbul ignore next
68
+ if (left < 0) {
69
+ t = 0;
70
+ }
71
+ else if (left > containerWidth) {
72
+ t = 1;
73
+ }
74
+ else {
75
+ t = left / containerWidth;
76
+ }
77
+ }
78
+ // istanbul ignore if
79
+ if (t < 0)
80
+ t = 0;
81
+ // istanbul ignore if
82
+ if (t > 1)
83
+ t = 1;
84
+ // istanbul ignore next
85
+ return (alpha !== t) ? t : undefined;
86
+ };
87
+ this._onChange = (e) => {
88
+ // istanbul ignore else
89
+ if (this._container && this.props.onAlphaChange) {
90
+ const change = this._calculateChange(e, this.props.isHorizontal ? this.props.isHorizontal : false, this.props.alpha, this._container);
91
+ undefined !== change && typeof this.props.onAlphaChange === "function" && this.props.onAlphaChange(change);
92
+ }
93
+ };
94
+ this._onMouseDown = (e) => {
95
+ this._onChange(e);
96
+ // istanbul ignore else
97
+ if (this._container)
98
+ this._container.focus();
99
+ window.addEventListener("mousemove", this._onChange);
100
+ window.addEventListener("mouseup", this._onMouseUp);
101
+ };
102
+ this._onKeyDown = (evt) => {
103
+ let newTransparency;
104
+ if (evt.key === SpecialKey.ArrowLeft || evt.key === SpecialKey.ArrowDown) {
105
+ newTransparency = this.props.alpha - (evt.ctrlKey ? .1 : .05);
106
+ }
107
+ else if (evt.key === SpecialKey.ArrowRight || evt.key === SpecialKey.ArrowUp) {
108
+ newTransparency = this.props.alpha + (evt.ctrlKey ? .1 : .05);
109
+ }
110
+ else if (evt.key === SpecialKey.PageDown) {
111
+ newTransparency = this.props.alpha - (evt.ctrlKey ? .5 : .25);
112
+ }
113
+ else if (evt.key === SpecialKey.PageUp) {
114
+ newTransparency = this.props.alpha + (evt.ctrlKey ? .5 : .25);
115
+ }
116
+ else if (evt.key === SpecialKey.Home) {
117
+ newTransparency = 0;
118
+ }
119
+ else {
120
+ // istanbul ignore else
121
+ if (evt.key === SpecialKey.End) {
122
+ newTransparency = 1;
123
+ }
124
+ }
125
+ // istanbul ignore else
126
+ if (undefined !== newTransparency) {
127
+ // istanbul ignore if
128
+ if (newTransparency > 1)
129
+ newTransparency = 1;
130
+ // istanbul ignore if
131
+ if (newTransparency < 0)
132
+ newTransparency = 0;
133
+ // istanbul ignore else
134
+ if (this.props.onAlphaChange)
135
+ this.props.onAlphaChange(newTransparency);
136
+ }
137
+ };
138
+ this._onMouseUp = () => {
139
+ this._unbindEventListeners();
140
+ };
141
+ }
142
+ /** @internal */
143
+ componentWillUnmount() {
144
+ this._unbindEventListeners();
145
+ }
146
+ _unbindEventListeners() {
147
+ window.removeEventListener("mousemove", this._onChange);
148
+ window.removeEventListener("mouseup", this._onMouseUp);
149
+ }
150
+ /** @internal */
151
+ render() {
152
+ const containerClasses = classnames(this.props.isHorizontal ? "components-alpha-container-horizontal" : "components-alpha-container-vertical", this.props.className);
153
+ const pointerStyle = this.props.isHorizontal ?
154
+ { left: `${(this.props.alpha * 100)}%` } :
155
+ { left: `0px`, top: `${-(this.props.alpha * 100) + 100}%` };
156
+ return (React.createElement("div", { className: containerClasses, style: this.props.style, "data-testid": "alpha-container" },
157
+ React.createElement("div", { "data-testid": "alpha-slider", role: "slider", "aria-label": this._transparencyLabel, "aria-valuemin": 0, "aria-valuemax": 1, "aria-valuenow": this.props.alpha, className: "components-alpha-slider", ref: (container) => this._container = container, onMouseDown: this._onMouseDown, onTouchMove: this._onChange, onTouchStart: this._onChange, tabIndex: 0, onKeyDown: this._onKeyDown },
158
+ React.createElement("div", { style: pointerStyle, className: "components-alpha-pointer", "data-testid": "alpha-pointer" }))));
159
+ }
160
+ }
161
161
  //# sourceMappingURL=AlphaSlider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AlphaSlider.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/color/AlphaSlider.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAC5B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAcnD;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK,CAAC,aAA+B;IAIpE,gBAAgB;IAChB,YAAY,KAAuB;QACjC,KAAK,CAAC,KAAK,CAAC,CAAC;QALP,eAAU,GAA0B,IAAI,CAAC;QACzC,uBAAkB,GAAG,kBAAkB,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC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C,YAAY,CAAC,CAAC,CAAC,uCAAuC,CAAC,CAAC,CAAC,qCAAqC,EACzG,IAAI,CAAC,KAAK,CAAC,SAAS,CACrB,CAAC;QAEF,MAAM,YAAY,GAAwB,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;YACjE,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;YAC1C,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,EAAE,CAAC;QAE9D,OAAO,CACL,6BAAK,SAAS,EAAE,gBAAgB,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,iBAAc,iBAAiB;YACtF,4CACc,cAAc,EAC1B,IAAI,EAAC,QAAQ,gBAAa,IAAI,CAAC,kBAAkB,mBAClC,CAAC,mBAAiB,CAAC,mBAAiB,IAAI,CAAC,KAAK,CAAC,KAAK,EACnE,SAAS,EAAC,yBAAyB,EACnC,GAAG,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,GAAG,SAAS,EAC/C,WAAW,EAAE,IAAI,CAAC,YAAY,EAC9B,WAAW,EAAE,IAAI,CAAC,SAAS,EAC3B,YAAY,EAAE,IAAI,CAAC,SAAS,EAC5B,QAAQ,EAAE,CAAC,EACX,SAAS,EAAE,IAAI,CAAC,UAAU;gBAE1B,6BAAK,KAAK,EAAE,YAAY,EAAE,SAAS,EAAC,0BAA0B,iBAAa,eAAe,GAAG,CACzF,CACF,CACP,CAAC;IACJ,CAAC;CAEF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Color\n */\n\nimport \"./AlphaSlider.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { CommonProps } from \"@itwin/core-react\";\nimport { UiIModelComponents } from \"../UiIModelComponents\";\nimport { SpecialKey } from \"@itwin/appui-abstract\";\n\n/** Properties for the [[AlphaSlider]] React component\n * @beta\n */\nexport interface AlphaSliderProps extends React.HTMLAttributes<HTMLDivElement>, CommonProps {\n /** true if slider is oriented horizontal, else vertical orientation is assumed */\n isHorizontal?: boolean;\n /** function to run when user selects color swatch */\n onAlphaChange?: ((alpha: number) => void) | undefined;\n /** Alpha value between 0 (transparent) and 1 (opaque) */\n alpha: number;\n}\n\n/** AlphaSlider component used to set the alpha value.\n * @beta\n */\nexport class AlphaSlider extends React.PureComponent<AlphaSliderProps> {\n private _container: HTMLDivElement | null = null;\n private _transparencyLabel = UiIModelComponents.translate(\"color.transparency\");\n\n /** @internal */\n constructor(props: AlphaSliderProps) {\n super(props);\n }\n\n private _calculateChange = (e: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>, isHorizontal: boolean, alpha: number, container: HTMLDivElement): number | undefined => {\n e.preventDefault();\n const { width: containerWidth, height: containerHeight } = container.getBoundingClientRect();\n\n let x = 0;\n if (\"pageX\" in e) {\n x = e.pageX;\n } else {\n // istanbul ignore if\n if (undefined === e.touches)\n return undefined;\n x = e.touches[0].pageX;\n }\n // istanbul ignore if\n if (undefined === x)\n return undefined;\n\n let y = 0;\n if (\"pageY\" in e) {\n y = e.pageY;\n } else {\n // istanbul ignore if\n if (undefined === e.touches)\n return;\n y = e.touches[0].pageY;\n }\n // istanbul ignore if\n if (undefined === y)\n return undefined;\n\n const left = x - (container.getBoundingClientRect().left + window.scrollX);\n const top = y - (container.getBoundingClientRect().top + window.scrollY);\n\n let t = 0;\n\n if (!isHorizontal) {\n // istanbul ignore next\n if (top < 0) {\n t = 1;\n } else if (top > containerHeight) {\n t = 0;\n } else {\n t = 1 - (top / containerHeight);\n }\n } else { // horizontal\n // istanbul ignore next\n if (left < 0) {\n t = 0;\n } else if (left > containerWidth) {\n t = 1;\n } else {\n t = left / containerWidth;\n }\n }\n\n // istanbul ignore if\n if (t < 0) t = 0;\n // istanbul ignore if\n if (t > 1) t = 1;\n // istanbul ignore next\n return (alpha !== t) ? t : undefined;\n };\n\n /** @internal */\n public override componentWillUnmount() {\n this._unbindEventListeners();\n }\n\n private _onChange = (e: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>) => {\n // istanbul ignore else\n if (this._container && this.props.onAlphaChange) {\n const change = this._calculateChange(e, this.props.isHorizontal ? this.props.isHorizontal : false, this.props.alpha, this._container);\n undefined !== change && typeof this.props.onAlphaChange === \"function\" && this.props.onAlphaChange(change);\n }\n };\n\n private _onMouseDown = (e: React.MouseEvent<HTMLDivElement>) => {\n this._onChange(e);\n // istanbul ignore else\n if (this._container)\n this._container.focus();\n window.addEventListener(\"mousemove\", this._onChange as any);\n window.addEventListener(\"mouseup\", this._onMouseUp);\n };\n\n private _onKeyDown = (evt: React.KeyboardEvent<HTMLDivElement>) => {\n let newTransparency: number | undefined;\n if (evt.key === SpecialKey.ArrowLeft || evt.key === SpecialKey.ArrowDown) {\n newTransparency = this.props.alpha - (evt.ctrlKey ? .1 : .05);\n } else if (evt.key === SpecialKey.ArrowRight || evt.key === SpecialKey.ArrowUp) {\n newTransparency = this.props.alpha + (evt.ctrlKey ? .1 : .05);\n } else if (evt.key === SpecialKey.PageDown) {\n newTransparency = this.props.alpha - (evt.ctrlKey ? .5 : .25);\n } else if (evt.key === SpecialKey.PageUp) {\n newTransparency = this.props.alpha + (evt.ctrlKey ? .5 : .25);\n } else if (evt.key === SpecialKey.Home) {\n newTransparency = 0;\n } else {\n // istanbul ignore else\n if (evt.key === SpecialKey.End) {\n newTransparency = 1;\n }\n }\n\n // istanbul ignore else\n if (undefined !== newTransparency) {\n // istanbul ignore if\n if (newTransparency > 1) newTransparency = 1;\n // istanbul ignore if\n if (newTransparency < 0) newTransparency = 0;\n // istanbul ignore else\n if (this.props.onAlphaChange)\n this.props.onAlphaChange(newTransparency);\n }\n };\n\n private _onMouseUp = () => {\n this._unbindEventListeners();\n };\n\n private _unbindEventListeners() {\n window.removeEventListener(\"mousemove\", this._onChange as any);\n window.removeEventListener(\"mouseup\", this._onMouseUp);\n }\n\n /** @internal */\n public override render(): React.ReactNode {\n const containerClasses = classnames(\n this.props.isHorizontal ? \"components-alpha-container-horizontal\" : \"components-alpha-container-vertical\",\n this.props.className,\n );\n\n const pointerStyle: React.CSSProperties = this.props.isHorizontal ?\n { left: `${(this.props.alpha * 100)}%` } :\n { left: `0px`, top: `${-(this.props.alpha * 100) + 100}%` };\n\n return (\n <div className={containerClasses} style={this.props.style} data-testid=\"alpha-container\">\n <div\n data-testid=\"alpha-slider\"\n role=\"slider\" aria-label={this._transparencyLabel}\n aria-valuemin={0} aria-valuemax={1} aria-valuenow={this.props.alpha}\n className=\"components-alpha-slider\"\n ref={(container) => this._container = container}\n onMouseDown={this._onMouseDown}\n onTouchMove={this._onChange}\n onTouchStart={this._onChange}\n tabIndex={0}\n onKeyDown={this._onKeyDown}\n >\n <div style={pointerStyle} className=\"components-alpha-pointer\" data-testid=\"alpha-pointer\" />\n </div>\n </div>\n );\n }\n\n}\n"]}
1
+ {"version":3,"file":"AlphaSlider.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/color/AlphaSlider.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAC5B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAcnD;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK,CAAC,aAA+B;IAIpE,gBAAgB;IAChB,YAAY,KAAuB;QACjC,KAAK,CAAC,KA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AU,CAAC,CAAC;IACzD,CAAC;IAED,gBAAgB;IACA,MAAM;QACpB,MAAM,gBAAgB,GAAG,UAAU,CACjC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,uCAAuC,CAAC,CAAC,CAAC,qCAAqC,EACzG,IAAI,CAAC,KAAK,CAAC,SAAS,CACrB,CAAC;QAEF,MAAM,YAAY,GAAwB,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;YACjE,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;YAC1C,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,EAAE,CAAC;QAE9D,OAAO,CACL,6BAAK,SAAS,EAAE,gBAAgB,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,iBAAc,iBAAiB;YACtF,4CACc,cAAc,EAC1B,IAAI,EAAC,QAAQ,gBAAa,IAAI,CAAC,kBAAkB,mBAClC,CAAC,mBAAiB,CAAC,mBAAiB,IAAI,CAAC,KAAK,CAAC,KAAK,EACnE,SAAS,EAAC,yBAAyB,EACnC,GAAG,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,GAAG,SAAS,EAC/C,WAAW,EAAE,IAAI,CAAC,YAAY,EAC9B,WAAW,EAAE,IAAI,CAAC,SAAS,EAC3B,YAAY,EAAE,IAAI,CAAC,SAAS,EAC5B,QAAQ,EAAE,CAAC,EACX,SAAS,EAAE,IAAI,CAAC,UAAU;gBAE1B,6BAAK,KAAK,EAAE,YAAY,EAAE,SAAS,EAAC,0BAA0B,iBAAa,eAAe,GAAG,CACzF,CACF,CACP,CAAC;IACJ,CAAC;CAEF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Color\r\n */\r\n\r\nimport \"./AlphaSlider.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { UiIModelComponents } from \"../UiIModelComponents\";\r\nimport { SpecialKey } from \"@itwin/appui-abstract\";\r\n\r\n/** Properties for the [[AlphaSlider]] React component\r\n * @beta\r\n */\r\nexport interface AlphaSliderProps extends React.HTMLAttributes<HTMLDivElement>, CommonProps {\r\n /** true if slider is oriented horizontal, else vertical orientation is assumed */\r\n isHorizontal?: boolean;\r\n /** function to run when user selects color swatch */\r\n onAlphaChange?: ((alpha: number) => void) | undefined;\r\n /** Alpha value between 0 (transparent) and 1 (opaque) */\r\n alpha: number;\r\n}\r\n\r\n/** AlphaSlider component used to set the alpha value.\r\n * @beta\r\n */\r\nexport class AlphaSlider extends React.PureComponent<AlphaSliderProps> {\r\n private _container: HTMLDivElement | null = null;\r\n private _transparencyLabel = UiIModelComponents.translate(\"color.transparency\");\r\n\r\n /** @internal */\r\n constructor(props: AlphaSliderProps) {\r\n super(props);\r\n }\r\n\r\n private _calculateChange = (e: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>, isHorizontal: boolean, alpha: number, container: HTMLDivElement): number | undefined => {\r\n e.preventDefault();\r\n const { width: containerWidth, height: containerHeight } = container.getBoundingClientRect();\r\n\r\n let x = 0;\r\n if (\"pageX\" in e) {\r\n x = e.pageX;\r\n } else {\r\n // istanbul ignore if\r\n if (undefined === e.touches)\r\n return undefined;\r\n x = e.touches[0].pageX;\r\n }\r\n // istanbul ignore if\r\n if (undefined === x)\r\n return undefined;\r\n\r\n let y = 0;\r\n if (\"pageY\" in e) {\r\n y = e.pageY;\r\n } else {\r\n // istanbul ignore if\r\n if (undefined === e.touches)\r\n return;\r\n y = e.touches[0].pageY;\r\n }\r\n // istanbul ignore if\r\n if (undefined === y)\r\n return undefined;\r\n\r\n const left = x - (container.getBoundingClientRect().left + window.scrollX);\r\n const top = y - (container.getBoundingClientRect().top + window.scrollY);\r\n\r\n let t = 0;\r\n\r\n if (!isHorizontal) {\r\n // istanbul ignore next\r\n if (top < 0) {\r\n t = 1;\r\n } else if (top > containerHeight) {\r\n t = 0;\r\n } else {\r\n t = 1 - (top / containerHeight);\r\n }\r\n } else { // horizontal\r\n // istanbul ignore next\r\n if (left < 0) {\r\n t = 0;\r\n } else if (left > containerWidth) {\r\n t = 1;\r\n } else {\r\n t = left / containerWidth;\r\n }\r\n }\r\n\r\n // istanbul ignore if\r\n if (t < 0) t = 0;\r\n // istanbul ignore if\r\n if (t > 1) t = 1;\r\n // istanbul ignore next\r\n return (alpha !== t) ? t : undefined;\r\n };\r\n\r\n /** @internal */\r\n public override componentWillUnmount() {\r\n this._unbindEventListeners();\r\n }\r\n\r\n private _onChange = (e: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>) => {\r\n // istanbul ignore else\r\n if (this._container && this.props.onAlphaChange) {\r\n const change = this._calculateChange(e, this.props.isHorizontal ? this.props.isHorizontal : false, this.props.alpha, this._container);\r\n undefined !== change && typeof this.props.onAlphaChange === \"function\" && this.props.onAlphaChange(change);\r\n }\r\n };\r\n\r\n private _onMouseDown = (e: React.MouseEvent<HTMLDivElement>) => {\r\n this._onChange(e);\r\n // istanbul ignore else\r\n if (this._container)\r\n this._container.focus();\r\n window.addEventListener(\"mousemove\", this._onChange as any);\r\n window.addEventListener(\"mouseup\", this._onMouseUp);\r\n };\r\n\r\n private _onKeyDown = (evt: React.KeyboardEvent<HTMLDivElement>) => {\r\n let newTransparency: number | undefined;\r\n if (evt.key === SpecialKey.ArrowLeft || evt.key === SpecialKey.ArrowDown) {\r\n newTransparency = this.props.alpha - (evt.ctrlKey ? .1 : .05);\r\n } else if (evt.key === SpecialKey.ArrowRight || evt.key === SpecialKey.ArrowUp) {\r\n newTransparency = this.props.alpha + (evt.ctrlKey ? .1 : .05);\r\n } else if (evt.key === SpecialKey.PageDown) {\r\n newTransparency = this.props.alpha - (evt.ctrlKey ? .5 : .25);\r\n } else if (evt.key === SpecialKey.PageUp) {\r\n newTransparency = this.props.alpha + (evt.ctrlKey ? .5 : .25);\r\n } else if (evt.key === SpecialKey.Home) {\r\n newTransparency = 0;\r\n } else {\r\n // istanbul ignore else\r\n if (evt.key === SpecialKey.End) {\r\n newTransparency = 1;\r\n }\r\n }\r\n\r\n // istanbul ignore else\r\n if (undefined !== newTransparency) {\r\n // istanbul ignore if\r\n if (newTransparency > 1) newTransparency = 1;\r\n // istanbul ignore if\r\n if (newTransparency < 0) newTransparency = 0;\r\n // istanbul ignore else\r\n if (this.props.onAlphaChange)\r\n this.props.onAlphaChange(newTransparency);\r\n }\r\n };\r\n\r\n private _onMouseUp = () => {\r\n this._unbindEventListeners();\r\n };\r\n\r\n private _unbindEventListeners() {\r\n window.removeEventListener(\"mousemove\", this._onChange as any);\r\n window.removeEventListener(\"mouseup\", this._onMouseUp);\r\n }\r\n\r\n /** @internal */\r\n public override render(): React.ReactNode {\r\n const containerClasses = classnames(\r\n this.props.isHorizontal ? \"components-alpha-container-horizontal\" : \"components-alpha-container-vertical\",\r\n this.props.className,\r\n );\r\n\r\n const pointerStyle: React.CSSProperties = this.props.isHorizontal ?\r\n { left: `${(this.props.alpha * 100)}%` } :\r\n { left: `0px`, top: `${-(this.props.alpha * 100) + 100}%` };\r\n\r\n return (\r\n <div className={containerClasses} style={this.props.style} data-testid=\"alpha-container\">\r\n <div\r\n data-testid=\"alpha-slider\"\r\n role=\"slider\" aria-label={this._transparencyLabel}\r\n aria-valuemin={0} aria-valuemax={1} aria-valuenow={this.props.alpha}\r\n className=\"components-alpha-slider\"\r\n ref={(container) => this._container = container}\r\n onMouseDown={this._onMouseDown}\r\n onTouchMove={this._onChange}\r\n onTouchStart={this._onChange}\r\n tabIndex={0}\r\n onKeyDown={this._onKeyDown}\r\n >\r\n <div style={pointerStyle} className=\"components-alpha-pointer\" data-testid=\"alpha-pointer\" />\r\n </div>\r\n </div>\r\n );\r\n }\r\n\r\n}\r\n"]}
@@ -1,63 +1,63 @@
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
- .components-alpha-pointer {
6
- position: absolute;
7
- width: 1.2rem;
8
- height: 1.2rem;
9
- border-radius: 50%;
10
- background-color: rgb(248, 248, 248);
11
- box-shadow: rgba(0, 0, 0, 0.37) 0px 1px 4px 0px;
12
-
13
- &:focus {
14
- outline: none;
15
- border: none;
16
- }
17
- }
18
-
19
- .components-alpha-container-horizontal {
20
- width: 100%;
21
- height: 1rem;
22
- display: flex;
23
- align-items: center;
24
- justify-content: center;
25
-
26
- .components-alpha-slider {
27
- position: relative;
28
- width: calc(100% - 1.2rem);
29
- height: 100%;
30
- background-color: linear-gradient(to right, rgba(47, 37, 72, 0) 0%, rgb(47, 37, 72) 100%);
31
- background-image: url('data:image/svg+xml, <svg xmlns="http://www.w3.org/2000/svg" width="400" height="400" fill-opacity=".15"><rect x="200" width="200" height="200" /> <rect y="200" width="200" height="200" /></svg>'),
32
- linear-gradient(to right, rgba(47, 37, 72, 0) 0%, rgb(47, 37, 72) 100%);
33
- background-size: 2rem 1rem, cover;
34
- background-repeat: repeat, no-repeat;
35
-
36
- .components-alpha-pointer {
37
- transform: translate(-.6rem, -.1rem);
38
- }
39
- }
40
- }
41
-
42
- .components-alpha-container-vertical {
43
- width: 1rem;
44
- display: flex;
45
- align-items: center;
46
- justify-content: center;
47
- height: 100%;
48
-
49
- .components-alpha-slider {
50
- position: relative;
51
- width: 100%;
52
- height: calc(100% - 1.2rem);
53
- background-color: linear-gradient(to bottom, rgba(47, 37, 72, 0) 0%, rgb(47, 37, 72) 100%);
54
- background-image: url('data:image/svg+xml, <svg xmlns="http://www.w3.org/2000/svg" width="400" height="400" fill-opacity=".15"><rect x="200" width="200" height="200" /> <rect y="200" width="200" height="200" /></svg>'),
55
- linear-gradient(to top, rgba(47, 37, 72, 0) 0%, rgb(47, 37, 72) 100%);
56
- background-size: 1rem 2rem, cover;
57
- background-repeat: repeat, no-repeat;
58
-
59
- .components-alpha-pointer {
60
- transform: translate(-.1rem, -.6rem);
61
- }
62
- }
63
- }
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
+ .components-alpha-pointer {
6
+ position: absolute;
7
+ width: 1.2rem;
8
+ height: 1.2rem;
9
+ border-radius: 50%;
10
+ background-color: rgb(248, 248, 248);
11
+ box-shadow: rgba(0, 0, 0, 0.37) 0px 1px 4px 0px;
12
+
13
+ &:focus {
14
+ outline: none;
15
+ border: none;
16
+ }
17
+ }
18
+
19
+ .components-alpha-container-horizontal {
20
+ width: 100%;
21
+ height: 1rem;
22
+ display: flex;
23
+ align-items: center;
24
+ justify-content: center;
25
+
26
+ .components-alpha-slider {
27
+ position: relative;
28
+ width: calc(100% - 1.2rem);
29
+ height: 100%;
30
+ background-color: linear-gradient(to right, rgba(47, 37, 72, 0) 0%, rgb(47, 37, 72) 100%);
31
+ background-image: url('data:image/svg+xml, <svg xmlns="http://www.w3.org/2000/svg" width="400" height="400" fill-opacity=".15"><rect x="200" width="200" height="200" /> <rect y="200" width="200" height="200" /></svg>'),
32
+ linear-gradient(to right, rgba(47, 37, 72, 0) 0%, rgb(47, 37, 72) 100%);
33
+ background-size: 2rem 1rem, cover;
34
+ background-repeat: repeat, no-repeat;
35
+
36
+ .components-alpha-pointer {
37
+ transform: translate(-.6rem, -.1rem);
38
+ }
39
+ }
40
+ }
41
+
42
+ .components-alpha-container-vertical {
43
+ width: 1rem;
44
+ display: flex;
45
+ align-items: center;
46
+ justify-content: center;
47
+ height: 100%;
48
+
49
+ .components-alpha-slider {
50
+ position: relative;
51
+ width: 100%;
52
+ height: calc(100% - 1.2rem);
53
+ background-color: linear-gradient(to bottom, rgba(47, 37, 72, 0) 0%, rgb(47, 37, 72) 100%);
54
+ background-image: url('data:image/svg+xml, <svg xmlns="http://www.w3.org/2000/svg" width="400" height="400" fill-opacity=".15"><rect x="200" width="200" height="200" /> <rect y="200" width="200" height="200" /></svg>'),
55
+ linear-gradient(to top, rgba(47, 37, 72, 0) 0%, rgb(47, 37, 72) 100%);
56
+ background-size: 1rem 2rem, cover;
57
+ background-repeat: repeat, no-repeat;
58
+
59
+ .components-alpha-pointer {
60
+ transform: translate(-.1rem, -.6rem);
61
+ }
62
+ }
63
+ }