@itwin/imodel-components-react 3.5.0-dev.19 → 3.5.0-dev.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (342) hide show
  1. package/lib/cjs/imodel-components-react/UiIModelComponents.d.ts +28 -28
  2. package/lib/cjs/imodel-components-react/UiIModelComponents.js +79 -79
  3. package/lib/cjs/imodel-components-react/UiIModelComponents.js.map +1 -1
  4. package/lib/cjs/imodel-components-react/color/AlphaSlider.d.ts +36 -36
  5. package/lib/cjs/imodel-components-react/color/AlphaSlider.js +186 -186
  6. package/lib/cjs/imodel-components-react/color/AlphaSlider.js.map +1 -1
  7. package/lib/cjs/imodel-components-react/color/AlphaSlider.scss +63 -63
  8. package/lib/cjs/imodel-components-react/color/ColorPickerButton.d.ts +37 -37
  9. package/lib/cjs/imodel-components-react/color/ColorPickerButton.js +107 -107
  10. package/lib/cjs/imodel-components-react/color/ColorPickerButton.js.map +1 -1
  11. package/lib/cjs/imodel-components-react/color/ColorPickerButton.scss +91 -91
  12. package/lib/cjs/imodel-components-react/color/ColorPickerDialog.d.ts +23 -23
  13. package/lib/cjs/imodel-components-react/color/ColorPickerDialog.js +74 -74
  14. package/lib/cjs/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
  15. package/lib/cjs/imodel-components-react/color/ColorPickerPanel.d.ts +21 -21
  16. package/lib/cjs/imodel-components-react/color/ColorPickerPanel.js +145 -145
  17. package/lib/cjs/imodel-components-react/color/ColorPickerPanel.js.map +1 -1
  18. package/lib/cjs/imodel-components-react/color/ColorPickerPanel.scss +93 -93
  19. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.d.ts +44 -44
  20. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.js +137 -137
  21. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
  22. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.scss +64 -64
  23. package/lib/cjs/imodel-components-react/color/HueSlider.d.ts +22 -22
  24. package/lib/cjs/imodel-components-react/color/HueSlider.js +199 -199
  25. package/lib/cjs/imodel-components-react/color/HueSlider.js.map +1 -1
  26. package/lib/cjs/imodel-components-react/color/HueSlider.scss +61 -61
  27. package/lib/cjs/imodel-components-react/color/SaturationPicker.d.ts +20 -20
  28. package/lib/cjs/imodel-components-react/color/SaturationPicker.js +213 -213
  29. package/lib/cjs/imodel-components-react/color/SaturationPicker.js.map +1 -1
  30. package/lib/cjs/imodel-components-react/color/SaturationPicker.scss +35 -35
  31. package/lib/cjs/imodel-components-react/color/Swatch.d.ts +22 -22
  32. package/lib/cjs/imodel-components-react/color/Swatch.js +60 -60
  33. package/lib/cjs/imodel-components-react/color/Swatch.js.map +1 -1
  34. package/lib/cjs/imodel-components-react/color/Swatch.scss +23 -23
  35. package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.d.ts +6 -6
  36. package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.js +23 -23
  37. package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.js.map +1 -1
  38. package/lib/cjs/imodel-components-react/editors/ColorEditor.d.ts +44 -44
  39. package/lib/cjs/imodel-components-react/editors/ColorEditor.js +151 -151
  40. package/lib/cjs/imodel-components-react/editors/ColorEditor.js.map +1 -1
  41. package/lib/cjs/imodel-components-react/editors/ColorEditor.scss +18 -18
  42. package/lib/cjs/imodel-components-react/editors/WeightEditor.d.ts +47 -47
  43. package/lib/cjs/imodel-components-react/editors/WeightEditor.js +160 -160
  44. package/lib/cjs/imodel-components-react/editors/WeightEditor.js.map +1 -1
  45. package/lib/cjs/imodel-components-react/editors/WeightEditor.scss +16 -16
  46. package/lib/cjs/imodel-components-react/inputs/QuantityInput.d.ts +25 -25
  47. package/lib/cjs/imodel-components-react/inputs/QuantityInput.js +96 -96
  48. package/lib/cjs/imodel-components-react/inputs/QuantityInput.js.map +1 -1
  49. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.d.ts +44 -44
  50. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js +265 -265
  51. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
  52. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.scss +107 -107
  53. package/lib/cjs/imodel-components-react/lineweight/Swatch.d.ts +33 -33
  54. package/lib/cjs/imodel-components-react/lineweight/Swatch.js +85 -85
  55. package/lib/cjs/imodel-components-react/lineweight/Swatch.js.map +1 -1
  56. package/lib/cjs/imodel-components-react/lineweight/Swatch.scss +48 -48
  57. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.d.ts +60 -60
  58. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.js +159 -159
  59. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
  60. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.scss +52 -52
  61. package/lib/cjs/imodel-components-react/navigationaids/Cube.d.ts +45 -45
  62. package/lib/cjs/imodel-components-react/navigationaids/Cube.js +127 -127
  63. package/lib/cjs/imodel-components-react/navigationaids/Cube.js.map +1 -1
  64. package/lib/cjs/imodel-components-react/navigationaids/Cube.scss +19 -19
  65. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.d.ts +174 -174
  66. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js +634 -634
  67. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
  68. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.scss +180 -180
  69. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts +145 -145
  70. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.js +647 -647
  71. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
  72. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.scss +133 -133
  73. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.d.ts +26 -26
  74. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js +99 -99
  75. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
  76. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.scss +64 -64
  77. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.d.ts +17 -17
  78. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js +53 -53
  79. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
  80. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.d.ts +18 -18
  81. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js +83 -83
  82. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
  83. package/lib/cjs/imodel-components-react/quantityformat/FormatType.d.ts +17 -17
  84. package/lib/cjs/imodel-components-react/quantityformat/FormatType.js +86 -86
  85. package/lib/cjs/imodel-components-react/quantityformat/FormatType.js.map +1 -1
  86. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.d.ts +17 -17
  87. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js +109 -109
  88. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
  89. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.d.ts +19 -19
  90. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js +133 -133
  91. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
  92. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.d.ts +21 -21
  93. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js +184 -184
  94. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
  95. package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts +22 -22
  96. package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.js +154 -154
  97. package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.js.map +1 -1
  98. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.d.ts +17 -17
  99. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.js +59 -59
  100. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.js.map +1 -1
  101. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.d.ts +17 -17
  102. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.js +47 -47
  103. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.js.map +1 -1
  104. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.d.ts +16 -16
  105. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.js +54 -54
  106. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.js.map +1 -1
  107. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.d.ts +18 -18
  108. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.js +48 -48
  109. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.js.map +1 -1
  110. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.d.ts +17 -17
  111. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.js +50 -50
  112. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.js.map +1 -1
  113. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.d.ts +17 -17
  114. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js +58 -58
  115. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js.map +1 -1
  116. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.d.ts +17 -17
  117. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.js +47 -47
  118. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.js.map +1 -1
  119. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.d.ts +17 -17
  120. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.js +56 -56
  121. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.js.map +1 -1
  122. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts +17 -17
  123. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +95 -95
  124. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
  125. package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.d.ts +23 -23
  126. package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.js +119 -119
  127. package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.js.map +1 -1
  128. package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.d.ts +52 -52
  129. package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.js +143 -143
  130. package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.js.map +1 -1
  131. package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.d.ts +31 -31
  132. package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.js +69 -69
  133. package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.js.map +1 -1
  134. package/lib/cjs/imodel-components-react/timeline/InlineEdit.d.ts +27 -27
  135. package/lib/cjs/imodel-components-react/timeline/InlineEdit.js +81 -81
  136. package/lib/cjs/imodel-components-react/timeline/InlineEdit.js.map +1 -1
  137. package/lib/cjs/imodel-components-react/timeline/InlineEdit.scss +26 -26
  138. package/lib/cjs/imodel-components-react/timeline/PlayerButton.d.ts +33 -33
  139. package/lib/cjs/imodel-components-react/timeline/PlayerButton.js +91 -91
  140. package/lib/cjs/imodel-components-react/timeline/PlayerButton.js.map +1 -1
  141. package/lib/cjs/imodel-components-react/timeline/PlayerButton.scss +25 -25
  142. package/lib/cjs/imodel-components-react/timeline/Scrubber.d.ts +54 -54
  143. package/lib/cjs/imodel-components-react/timeline/Scrubber.js +191 -191
  144. package/lib/cjs/imodel-components-react/timeline/Scrubber.js.map +1 -1
  145. package/lib/cjs/imodel-components-react/timeline/Scrubber.scss +106 -106
  146. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.d.ts +77 -77
  147. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.js +424 -424
  148. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
  149. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.scss +357 -357
  150. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.d.ts +15 -15
  151. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.js +54 -54
  152. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.js.map +1 -1
  153. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.scss +39 -39
  154. package/lib/cjs/imodel-components-react/timeline/Timeline.scss +164 -164
  155. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.d.ts +133 -133
  156. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js +358 -358
  157. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
  158. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.scss +163 -163
  159. package/lib/cjs/imodel-components-react/timeline/interfaces.d.ts +174 -174
  160. package/lib/cjs/imodel-components-react/timeline/interfaces.js +45 -45
  161. package/lib/cjs/imodel-components-react/timeline/interfaces.js.map +1 -1
  162. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.d.ts +42 -42
  163. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js +274 -274
  164. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
  165. package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.d.ts +106 -106
  166. package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.js +105 -105
  167. package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.js.map +1 -1
  168. package/lib/cjs/imodel-components-react.d.ts +82 -82
  169. package/lib/cjs/imodel-components-react.js +101 -101
  170. package/lib/cjs/imodel-components-react.js.map +1 -1
  171. package/lib/esm/imodel-components-react/UiIModelComponents.d.ts +28 -28
  172. package/lib/esm/imodel-components-react/UiIModelComponents.js +75 -75
  173. package/lib/esm/imodel-components-react/UiIModelComponents.js.map +1 -1
  174. package/lib/esm/imodel-components-react/color/AlphaSlider.d.ts +36 -36
  175. package/lib/esm/imodel-components-react/color/AlphaSlider.js +160 -160
  176. package/lib/esm/imodel-components-react/color/AlphaSlider.js.map +1 -1
  177. package/lib/esm/imodel-components-react/color/AlphaSlider.scss +63 -63
  178. package/lib/esm/imodel-components-react/color/ColorPickerButton.d.ts +37 -37
  179. package/lib/esm/imodel-components-react/color/ColorPickerButton.js +82 -82
  180. package/lib/esm/imodel-components-react/color/ColorPickerButton.js.map +1 -1
  181. package/lib/esm/imodel-components-react/color/ColorPickerButton.scss +91 -91
  182. package/lib/esm/imodel-components-react/color/ColorPickerDialog.d.ts +23 -23
  183. package/lib/esm/imodel-components-react/color/ColorPickerDialog.js +51 -51
  184. package/lib/esm/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
  185. package/lib/esm/imodel-components-react/color/ColorPickerPanel.d.ts +21 -21
  186. package/lib/esm/imodel-components-react/color/ColorPickerPanel.js +122 -122
  187. package/lib/esm/imodel-components-react/color/ColorPickerPanel.js.map +1 -1
  188. package/lib/esm/imodel-components-react/color/ColorPickerPanel.scss +93 -93
  189. package/lib/esm/imodel-components-react/color/ColorPickerPopup.d.ts +44 -44
  190. package/lib/esm/imodel-components-react/color/ColorPickerPopup.js +112 -112
  191. package/lib/esm/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
  192. package/lib/esm/imodel-components-react/color/ColorPickerPopup.scss +64 -64
  193. package/lib/esm/imodel-components-react/color/HueSlider.d.ts +22 -22
  194. package/lib/esm/imodel-components-react/color/HueSlider.js +173 -173
  195. package/lib/esm/imodel-components-react/color/HueSlider.js.map +1 -1
  196. package/lib/esm/imodel-components-react/color/HueSlider.scss +61 -61
  197. package/lib/esm/imodel-components-react/color/SaturationPicker.d.ts +20 -20
  198. package/lib/esm/imodel-components-react/color/SaturationPicker.js +187 -187
  199. package/lib/esm/imodel-components-react/color/SaturationPicker.js.map +1 -1
  200. package/lib/esm/imodel-components-react/color/SaturationPicker.scss +35 -35
  201. package/lib/esm/imodel-components-react/color/Swatch.d.ts +22 -22
  202. package/lib/esm/imodel-components-react/color/Swatch.js +34 -34
  203. package/lib/esm/imodel-components-react/color/Swatch.js.map +1 -1
  204. package/lib/esm/imodel-components-react/color/Swatch.scss +23 -23
  205. package/lib/esm/imodel-components-react/color/getCSSColorFromDef.d.ts +6 -6
  206. package/lib/esm/imodel-components-react/color/getCSSColorFromDef.js +19 -19
  207. package/lib/esm/imodel-components-react/color/getCSSColorFromDef.js.map +1 -1
  208. package/lib/esm/imodel-components-react/editors/ColorEditor.d.ts +44 -44
  209. package/lib/esm/imodel-components-react/editors/ColorEditor.js +124 -124
  210. package/lib/esm/imodel-components-react/editors/ColorEditor.js.map +1 -1
  211. package/lib/esm/imodel-components-react/editors/ColorEditor.scss +18 -18
  212. package/lib/esm/imodel-components-react/editors/WeightEditor.d.ts +47 -47
  213. package/lib/esm/imodel-components-react/editors/WeightEditor.js +133 -133
  214. package/lib/esm/imodel-components-react/editors/WeightEditor.js.map +1 -1
  215. package/lib/esm/imodel-components-react/editors/WeightEditor.scss +16 -16
  216. package/lib/esm/imodel-components-react/inputs/QuantityInput.d.ts +25 -25
  217. package/lib/esm/imodel-components-react/inputs/QuantityInput.js +70 -70
  218. package/lib/esm/imodel-components-react/inputs/QuantityInput.js.map +1 -1
  219. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.d.ts +44 -44
  220. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js +240 -240
  221. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
  222. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.scss +107 -107
  223. package/lib/esm/imodel-components-react/lineweight/Swatch.d.ts +33 -33
  224. package/lib/esm/imodel-components-react/lineweight/Swatch.js +59 -59
  225. package/lib/esm/imodel-components-react/lineweight/Swatch.js.map +1 -1
  226. package/lib/esm/imodel-components-react/lineweight/Swatch.scss +48 -48
  227. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.d.ts +60 -60
  228. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.js +133 -133
  229. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
  230. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.scss +52 -52
  231. package/lib/esm/imodel-components-react/navigationaids/Cube.d.ts +45 -45
  232. package/lib/esm/imodel-components-react/navigationaids/Cube.js +100 -100
  233. package/lib/esm/imodel-components-react/navigationaids/Cube.js.map +1 -1
  234. package/lib/esm/imodel-components-react/navigationaids/Cube.scss +19 -19
  235. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.d.ts +174 -174
  236. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js +606 -606
  237. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
  238. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.scss +180 -180
  239. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts +145 -145
  240. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.js +620 -620
  241. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
  242. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.scss +133 -133
  243. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.d.ts +26 -26
  244. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js +76 -76
  245. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
  246. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.scss +64 -64
  247. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.d.ts +17 -17
  248. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js +30 -30
  249. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
  250. package/lib/esm/imodel-components-react/quantityformat/FormatSample.d.ts +18 -18
  251. package/lib/esm/imodel-components-react/quantityformat/FormatSample.js +60 -60
  252. package/lib/esm/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
  253. package/lib/esm/imodel-components-react/quantityformat/FormatType.d.ts +17 -17
  254. package/lib/esm/imodel-components-react/quantityformat/FormatType.js +63 -63
  255. package/lib/esm/imodel-components-react/quantityformat/FormatType.js.map +1 -1
  256. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.d.ts +17 -17
  257. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js +83 -83
  258. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
  259. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.d.ts +19 -19
  260. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js +110 -110
  261. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
  262. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.d.ts +21 -21
  263. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js +158 -158
  264. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
  265. package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts +22 -22
  266. package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.js +131 -131
  267. package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.js.map +1 -1
  268. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.d.ts +17 -17
  269. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.js +36 -36
  270. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.js.map +1 -1
  271. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.d.ts +17 -17
  272. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.js +24 -24
  273. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.js.map +1 -1
  274. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.d.ts +16 -16
  275. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.js +31 -31
  276. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.js.map +1 -1
  277. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.d.ts +18 -18
  278. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.js +25 -25
  279. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.js.map +1 -1
  280. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.d.ts +17 -17
  281. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.js +27 -27
  282. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.js.map +1 -1
  283. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.d.ts +17 -17
  284. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js +35 -35
  285. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js.map +1 -1
  286. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.d.ts +17 -17
  287. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.js +24 -24
  288. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.js.map +1 -1
  289. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.d.ts +17 -17
  290. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.js +33 -33
  291. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.js.map +1 -1
  292. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts +17 -17
  293. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +69 -69
  294. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
  295. package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.d.ts +23 -23
  296. package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.js +96 -96
  297. package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.js.map +1 -1
  298. package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.d.ts +52 -52
  299. package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.js +139 -139
  300. package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.js.map +1 -1
  301. package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.d.ts +31 -31
  302. package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.js +65 -65
  303. package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.js.map +1 -1
  304. package/lib/esm/imodel-components-react/timeline/InlineEdit.d.ts +27 -27
  305. package/lib/esm/imodel-components-react/timeline/InlineEdit.js +55 -55
  306. package/lib/esm/imodel-components-react/timeline/InlineEdit.js.map +1 -1
  307. package/lib/esm/imodel-components-react/timeline/InlineEdit.scss +26 -26
  308. package/lib/esm/imodel-components-react/timeline/PlayerButton.d.ts +33 -33
  309. package/lib/esm/imodel-components-react/timeline/PlayerButton.js +64 -64
  310. package/lib/esm/imodel-components-react/timeline/PlayerButton.js.map +1 -1
  311. package/lib/esm/imodel-components-react/timeline/PlayerButton.scss +25 -25
  312. package/lib/esm/imodel-components-react/timeline/Scrubber.d.ts +54 -54
  313. package/lib/esm/imodel-components-react/timeline/Scrubber.js +164 -164
  314. package/lib/esm/imodel-components-react/timeline/Scrubber.js.map +1 -1
  315. package/lib/esm/imodel-components-react/timeline/Scrubber.scss +106 -106
  316. package/lib/esm/imodel-components-react/timeline/SolarTimeline.d.ts +77 -77
  317. package/lib/esm/imodel-components-react/timeline/SolarTimeline.js +398 -398
  318. package/lib/esm/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
  319. package/lib/esm/imodel-components-react/timeline/SolarTimeline.scss +357 -357
  320. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.d.ts +15 -15
  321. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.js +28 -28
  322. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.js.map +1 -1
  323. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.scss +39 -39
  324. package/lib/esm/imodel-components-react/timeline/Timeline.scss +164 -164
  325. package/lib/esm/imodel-components-react/timeline/TimelineComponent.d.ts +133 -133
  326. package/lib/esm/imodel-components-react/timeline/TimelineComponent.js +332 -332
  327. package/lib/esm/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
  328. package/lib/esm/imodel-components-react/timeline/TimelineComponent.scss +163 -163
  329. package/lib/esm/imodel-components-react/timeline/interfaces.d.ts +174 -174
  330. package/lib/esm/imodel-components-react/timeline/interfaces.js +42 -42
  331. package/lib/esm/imodel-components-react/timeline/interfaces.js.map +1 -1
  332. package/lib/esm/imodel-components-react/viewport/ViewportComponent.d.ts +42 -42
  333. package/lib/esm/imodel-components-react/viewport/ViewportComponent.js +251 -251
  334. package/lib/esm/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
  335. package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.d.ts +106 -106
  336. package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.js +95 -95
  337. package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.js.map +1 -1
  338. package/lib/esm/imodel-components-react.d.ts +82 -82
  339. package/lib/esm/imodel-components-react.js +87 -87
  340. package/lib/esm/imodel-components-react.js.map +1 -1
  341. package/lib/public/locales/en/UiIModelComponents.json +139 -139
  342. package/package.json +19 -19
@@ -1,94 +1,94 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- @import "~@itwin/core-react/lib/cjs/core-react/index";
6
-
7
- $hovered-icon-color: $buic-foreground-primary-tone;
8
- $saturation-hue-height: 150px;
9
-
10
- .components-colorpicker-panel {
11
- display: flex;
12
- flex-direction: column;
13
-
14
- .components-colorpicker-panel-color {
15
- display: flex;
16
- flex-direction: row;
17
- height: 100%;
18
- column-gap: 20px;
19
-
20
- .components-colorpicker-saturation {
21
- margin: 1em;
22
- display: block;
23
- width: calc(100% - 40px);
24
- height: $saturation-hue-height;
25
- }
26
-
27
- .components-hue-container-vertical {
28
- height: $saturation-hue-height;
29
- margin-top: 1em;
30
- margin-right: .5em;
31
- }
32
- }
33
-
34
- .components-color-swatch {
35
- width: 2.0em;
36
- height: 2.0em;
37
- }
38
- }
39
-
40
- .components-colorpicker-panel-presets {
41
- width: 100%;
42
- height: 100%;
43
- padding-top: 10px;
44
- margin-top: 10px;
45
- margin-bottom: 10px;
46
- display: grid;
47
- grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
48
- column-gap: 2px;
49
- row-gap: 10px;
50
- border-top: 1px solid $buic-inputs-border;
51
- justify-items: center;
52
-
53
- .components-colorpicker-panel-swatch {
54
- width: 2em;
55
- height: 2em;
56
- padding: 0;
57
- border-color: $buic-inputs-border;
58
- }
59
- }
60
-
61
- .components-colorpicker-popup-panel-padding {
62
- display: flex;
63
- flex-direction: column;
64
-
65
- button.core-dialog-close {
66
- margin-left: auto;
67
- background: transparent;
68
- border: none;
69
- color: var(--buic-foreground-body);
70
- }
71
- }
72
-
73
- .components-colorpicker-input-panel {
74
- display: flex;
75
- flex-direction: row;
76
- align-items: center;
77
- justify-content: space-evenly;
78
-
79
- .components-colorpicker-input-value-wrapper {
80
- align-items: center;
81
- display: flex;
82
- flex-direction: row;
83
- gap: 4px;
84
-
85
- .uicore-inputs-labeled-input {
86
- text-align: right;
87
- margin: 0;
88
- }
89
-
90
- .core-number-input-container {
91
- width: 54px;
92
- }
93
- }
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ @import "~@itwin/core-react/lib/cjs/core-react/index";
6
+
7
+ $hovered-icon-color: $buic-foreground-primary-tone;
8
+ $saturation-hue-height: 150px;
9
+
10
+ .components-colorpicker-panel {
11
+ display: flex;
12
+ flex-direction: column;
13
+
14
+ .components-colorpicker-panel-color {
15
+ display: flex;
16
+ flex-direction: row;
17
+ height: 100%;
18
+ column-gap: 20px;
19
+
20
+ .components-colorpicker-saturation {
21
+ margin: 1em;
22
+ display: block;
23
+ width: calc(100% - 40px);
24
+ height: $saturation-hue-height;
25
+ }
26
+
27
+ .components-hue-container-vertical {
28
+ height: $saturation-hue-height;
29
+ margin-top: 1em;
30
+ margin-right: .5em;
31
+ }
32
+ }
33
+
34
+ .components-color-swatch {
35
+ width: 2.0em;
36
+ height: 2.0em;
37
+ }
38
+ }
39
+
40
+ .components-colorpicker-panel-presets {
41
+ width: 100%;
42
+ height: 100%;
43
+ padding-top: 10px;
44
+ margin-top: 10px;
45
+ margin-bottom: 10px;
46
+ display: grid;
47
+ grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
48
+ column-gap: 2px;
49
+ row-gap: 10px;
50
+ border-top: 1px solid $buic-inputs-border;
51
+ justify-items: center;
52
+
53
+ .components-colorpicker-panel-swatch {
54
+ width: 2em;
55
+ height: 2em;
56
+ padding: 0;
57
+ border-color: $buic-inputs-border;
58
+ }
59
+ }
60
+
61
+ .components-colorpicker-popup-panel-padding {
62
+ display: flex;
63
+ flex-direction: column;
64
+
65
+ button.core-dialog-close {
66
+ margin-left: auto;
67
+ background: transparent;
68
+ border: none;
69
+ color: var(--buic-foreground-body);
70
+ }
71
+ }
72
+
73
+ .components-colorpicker-input-panel {
74
+ display: flex;
75
+ flex-direction: row;
76
+ align-items: center;
77
+ justify-content: space-evenly;
78
+
79
+ .components-colorpicker-input-value-wrapper {
80
+ align-items: center;
81
+ display: flex;
82
+ flex-direction: row;
83
+ gap: 4px;
84
+
85
+ .uicore-inputs-labeled-input {
86
+ text-align: right;
87
+ margin: 0;
88
+ }
89
+
90
+ .core-number-input-container {
91
+ width: 54px;
92
+ }
93
+ }
94
94
  }
@@ -1,45 +1,45 @@
1
- /** @packageDocumentation
2
- * @module Color
3
- */
4
- import * as React from "react";
5
- import { ColorDef } from "@itwin/core-common";
6
- import { RelativePosition } from "@itwin/appui-abstract";
7
- import { CommonProps } from "@itwin/core-react";
8
- import "./ColorPickerPopup.scss";
9
- /** Properties for the [[ColorPickerPopup]] React component
10
- * @public
11
- */
12
- export interface ColorPickerPopupProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, CommonProps {
13
- /** Current color */
14
- initialColor: ColorDef;
15
- /** Preset colors. Pass undefined to show default preset colors. Pass empty array to show no presets.
16
- * Displayed in rows of 9 items */
17
- colorDefs?: ColorDef[];
18
- /** Function to call when the color value is changed */
19
- onColorChange?: ((newColor: ColorDef) => void) | undefined;
20
- /** Function to call when the popup is closed */
21
- onClose?: ((colorValue: ColorDef) => void) | undefined;
22
- /** Disabled or not */
23
- disabled?: boolean;
24
- /** Readonly or not, color displayed on button but button will not trigger pop-up */
25
- readonly?: boolean;
26
- /** popup position. If not set RelativePosition.BottomLeft is used */
27
- popupPosition?: RelativePosition;
28
- /** Provides ability to return reference to HTMLButtonElement */
29
- ref?: React.Ref<HTMLButtonElement>;
30
- /** If true show up/down caret next to color */
31
- showCaret?: boolean;
32
- /** If true, don't propagate clicks out of the ColorPicker */
33
- captureClicks?: boolean;
34
- /** If true, don't show close button at top */
35
- hideCloseButton?: boolean;
36
- /** If set show input values */
37
- colorInputType?: "hsl" | "rgb" | "hex";
38
- }
39
- /**
40
- * ColorPickerButton component that allows user to select a color from a set of color swatches or to define a new color.
41
- * @note Using forwardRef so the ColorEditor (Type Editor) can access the ref of the button element inside this component.
42
- * @public
43
- */
44
- export declare const ColorPickerPopup: (props: ColorPickerPopupProps) => JSX.Element | null;
1
+ /** @packageDocumentation
2
+ * @module Color
3
+ */
4
+ import * as React from "react";
5
+ import { ColorDef } from "@itwin/core-common";
6
+ import { RelativePosition } from "@itwin/appui-abstract";
7
+ import { CommonProps } from "@itwin/core-react";
8
+ import "./ColorPickerPopup.scss";
9
+ /** Properties for the [[ColorPickerPopup]] React component
10
+ * @public
11
+ */
12
+ export interface ColorPickerPopupProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, CommonProps {
13
+ /** Current color */
14
+ initialColor: ColorDef;
15
+ /** Preset colors. Pass undefined to show default preset colors. Pass empty array to show no presets.
16
+ * Displayed in rows of 9 items */
17
+ colorDefs?: ColorDef[];
18
+ /** Function to call when the color value is changed */
19
+ onColorChange?: ((newColor: ColorDef) => void) | undefined;
20
+ /** Function to call when the popup is closed */
21
+ onClose?: ((colorValue: ColorDef) => void) | undefined;
22
+ /** Disabled or not */
23
+ disabled?: boolean;
24
+ /** Readonly or not, color displayed on button but button will not trigger pop-up */
25
+ readonly?: boolean;
26
+ /** popup position. If not set RelativePosition.BottomLeft is used */
27
+ popupPosition?: RelativePosition;
28
+ /** Provides ability to return reference to HTMLButtonElement */
29
+ ref?: React.Ref<HTMLButtonElement>;
30
+ /** If true show up/down caret next to color */
31
+ showCaret?: boolean;
32
+ /** If true, don't propagate clicks out of the ColorPicker */
33
+ captureClicks?: boolean;
34
+ /** If true, don't show close button at top */
35
+ hideCloseButton?: boolean;
36
+ /** If set show input values */
37
+ colorInputType?: "hsl" | "rgb" | "hex";
38
+ }
39
+ /**
40
+ * ColorPickerButton component that allows user to select a color from a set of color swatches or to define a new color.
41
+ * @note Using forwardRef so the ColorEditor (Type Editor) can access the ref of the button element inside this component.
42
+ * @public
43
+ */
44
+ export declare const ColorPickerPopup: (props: ColorPickerPopupProps) => JSX.Element | null;
45
45
  //# sourceMappingURL=ColorPickerPopup.d.ts.map
@@ -1,138 +1,138 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- /** @packageDocumentation
7
- * @module Color
8
- */
9
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12
- }) : (function(o, m, k, k2) {
13
- if (k2 === undefined) k2 = k;
14
- o[k2] = m[k];
15
- }));
16
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
- Object.defineProperty(o, "default", { enumerable: true, value: v });
18
- }) : function(o, v) {
19
- o["default"] = v;
20
- });
21
- var __importStar = (this && this.__importStar) || function (mod) {
22
- if (mod && mod.__esModule) return mod;
23
- var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
- __setModuleDefault(result, mod);
26
- return result;
27
- };
28
- var __importDefault = (this && this.__importDefault) || function (mod) {
29
- return (mod && mod.__esModule) ? mod : { "default": mod };
30
- };
31
- Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.ColorPickerPopup = void 0;
33
- // cSpell:ignore colorpicker
34
- const React = __importStar(require("react"));
35
- const classnames_1 = __importDefault(require("classnames"));
36
- const core_common_1 = require("@itwin/core-common");
37
- const appui_abstract_1 = require("@itwin/appui-abstract");
38
- const core_react_1 = require("@itwin/core-react");
39
- // import { ColorPickerPanel } from "./ColorPickerPanel";
40
- const itwinui_react_1 = require("@itwin/itwinui-react");
41
- require("./ColorPickerPopup.scss");
42
- const getCSSColorFromDef_1 = require("./getCSSColorFromDef");
43
- const UiIModelComponents_1 = require("../UiIModelComponents");
44
- // Defined using following pattern (const ColorPickerPopup at bottom) to ensure useful API documentation is extracted
45
- const ForwardRefColorPickerPopup = React.forwardRef(function ForwardRefColorPickerPopup(props, ref) {
46
- const target = React.useRef(null);
47
- const refs = (0, core_react_1.useRefs)(target, ref); // combine ref needed for target with the forwardRef needed by the Parent when parent is a Type Editor.
48
- const [showPopup, setShowPopup] = React.useState(false);
49
- const [colorDef, setColorDef] = React.useState(props.initialColor);
50
- const initialColorRef = React.useRef(props.initialColor);
51
- React.useEffect(() => {
52
- if (props.initialColor !== initialColorRef.current) {
53
- initialColorRef.current = props.initialColor;
54
- setColorDef(props.initialColor);
55
- }
56
- }, [props.initialColor]);
57
- const defaultColors = React.useRef([
58
- itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.red),
59
- itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.orange),
60
- itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.yellow),
61
- itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.green),
62
- itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.blue),
63
- itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.mediumBlue),
64
- itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.indigo),
65
- itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.violet),
66
- itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.black),
67
- itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.white),
68
- itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.cyan),
69
- itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.fuchsia),
70
- itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.tan),
71
- itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.gray),
72
- itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.brown),
73
- itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.purple),
74
- itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.olive),
75
- itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.darkGreen),
76
- ]);
77
- // istanbul ignore next
78
- const closePopup = React.useCallback(() => {
79
- props.onClose && props.onClose(colorDef);
80
- setShowPopup(false);
81
- }, [colorDef, props]);
82
- const togglePopup = React.useCallback(() => {
83
- setShowPopup(!showPopup);
84
- }, [showPopup]);
85
- const handleColorChanged = React.useCallback((newColorValue) => {
86
- const newColor = core_common_1.ColorDef.fromTbgr(newColorValue.toTbgr());
87
- // istanbul ignore else
88
- if (!newColor.equals(colorDef)) {
89
- setColorDef(newColor);
90
- // istanbul ignore else
91
- props.onColorChange && props.onColorChange(newColor);
92
- }
93
- }, [colorDef, props]);
94
- const rgbaString = (0, getCSSColorFromDef_1.getCSSColorFromDef)(colorDef);
95
- const buttonStyle = { ...props.style };
96
- const swatchStyle = { backgroundColor: rgbaString };
97
- const buttonClassNames = (0, classnames_1.default)("components-colorpicker-popup-button", props.readonly && "readonly", props.className);
98
- const clickHandler = (event) => {
99
- // istanbul ignore else
100
- if (props.captureClicks)
101
- event.stopPropagation();
102
- };
103
- const colorOptions = React.useMemo(() => {
104
- if (props.colorDefs && props.colorDefs.length) {
105
- return props.colorDefs.map((def) => itwinui_react_1.ColorValue.fromTbgr(def.tbgr));
106
- }
107
- if (props.colorDefs && 0 === props.colorDefs.length)
108
- return undefined;
109
- return defaultColors.current;
110
- }, [props.colorDefs]);
111
- const popupPosition = undefined !== props.popupPosition ? props.popupPosition : appui_abstract_1.RelativePosition.BottomLeft;
112
- const [closeLabel] = React.useState(() => UiIModelComponents_1.UiIModelComponents.translate("color.close"));
113
- const [togglePopupLabel] = React.useState(() => UiIModelComponents_1.UiIModelComponents.translate("color.toggleColorPopup"));
114
- return (
115
- /* eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */
116
- React.createElement("div", { onClick: clickHandler },
117
- React.createElement("button", { "data-testid": "components-colorpicker-popup-button", onClick: togglePopup, className: buttonClassNames, style: buttonStyle, disabled: props.disabled, ref: refs, title: togglePopupLabel },
118
- React.createElement("div", { className: "components-colorpicker-button-container" },
119
- React.createElement("div", { className: "components-colorpicker-button-color-swatch", style: swatchStyle }),
120
- props.showCaret && React.createElement(core_react_1.WebFontIcon, { className: "components-caret", iconName: showPopup ? "icon-caret-up" : "icon-caret-down", iconSize: "x-small" }))),
121
- React.createElement(core_react_1.Popup, { className: "components-colorpicker-popup", isOpen: showPopup, position: popupPosition, onClose: closePopup, target: target.current, closeOnNestedPopupOutsideClick: true },
122
- React.createElement("div", { className: "components-colorpicker-popup-panel-padding" },
123
- !props.hideCloseButton &&
124
- React.createElement("button", { title: closeLabel, className: "core-focus-trap-ignore-initial core-dialog-close icon icon-close", "data-testid": "core-dialog-close", onClick: togglePopup }),
125
- React.createElement(itwinui_react_1.ColorPicker, { selectedColor: itwinui_react_1.ColorValue.fromTbgr(colorDef.tbgr), onChangeComplete: handleColorChanged },
126
- React.createElement(itwinui_react_1.ColorBuilder, null),
127
- props.colorInputType &&
128
- React.createElement(itwinui_react_1.ColorInputPanel, { defaultColorFormat: props.colorInputType }),
129
- colorOptions &&
130
- React.createElement(itwinui_react_1.ColorPalette, { colors: colorOptions }))))));
131
- });
132
- /**
133
- * ColorPickerButton component that allows user to select a color from a set of color swatches or to define a new color.
134
- * @note Using forwardRef so the ColorEditor (Type Editor) can access the ref of the button element inside this component.
135
- * @public
136
- */
137
- exports.ColorPickerPopup = ForwardRefColorPickerPopup;
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ /** @packageDocumentation
7
+ * @module Color
8
+ */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
28
+ var __importDefault = (this && this.__importDefault) || function (mod) {
29
+ return (mod && mod.__esModule) ? mod : { "default": mod };
30
+ };
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ exports.ColorPickerPopup = void 0;
33
+ // cSpell:ignore colorpicker
34
+ const React = __importStar(require("react"));
35
+ const classnames_1 = __importDefault(require("classnames"));
36
+ const core_common_1 = require("@itwin/core-common");
37
+ const appui_abstract_1 = require("@itwin/appui-abstract");
38
+ const core_react_1 = require("@itwin/core-react");
39
+ // import { ColorPickerPanel } from "./ColorPickerPanel";
40
+ const itwinui_react_1 = require("@itwin/itwinui-react");
41
+ require("./ColorPickerPopup.scss");
42
+ const getCSSColorFromDef_1 = require("./getCSSColorFromDef");
43
+ const UiIModelComponents_1 = require("../UiIModelComponents");
44
+ // Defined using following pattern (const ColorPickerPopup at bottom) to ensure useful API documentation is extracted
45
+ const ForwardRefColorPickerPopup = React.forwardRef(function ForwardRefColorPickerPopup(props, ref) {
46
+ const target = React.useRef(null);
47
+ const refs = (0, core_react_1.useRefs)(target, ref); // combine ref needed for target with the forwardRef needed by the Parent when parent is a Type Editor.
48
+ const [showPopup, setShowPopup] = React.useState(false);
49
+ const [colorDef, setColorDef] = React.useState(props.initialColor);
50
+ const initialColorRef = React.useRef(props.initialColor);
51
+ React.useEffect(() => {
52
+ if (props.initialColor !== initialColorRef.current) {
53
+ initialColorRef.current = props.initialColor;
54
+ setColorDef(props.initialColor);
55
+ }
56
+ }, [props.initialColor]);
57
+ const defaultColors = React.useRef([
58
+ itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.red),
59
+ itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.orange),
60
+ itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.yellow),
61
+ itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.green),
62
+ itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.blue),
63
+ itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.mediumBlue),
64
+ itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.indigo),
65
+ itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.violet),
66
+ itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.black),
67
+ itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.white),
68
+ itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.cyan),
69
+ itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.fuchsia),
70
+ itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.tan),
71
+ itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.gray),
72
+ itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.brown),
73
+ itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.purple),
74
+ itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.olive),
75
+ itwinui_react_1.ColorValue.fromTbgr(core_common_1.ColorByName.darkGreen),
76
+ ]);
77
+ // istanbul ignore next
78
+ const closePopup = React.useCallback(() => {
79
+ props.onClose && props.onClose(colorDef);
80
+ setShowPopup(false);
81
+ }, [colorDef, props]);
82
+ const togglePopup = React.useCallback(() => {
83
+ setShowPopup(!showPopup);
84
+ }, [showPopup]);
85
+ const handleColorChanged = React.useCallback((newColorValue) => {
86
+ const newColor = core_common_1.ColorDef.fromTbgr(newColorValue.toTbgr());
87
+ // istanbul ignore else
88
+ if (!newColor.equals(colorDef)) {
89
+ setColorDef(newColor);
90
+ // istanbul ignore else
91
+ props.onColorChange && props.onColorChange(newColor);
92
+ }
93
+ }, [colorDef, props]);
94
+ const rgbaString = (0, getCSSColorFromDef_1.getCSSColorFromDef)(colorDef);
95
+ const buttonStyle = { ...props.style };
96
+ const swatchStyle = { backgroundColor: rgbaString };
97
+ const buttonClassNames = (0, classnames_1.default)("components-colorpicker-popup-button", props.readonly && "readonly", props.className);
98
+ const clickHandler = (event) => {
99
+ // istanbul ignore else
100
+ if (props.captureClicks)
101
+ event.stopPropagation();
102
+ };
103
+ const colorOptions = React.useMemo(() => {
104
+ if (props.colorDefs && props.colorDefs.length) {
105
+ return props.colorDefs.map((def) => itwinui_react_1.ColorValue.fromTbgr(def.tbgr));
106
+ }
107
+ if (props.colorDefs && 0 === props.colorDefs.length)
108
+ return undefined;
109
+ return defaultColors.current;
110
+ }, [props.colorDefs]);
111
+ const popupPosition = undefined !== props.popupPosition ? props.popupPosition : appui_abstract_1.RelativePosition.BottomLeft;
112
+ const [closeLabel] = React.useState(() => UiIModelComponents_1.UiIModelComponents.translate("color.close"));
113
+ const [togglePopupLabel] = React.useState(() => UiIModelComponents_1.UiIModelComponents.translate("color.toggleColorPopup"));
114
+ return (
115
+ /* eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */
116
+ React.createElement("div", { onClick: clickHandler },
117
+ React.createElement("button", { "data-testid": "components-colorpicker-popup-button", onClick: togglePopup, className: buttonClassNames, style: buttonStyle, disabled: props.disabled, ref: refs, title: togglePopupLabel },
118
+ React.createElement("div", { className: "components-colorpicker-button-container" },
119
+ React.createElement("div", { className: "components-colorpicker-button-color-swatch", style: swatchStyle }),
120
+ props.showCaret && React.createElement(core_react_1.WebFontIcon, { className: "components-caret", iconName: showPopup ? "icon-caret-up" : "icon-caret-down", iconSize: "x-small" }))),
121
+ React.createElement(core_react_1.Popup, { className: "components-colorpicker-popup", isOpen: showPopup, position: popupPosition, onClose: closePopup, target: target.current, closeOnNestedPopupOutsideClick: true },
122
+ React.createElement("div", { className: "components-colorpicker-popup-panel-padding" },
123
+ !props.hideCloseButton &&
124
+ React.createElement("button", { title: closeLabel, className: "core-focus-trap-ignore-initial core-dialog-close icon icon-close", "data-testid": "core-dialog-close", onClick: togglePopup }),
125
+ React.createElement(itwinui_react_1.ColorPicker, { selectedColor: itwinui_react_1.ColorValue.fromTbgr(colorDef.tbgr), onChangeComplete: handleColorChanged },
126
+ React.createElement(itwinui_react_1.ColorBuilder, null),
127
+ props.colorInputType &&
128
+ React.createElement(itwinui_react_1.ColorInputPanel, { defaultColorFormat: props.colorInputType }),
129
+ colorOptions &&
130
+ React.createElement(itwinui_react_1.ColorPalette, { colors: colorOptions }))))));
131
+ });
132
+ /**
133
+ * ColorPickerButton component that allows user to select a color from a set of color swatches or to define a new color.
134
+ * @note Using forwardRef so the ColorEditor (Type Editor) can access the ref of the button element inside this component.
135
+ * @public
136
+ */
137
+ exports.ColorPickerPopup = ForwardRefColorPickerPopup;
138
138
  //# sourceMappingURL=ColorPickerPopup.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ColorPickerPopup.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/color/ColorPickerPopup.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4BAA4B;AAE5B,6CAA+B;AAC/B,4DAAoC;AACpC,oDAA2D;AAC3D,0DAAyD;AACzD,kDAA6E;AAC7E,yDAAyD;AACzD,wDAA4G;AAC5G,mCAAiC;AACjC,6DAA0D;AAC1D,8DAA2D;AAiC3D,qHAAqH;AAErH,MAAM,0BAA0B,GAAG,KAAK,CAAC,UAAU,CACjD,SAAS,0BAA0B,CAAC,KAAK,EAAE,GAAG;IAC5C,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAoB,IAAI,CAAC,CAAC;IACrD,MAAM,IAAI,GAAG,IAAA,oBAAO,EAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAE,uGAAuG;IAC3I,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxD,MAAM,CAAC,QAAQ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ACA,CACJ,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF;;;;GAIG;AACU,QAAA,gBAAgB,GAAyD,0BAA0B,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 Color\n */\n\n// cSpell:ignore colorpicker\n\nimport * as React from \"react\";\nimport classnames from \"classnames\";\nimport { ColorByName, ColorDef } from \"@itwin/core-common\";\nimport { RelativePosition } from \"@itwin/appui-abstract\";\nimport { CommonProps, Popup, useRefs, WebFontIcon } from \"@itwin/core-react\";\n// import { ColorPickerPanel } from \"./ColorPickerPanel\";\nimport { ColorBuilder, ColorInputPanel, ColorPalette, ColorPicker, ColorValue } from \"@itwin/itwinui-react\";\nimport \"./ColorPickerPopup.scss\";\nimport { getCSSColorFromDef } from \"./getCSSColorFromDef\";\nimport { UiIModelComponents } from \"../UiIModelComponents\";\n\n/** Properties for the [[ColorPickerPopup]] React component\n * @public\n */\nexport interface ColorPickerPopupProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, CommonProps {\n /** Current color */\n initialColor: ColorDef;\n /** Preset colors. Pass undefined to show default preset colors. Pass empty array to show no presets.\n * Displayed in rows of 9 items */\n colorDefs?: ColorDef[];\n /** Function to call when the color value is changed */\n onColorChange?: ((newColor: ColorDef) => void) | undefined;\n /** Function to call when the popup is closed */\n onClose?: ((colorValue: ColorDef) => void) | undefined;\n /** Disabled or not */\n disabled?: boolean;\n /** Readonly or not, color displayed on button but button will not trigger pop-up */\n readonly?: boolean;\n /** popup position. If not set RelativePosition.BottomLeft is used */\n popupPosition?: RelativePosition;\n /** Provides ability to return reference to HTMLButtonElement */\n ref?: React.Ref<HTMLButtonElement>;\n /** If true show up/down caret next to color */\n showCaret?: boolean;\n /** If true, don't propagate clicks out of the ColorPicker */\n captureClicks?: boolean;\n /** If true, don't show close button at top */\n hideCloseButton?: boolean;\n /** If set show input values */\n colorInputType?: \"hsl\" | \"rgb\" | \"hex\";\n}\n\n// Defined using following pattern (const ColorPickerPopup at bottom) to ensure useful API documentation is extracted\n\nconst ForwardRefColorPickerPopup = React.forwardRef<HTMLButtonElement, ColorPickerPopupProps>(\n function ForwardRefColorPickerPopup(props, ref) {\n const target = React.useRef<HTMLButtonElement>(null);\n const refs = useRefs(target, ref); // combine ref needed for target with the forwardRef needed by the Parent when parent is a Type Editor.\n const [showPopup, setShowPopup] = React.useState(false);\n const [colorDef, setColorDef] = React.useState(props.initialColor);\n const initialColorRef = React.useRef(props.initialColor);\n\n React.useEffect(() => {\n if (props.initialColor !== initialColorRef.current) {\n initialColorRef.current = props.initialColor;\n setColorDef(props.initialColor);\n }\n }, [props.initialColor]);\n\n const defaultColors = React.useRef(\n [\n ColorValue.fromTbgr(ColorByName.red),\n ColorValue.fromTbgr(ColorByName.orange),\n ColorValue.fromTbgr(ColorByName.yellow),\n ColorValue.fromTbgr(ColorByName.green),\n ColorValue.fromTbgr(ColorByName.blue),\n ColorValue.fromTbgr(ColorByName.mediumBlue),\n ColorValue.fromTbgr(ColorByName.indigo),\n ColorValue.fromTbgr(ColorByName.violet),\n ColorValue.fromTbgr(ColorByName.black),\n ColorValue.fromTbgr(ColorByName.white),\n ColorValue.fromTbgr(ColorByName.cyan),\n ColorValue.fromTbgr(ColorByName.fuchsia),\n ColorValue.fromTbgr(ColorByName.tan),\n ColorValue.fromTbgr(ColorByName.gray),\n ColorValue.fromTbgr(ColorByName.brown),\n ColorValue.fromTbgr(ColorByName.purple),\n ColorValue.fromTbgr(ColorByName.olive),\n ColorValue.fromTbgr(ColorByName.darkGreen),\n ]);\n\n // istanbul ignore next\n const closePopup = React.useCallback(() => {\n props.onClose && props.onClose(colorDef);\n setShowPopup(false);\n }, [colorDef, props]);\n\n const togglePopup = React.useCallback(() => {\n setShowPopup(!showPopup);\n }, [showPopup]);\n\n const handleColorChanged = React.useCallback((newColorValue: ColorValue) => {\n const newColor = ColorDef.fromTbgr(newColorValue.toTbgr());\n // istanbul ignore else\n if (!newColor.equals(colorDef)) {\n setColorDef(newColor);\n\n // istanbul ignore else\n props.onColorChange && props.onColorChange(newColor);\n }\n }, [colorDef, props]);\n\n const rgbaString = getCSSColorFromDef(colorDef);\n\n const buttonStyle = { ...props.style } as React.CSSProperties;\n const swatchStyle = { backgroundColor: rgbaString } as React.CSSProperties;\n const buttonClassNames = classnames(\"components-colorpicker-popup-button\",\n props.readonly && \"readonly\",\n props.className,\n );\n\n const clickHandler = (event: React.MouseEvent) => {\n // istanbul ignore else\n if (props.captureClicks)\n event.stopPropagation();\n };\n\n const colorOptions = React.useMemo(() => {\n if (props.colorDefs && props.colorDefs.length) {\n return props.colorDefs.map((def) => ColorValue.fromTbgr(def.tbgr));\n }\n if (props.colorDefs && 0 === props.colorDefs.length)\n return undefined;\n return defaultColors.current;\n }, [props.colorDefs]);\n const popupPosition = undefined !== props.popupPosition ? props.popupPosition : RelativePosition.BottomLeft;\n\n const [closeLabel] = React.useState(() => UiIModelComponents.translate(\"color.close\"));\n const [togglePopupLabel] = React.useState(() => UiIModelComponents.translate(\"color.toggleColorPopup\"));\n\n return (\n /* eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */\n <div onClick={clickHandler}>\n <button data-testid=\"components-colorpicker-popup-button\" onClick={togglePopup} className={buttonClassNames} style={buttonStyle}\n disabled={props.disabled} ref={refs} title={togglePopupLabel} >\n <div className=\"components-colorpicker-button-container\">\n <div className=\"components-colorpicker-button-color-swatch\" style={swatchStyle} />\n {props.showCaret && <WebFontIcon className=\"components-caret\" iconName={showPopup ? \"icon-caret-up\" : \"icon-caret-down\"} iconSize=\"x-small\" />}\n </div>\n </button>\n <Popup\n className=\"components-colorpicker-popup\"\n isOpen={showPopup}\n position={popupPosition}\n onClose={closePopup}\n target={target.current}\n closeOnNestedPopupOutsideClick\n >\n <div className=\"components-colorpicker-popup-panel-padding\">\n {!props.hideCloseButton &&\n <button title={closeLabel}\n className={\"core-focus-trap-ignore-initial core-dialog-close icon icon-close\"}\n data-testid=\"core-dialog-close\"\n onClick={togglePopup}\n />}\n <ColorPicker selectedColor={ColorValue.fromTbgr(colorDef.tbgr)} onChangeComplete={handleColorChanged} >\n <ColorBuilder />\n {props.colorInputType &&\n <ColorInputPanel defaultColorFormat={props.colorInputType} />}\n {colorOptions &&\n <ColorPalette colors={colorOptions} />}\n </ColorPicker>\n </div>\n </Popup>\n </div>\n );\n }\n);\n\n/**\n * ColorPickerButton component that allows user to select a color from a set of color swatches or to define a new color.\n * @note Using forwardRef so the ColorEditor (Type Editor) can access the ref of the button element inside this component.\n * @public\n */\nexport const ColorPickerPopup: (props: ColorPickerPopupProps) => JSX.Element | null = ForwardRefColorPickerPopup;\n"]}
1
+ {"version":3,"file":"ColorPickerPopup.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/color/ColorPickerPopup.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4BAA4B;AAE5B,6CAA+B;AAC/B,4DAAoC;AACpC,oDAA2D;AAC3D,0DAAyD;AACzD,kDAA6E;AAC7E,yDAAyD;AACzD,wDAA4G;AAC5G,mCAAiC;AACjC,6DAA0D;AAC1D,8DAA2D;AAiC3D,qHAAqH;AAErH,MAAM,0BAA0B,GAAG,KAAK,CAAC,UAAU,CACjD,SAAS,0BAA0B,CAAC,KAAK,EAAE,GAAG;IAC5C,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAoB,IAAI,CAAC,CAAC;IACrD,MAAM,IAAI,GAAG,IAAA,oBAAO,EAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAE,uGAAuG;IAC3I,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAA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,CAAC,CACF,CAAC;AAEF;;;;GAIG;AACU,QAAA,gBAAgB,GAAyD,0BAA0B,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 Color\r\n */\r\n\r\n// cSpell:ignore colorpicker\r\n\r\nimport * as React from \"react\";\r\nimport classnames from \"classnames\";\r\nimport { ColorByName, ColorDef } from \"@itwin/core-common\";\r\nimport { RelativePosition } from \"@itwin/appui-abstract\";\r\nimport { CommonProps, Popup, useRefs, WebFontIcon } from \"@itwin/core-react\";\r\n// import { ColorPickerPanel } from \"./ColorPickerPanel\";\r\nimport { ColorBuilder, ColorInputPanel, ColorPalette, ColorPicker, ColorValue } from \"@itwin/itwinui-react\";\r\nimport \"./ColorPickerPopup.scss\";\r\nimport { getCSSColorFromDef } from \"./getCSSColorFromDef\";\r\nimport { UiIModelComponents } from \"../UiIModelComponents\";\r\n\r\n/** Properties for the [[ColorPickerPopup]] React component\r\n * @public\r\n */\r\nexport interface ColorPickerPopupProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, CommonProps {\r\n /** Current color */\r\n initialColor: ColorDef;\r\n /** Preset colors. Pass undefined to show default preset colors. Pass empty array to show no presets.\r\n * Displayed in rows of 9 items */\r\n colorDefs?: ColorDef[];\r\n /** Function to call when the color value is changed */\r\n onColorChange?: ((newColor: ColorDef) => void) | undefined;\r\n /** Function to call when the popup is closed */\r\n onClose?: ((colorValue: ColorDef) => void) | undefined;\r\n /** Disabled or not */\r\n disabled?: boolean;\r\n /** Readonly or not, color displayed on button but button will not trigger pop-up */\r\n readonly?: boolean;\r\n /** popup position. If not set RelativePosition.BottomLeft is used */\r\n popupPosition?: RelativePosition;\r\n /** Provides ability to return reference to HTMLButtonElement */\r\n ref?: React.Ref<HTMLButtonElement>;\r\n /** If true show up/down caret next to color */\r\n showCaret?: boolean;\r\n /** If true, don't propagate clicks out of the ColorPicker */\r\n captureClicks?: boolean;\r\n /** If true, don't show close button at top */\r\n hideCloseButton?: boolean;\r\n /** If set show input values */\r\n colorInputType?: \"hsl\" | \"rgb\" | \"hex\";\r\n}\r\n\r\n// Defined using following pattern (const ColorPickerPopup at bottom) to ensure useful API documentation is extracted\r\n\r\nconst ForwardRefColorPickerPopup = React.forwardRef<HTMLButtonElement, ColorPickerPopupProps>(\r\n function ForwardRefColorPickerPopup(props, ref) {\r\n const target = React.useRef<HTMLButtonElement>(null);\r\n const refs = useRefs(target, ref); // combine ref needed for target with the forwardRef needed by the Parent when parent is a Type Editor.\r\n const [showPopup, setShowPopup] = React.useState(false);\r\n const [colorDef, setColorDef] = React.useState(props.initialColor);\r\n const initialColorRef = React.useRef(props.initialColor);\r\n\r\n React.useEffect(() => {\r\n if (props.initialColor !== initialColorRef.current) {\r\n initialColorRef.current = props.initialColor;\r\n setColorDef(props.initialColor);\r\n }\r\n }, [props.initialColor]);\r\n\r\n const defaultColors = React.useRef(\r\n [\r\n ColorValue.fromTbgr(ColorByName.red),\r\n ColorValue.fromTbgr(ColorByName.orange),\r\n ColorValue.fromTbgr(ColorByName.yellow),\r\n ColorValue.fromTbgr(ColorByName.green),\r\n ColorValue.fromTbgr(ColorByName.blue),\r\n ColorValue.fromTbgr(ColorByName.mediumBlue),\r\n ColorValue.fromTbgr(ColorByName.indigo),\r\n ColorValue.fromTbgr(ColorByName.violet),\r\n ColorValue.fromTbgr(ColorByName.black),\r\n ColorValue.fromTbgr(ColorByName.white),\r\n ColorValue.fromTbgr(ColorByName.cyan),\r\n ColorValue.fromTbgr(ColorByName.fuchsia),\r\n ColorValue.fromTbgr(ColorByName.tan),\r\n ColorValue.fromTbgr(ColorByName.gray),\r\n ColorValue.fromTbgr(ColorByName.brown),\r\n ColorValue.fromTbgr(ColorByName.purple),\r\n ColorValue.fromTbgr(ColorByName.olive),\r\n ColorValue.fromTbgr(ColorByName.darkGreen),\r\n ]);\r\n\r\n // istanbul ignore next\r\n const closePopup = React.useCallback(() => {\r\n props.onClose && props.onClose(colorDef);\r\n setShowPopup(false);\r\n }, [colorDef, props]);\r\n\r\n const togglePopup = React.useCallback(() => {\r\n setShowPopup(!showPopup);\r\n }, [showPopup]);\r\n\r\n const handleColorChanged = React.useCallback((newColorValue: ColorValue) => {\r\n const newColor = ColorDef.fromTbgr(newColorValue.toTbgr());\r\n // istanbul ignore else\r\n if (!newColor.equals(colorDef)) {\r\n setColorDef(newColor);\r\n\r\n // istanbul ignore else\r\n props.onColorChange && props.onColorChange(newColor);\r\n }\r\n }, [colorDef, props]);\r\n\r\n const rgbaString = getCSSColorFromDef(colorDef);\r\n\r\n const buttonStyle = { ...props.style } as React.CSSProperties;\r\n const swatchStyle = { backgroundColor: rgbaString } as React.CSSProperties;\r\n const buttonClassNames = classnames(\"components-colorpicker-popup-button\",\r\n props.readonly && \"readonly\",\r\n props.className,\r\n );\r\n\r\n const clickHandler = (event: React.MouseEvent) => {\r\n // istanbul ignore else\r\n if (props.captureClicks)\r\n event.stopPropagation();\r\n };\r\n\r\n const colorOptions = React.useMemo(() => {\r\n if (props.colorDefs && props.colorDefs.length) {\r\n return props.colorDefs.map((def) => ColorValue.fromTbgr(def.tbgr));\r\n }\r\n if (props.colorDefs && 0 === props.colorDefs.length)\r\n return undefined;\r\n return defaultColors.current;\r\n }, [props.colorDefs]);\r\n const popupPosition = undefined !== props.popupPosition ? props.popupPosition : RelativePosition.BottomLeft;\r\n\r\n const [closeLabel] = React.useState(() => UiIModelComponents.translate(\"color.close\"));\r\n const [togglePopupLabel] = React.useState(() => UiIModelComponents.translate(\"color.toggleColorPopup\"));\r\n\r\n return (\r\n /* eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */\r\n <div onClick={clickHandler}>\r\n <button data-testid=\"components-colorpicker-popup-button\" onClick={togglePopup} className={buttonClassNames} style={buttonStyle}\r\n disabled={props.disabled} ref={refs} title={togglePopupLabel} >\r\n <div className=\"components-colorpicker-button-container\">\r\n <div className=\"components-colorpicker-button-color-swatch\" style={swatchStyle} />\r\n {props.showCaret && <WebFontIcon className=\"components-caret\" iconName={showPopup ? \"icon-caret-up\" : \"icon-caret-down\"} iconSize=\"x-small\" />}\r\n </div>\r\n </button>\r\n <Popup\r\n className=\"components-colorpicker-popup\"\r\n isOpen={showPopup}\r\n position={popupPosition}\r\n onClose={closePopup}\r\n target={target.current}\r\n closeOnNestedPopupOutsideClick\r\n >\r\n <div className=\"components-colorpicker-popup-panel-padding\">\r\n {!props.hideCloseButton &&\r\n <button title={closeLabel}\r\n className={\"core-focus-trap-ignore-initial core-dialog-close icon icon-close\"}\r\n data-testid=\"core-dialog-close\"\r\n onClick={togglePopup}\r\n />}\r\n <ColorPicker selectedColor={ColorValue.fromTbgr(colorDef.tbgr)} onChangeComplete={handleColorChanged} >\r\n <ColorBuilder />\r\n {props.colorInputType &&\r\n <ColorInputPanel defaultColorFormat={props.colorInputType} />}\r\n {colorOptions &&\r\n <ColorPalette colors={colorOptions} />}\r\n </ColorPicker>\r\n </div>\r\n </Popup>\r\n </div>\r\n );\r\n }\r\n);\r\n\r\n/**\r\n * ColorPickerButton component that allows user to select a color from a set of color swatches or to define a new color.\r\n * @note Using forwardRef so the ColorEditor (Type Editor) can access the ref of the button element inside this component.\r\n * @public\r\n */\r\nexport const ColorPickerPopup: (props: ColorPickerPopupProps) => JSX.Element | null = ForwardRefColorPickerPopup;\r\n"]}