@itwin/imodel-components-react 3.4.0 → 3.4.1

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,49 +1,49 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- @import "~@itwin/core-react/lib/cjs/core-react/style/themecolors";
6
- @import "~@itwin/itwinui-css/scss/style/typography";
7
-
8
- .components-lineweight-swatch {
9
- font-size: $iui-font-size;
10
- color: $buic-foreground-body;
11
- border: none;
12
- background: inherit;
13
- width: 100%;
14
- display: flex;
15
- flex-direction: row;
16
- align-items: center;
17
- padding: 3px 15px 3px 0;
18
- min-height: 22px;
19
- box-sizing: border-box;
20
-
21
- // remove inner focus ring that is specific to Firefox.
22
- &::-moz-focus-inner {
23
- border: 0px;
24
- }
25
-
26
- &:focus {
27
- outline: 1px solid $buic-row-selection;
28
- }
29
-
30
- &[disabled] {
31
- opacity: .2;
32
- cursor: default;
33
- }
34
-
35
- >span {
36
- width: 1.5em;
37
- text-align: right;
38
- }
39
-
40
- >div {
41
- flex: 1;
42
- background: $buic-foreground-body;
43
- margin-left: 15px;
44
- }
45
- }
46
-
47
- .components-lineweight-swatch.hide-label>span {
48
- display: none;
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ @import "~@itwin/core-react/lib/cjs/core-react/style/themecolors";
6
+ @import "~@itwin/itwinui-css/scss/style/typography";
7
+
8
+ .components-lineweight-swatch {
9
+ font-size: $iui-font-size;
10
+ color: $buic-foreground-body;
11
+ border: none;
12
+ background: inherit;
13
+ width: 100%;
14
+ display: flex;
15
+ flex-direction: row;
16
+ align-items: center;
17
+ padding: 3px 15px 3px 0;
18
+ min-height: 22px;
19
+ box-sizing: border-box;
20
+
21
+ // remove inner focus ring that is specific to Firefox.
22
+ &::-moz-focus-inner {
23
+ border: 0px;
24
+ }
25
+
26
+ &:focus {
27
+ outline: 1px solid $buic-row-selection;
28
+ }
29
+
30
+ &[disabled] {
31
+ opacity: .2;
32
+ cursor: default;
33
+ }
34
+
35
+ >span {
36
+ width: 1.5em;
37
+ text-align: right;
38
+ }
39
+
40
+ >div {
41
+ flex: 1;
42
+ background: $buic-foreground-body;
43
+ margin-left: 15px;
44
+ }
45
+ }
46
+
47
+ .components-lineweight-swatch.hide-label>span {
48
+ display: none;
49
49
  }
@@ -1,61 +1,61 @@
1
- /** @packageDocumentation
2
- * @module LineWeight
3
- */
4
- import "./WeightPickerButton.scss";
5
- import * as React from "react";
6
- import { ColorDef } from "@itwin/core-common";
7
- import { CommonProps } from "@itwin/core-react";
8
- /** Properties for the [[WeightPickerButton]] React component
9
- * @public
10
- */
11
- export interface WeightPickerProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, CommonProps {
12
- /** active weight */
13
- activeWeight: number;
14
- /** available weights */
15
- weights: number[];
16
- /** color specification */
17
- colorDef?: ColorDef;
18
- /** function to run when user selects weight swatch */
19
- onLineWeightPick?: ((weight: number) => void) | undefined;
20
- /** Disabled or not */
21
- disabled?: boolean;
22
- /** Readonly or not */
23
- readonly?: boolean;
24
- /** hide the weight label */
25
- hideLabel?: boolean;
26
- /** Title to show at top of DropDown */
27
- dropDownTitle?: string;
28
- }
29
- /** @internal */
30
- interface WeightPickerState {
31
- showPopup: boolean;
32
- targetElement: HTMLDivElement | null;
33
- }
34
- /** WeightPickerButton component
35
- * @public
36
- */
37
- export declare class WeightPickerButton extends React.PureComponent<WeightPickerProps, WeightPickerState> {
38
- private _target;
39
- private _weightsContainer;
40
- private _focusTarget;
41
- /** @internal */
42
- constructor(props: WeightPickerProps);
43
- setFocus(): void;
44
- static defaultProps: {
45
- weights: number[];
46
- };
47
- private _togglePopup;
48
- private _onPopupOpened;
49
- private _closePopup;
50
- private _handleWeightPicked;
51
- componentDidMount(): void;
52
- private buildIdForWeight;
53
- private moveFocusInPopup;
54
- private _handleKeyDown;
55
- private _setWeightContainer;
56
- private renderPopup;
57
- /** @internal */
58
- render(): JSX.Element;
59
- }
60
- export {};
1
+ /** @packageDocumentation
2
+ * @module LineWeight
3
+ */
4
+ import "./WeightPickerButton.scss";
5
+ import * as React from "react";
6
+ import { ColorDef } from "@itwin/core-common";
7
+ import { CommonProps } from "@itwin/core-react";
8
+ /** Properties for the [[WeightPickerButton]] React component
9
+ * @public
10
+ */
11
+ export interface WeightPickerProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, CommonProps {
12
+ /** active weight */
13
+ activeWeight: number;
14
+ /** available weights */
15
+ weights: number[];
16
+ /** color specification */
17
+ colorDef?: ColorDef;
18
+ /** function to run when user selects weight swatch */
19
+ onLineWeightPick?: ((weight: number) => void) | undefined;
20
+ /** Disabled or not */
21
+ disabled?: boolean;
22
+ /** Readonly or not */
23
+ readonly?: boolean;
24
+ /** hide the weight label */
25
+ hideLabel?: boolean;
26
+ /** Title to show at top of DropDown */
27
+ dropDownTitle?: string;
28
+ }
29
+ /** @internal */
30
+ interface WeightPickerState {
31
+ showPopup: boolean;
32
+ targetElement: HTMLDivElement | null;
33
+ }
34
+ /** WeightPickerButton component
35
+ * @public
36
+ */
37
+ export declare class WeightPickerButton extends React.PureComponent<WeightPickerProps, WeightPickerState> {
38
+ private _target;
39
+ private _weightsContainer;
40
+ private _focusTarget;
41
+ /** @internal */
42
+ constructor(props: WeightPickerProps);
43
+ setFocus(): void;
44
+ static defaultProps: {
45
+ weights: number[];
46
+ };
47
+ private _togglePopup;
48
+ private _onPopupOpened;
49
+ private _closePopup;
50
+ private _handleWeightPicked;
51
+ componentDidMount(): void;
52
+ private buildIdForWeight;
53
+ private moveFocusInPopup;
54
+ private _handleKeyDown;
55
+ private _setWeightContainer;
56
+ private renderPopup;
57
+ /** @internal */
58
+ render(): JSX.Element;
59
+ }
60
+ export {};
61
61
  //# sourceMappingURL=WeightPickerButton.d.ts.map
@@ -1,160 +1,160 @@
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 LineWeight
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.WeightPickerButton = void 0;
33
- require("./WeightPickerButton.scss");
34
- const classnames_1 = __importDefault(require("classnames"));
35
- const React = __importStar(require("react"));
36
- const appui_abstract_1 = require("@itwin/appui-abstract");
37
- const core_react_1 = require("@itwin/core-react");
38
- const Swatch_1 = require("./Swatch");
39
- /** WeightPickerButton component
40
- * @public
41
- */
42
- class WeightPickerButton extends React.PureComponent {
43
- /** @internal */
44
- constructor(props) {
45
- super(props);
46
- this._target = React.createRef();
47
- this._weightsContainer = null;
48
- this._focusTarget = React.createRef(); // weight button that should receive focus after popup is open
49
- this._togglePopup = () => {
50
- if (this.props.readonly)
51
- return;
52
- this.setState((prevState) => ({ showPopup: !prevState.showPopup }));
53
- };
54
- this._onPopupOpened = () => {
55
- };
56
- this._closePopup = () => {
57
- this.setState((_prevState) => ({ showPopup: false }));
58
- };
59
- this._handleWeightPicked = (weight) => {
60
- this._closePopup();
61
- this.props.onLineWeightPick && this.props.onLineWeightPick(weight);
62
- };
63
- this._handleKeyDown = (event) => {
64
- if (event.key === appui_abstract_1.SpecialKey.Enter) {
65
- event.preventDefault();
66
- event.stopPropagation();
67
- const weightButton = document.activeElement;
68
- // istanbul ignore else
69
- if (weightButton.tagName === "BUTTON") {
70
- try {
71
- const values = weightButton.id.split("-");
72
- // istanbul ignore else
73
- if (values.length) {
74
- const weight = parseInt(values[values.length - 1], 10);
75
- // istanbul ignore else
76
- if (!isNaN(weight)) {
77
- // istanbul ignore else
78
- if (this.props.onLineWeightPick)
79
- this.props.onLineWeightPick(weight);
80
- }
81
- }
82
- }
83
- catch { }
84
- }
85
- this._closePopup();
86
- }
87
- else {
88
- switch (event.key) {
89
- case appui_abstract_1.SpecialKey.ArrowDown:
90
- this.moveFocusInPopup(false, event);
91
- break;
92
- case appui_abstract_1.SpecialKey.ArrowUp:
93
- this.moveFocusInPopup(true, event);
94
- break;
95
- }
96
- }
97
- };
98
- this._setWeightContainer = (el) => {
99
- this._weightsContainer = el;
100
- };
101
- this.state = { showPopup: false, targetElement: null };
102
- }
103
- setFocus() {
104
- // istanbul ignore next
105
- this._focusTarget.current && this._focusTarget.current.focus();
106
- }
107
- componentDidMount() {
108
- // eslint-disable-next-line no-console
109
- // console.log(`WeightPickerButton.componentDidMount focusRef=${this._focusTarget && this._focusTarget.current ? "set" : "unset"}`);
110
- this.setState({ targetElement: this._target.current });
111
- }
112
- buildIdForWeight(weight) {
113
- return `ui-core-lineweight-${weight}`;
114
- }
115
- moveFocusInPopup(moveUp, event) {
116
- const activeElement = document.activeElement;
117
- // istanbul ignore else
118
- if (this._weightsContainer && activeElement && activeElement.tagName === "BUTTON") {
119
- const values = activeElement.id.split("-");
120
- // istanbul ignore else
121
- if (values.length === 4 && values[2] === "lineweight") {
122
- const weight = parseInt(values[3], 10);
123
- const foundIndex = this.props.weights.findIndex((val) => val === weight);
124
- // istanbul ignore next
125
- if (foundIndex < 0)
126
- return;
127
- const nextWeight = moveUp ? (foundIndex <= 0 ? this.props.weights[this.props.weights.length - 1] : this.props.weights[foundIndex - 1]) :
128
- (foundIndex < this.props.weights.length - 1 ? this.props.weights[foundIndex + 1] : this.props.weights[0]);
129
- const focusLocation = this._weightsContainer.querySelector(`#${this.buildIdForWeight(nextWeight)}`);
130
- // istanbul ignore else
131
- if (focusLocation) {
132
- focusLocation.focus();
133
- event.preventDefault();
134
- event.stopPropagation();
135
- }
136
- }
137
- }
138
- }
139
- renderPopup(title) {
140
- return (React.createElement("div", { className: "components-weightpicker-popup-container" },
141
- title && React.createElement("h4", null, title),
142
- React.createElement("ul", { "data-testid": "components-weightpicker-popup-lines", className: "components-weightpicker-popup-lines", onKeyDown: this._handleKeyDown, ref: this._setWeightContainer }, this.props.weights.map((weight, index) => {
143
- const classNames = (0, classnames_1.default)("components-weightpicker-swatch", weight === this.props.activeWeight && "active");
144
- return (React.createElement(Swatch_1.LineWeightSwatch, { className: classNames, key: index, colorDef: this.props.colorDef, id: this.buildIdForWeight(weight), hideLabel: this.props.hideLabel, onClick: this._handleWeightPicked.bind(this, weight), weight: weight }));
145
- }))));
146
- }
147
- /** @internal */
148
- render() {
149
- const buttonClassNames = (0, classnames_1.default)("components-weightpicker-button", this.props.className);
150
- return (React.createElement(React.Fragment, null,
151
- React.createElement("div", { ref: this._target, style: this.props.style },
152
- React.createElement(Swatch_1.LineWeightSwatch, { "data-testid": "components-weightpicker-button", className: buttonClassNames, weight: this.props.activeWeight, colorDef: this.props.colorDef, readonly: this.props.readonly, disabled: this.props.disabled, hideLabel: this.props.hideLabel, "aria-haspopup": "listbox", "aria-expanded": this.state.showPopup, onClick: this._togglePopup })),
153
- React.createElement(core_react_1.ElementResizeObserver, { watchedElement: this.state.targetElement, render: ({ width }) => (React.createElement(core_react_1.Popup, { className: "components-weightpicker-popup", style: { width: `${width}px` }, isOpen: this.state.showPopup, position: appui_abstract_1.RelativePosition.Bottom, offset: 0, showShadow: false, onClose: this._closePopup, onOpen: this._onPopupOpened, focusTarget: `#${this.buildIdForWeight(this.props.activeWeight)}`, moveFocus: true, target: this.state.targetElement, closeOnNestedPopupOutsideClick: true }, this.renderPopup(this.props.dropDownTitle))) })));
154
- }
155
- }
156
- exports.WeightPickerButton = WeightPickerButton;
157
- WeightPickerButton.defaultProps = {
158
- weights: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
159
- };
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 LineWeight
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.WeightPickerButton = void 0;
33
+ require("./WeightPickerButton.scss");
34
+ const classnames_1 = __importDefault(require("classnames"));
35
+ const React = __importStar(require("react"));
36
+ const appui_abstract_1 = require("@itwin/appui-abstract");
37
+ const core_react_1 = require("@itwin/core-react");
38
+ const Swatch_1 = require("./Swatch");
39
+ /** WeightPickerButton component
40
+ * @public
41
+ */
42
+ class WeightPickerButton extends React.PureComponent {
43
+ /** @internal */
44
+ constructor(props) {
45
+ super(props);
46
+ this._target = React.createRef();
47
+ this._weightsContainer = null;
48
+ this._focusTarget = React.createRef(); // weight button that should receive focus after popup is open
49
+ this._togglePopup = () => {
50
+ if (this.props.readonly)
51
+ return;
52
+ this.setState((prevState) => ({ showPopup: !prevState.showPopup }));
53
+ };
54
+ this._onPopupOpened = () => {
55
+ };
56
+ this._closePopup = () => {
57
+ this.setState((_prevState) => ({ showPopup: false }));
58
+ };
59
+ this._handleWeightPicked = (weight) => {
60
+ this._closePopup();
61
+ this.props.onLineWeightPick && this.props.onLineWeightPick(weight);
62
+ };
63
+ this._handleKeyDown = (event) => {
64
+ if (event.key === appui_abstract_1.SpecialKey.Enter) {
65
+ event.preventDefault();
66
+ event.stopPropagation();
67
+ const weightButton = document.activeElement;
68
+ // istanbul ignore else
69
+ if (weightButton.tagName === "BUTTON") {
70
+ try {
71
+ const values = weightButton.id.split("-");
72
+ // istanbul ignore else
73
+ if (values.length) {
74
+ const weight = parseInt(values[values.length - 1], 10);
75
+ // istanbul ignore else
76
+ if (!isNaN(weight)) {
77
+ // istanbul ignore else
78
+ if (this.props.onLineWeightPick)
79
+ this.props.onLineWeightPick(weight);
80
+ }
81
+ }
82
+ }
83
+ catch { }
84
+ }
85
+ this._closePopup();
86
+ }
87
+ else {
88
+ switch (event.key) {
89
+ case appui_abstract_1.SpecialKey.ArrowDown:
90
+ this.moveFocusInPopup(false, event);
91
+ break;
92
+ case appui_abstract_1.SpecialKey.ArrowUp:
93
+ this.moveFocusInPopup(true, event);
94
+ break;
95
+ }
96
+ }
97
+ };
98
+ this._setWeightContainer = (el) => {
99
+ this._weightsContainer = el;
100
+ };
101
+ this.state = { showPopup: false, targetElement: null };
102
+ }
103
+ setFocus() {
104
+ // istanbul ignore next
105
+ this._focusTarget.current && this._focusTarget.current.focus();
106
+ }
107
+ componentDidMount() {
108
+ // eslint-disable-next-line no-console
109
+ // console.log(`WeightPickerButton.componentDidMount focusRef=${this._focusTarget && this._focusTarget.current ? "set" : "unset"}`);
110
+ this.setState({ targetElement: this._target.current });
111
+ }
112
+ buildIdForWeight(weight) {
113
+ return `ui-core-lineweight-${weight}`;
114
+ }
115
+ moveFocusInPopup(moveUp, event) {
116
+ const activeElement = document.activeElement;
117
+ // istanbul ignore else
118
+ if (this._weightsContainer && activeElement && activeElement.tagName === "BUTTON") {
119
+ const values = activeElement.id.split("-");
120
+ // istanbul ignore else
121
+ if (values.length === 4 && values[2] === "lineweight") {
122
+ const weight = parseInt(values[3], 10);
123
+ const foundIndex = this.props.weights.findIndex((val) => val === weight);
124
+ // istanbul ignore next
125
+ if (foundIndex < 0)
126
+ return;
127
+ const nextWeight = moveUp ? (foundIndex <= 0 ? this.props.weights[this.props.weights.length - 1] : this.props.weights[foundIndex - 1]) :
128
+ (foundIndex < this.props.weights.length - 1 ? this.props.weights[foundIndex + 1] : this.props.weights[0]);
129
+ const focusLocation = this._weightsContainer.querySelector(`#${this.buildIdForWeight(nextWeight)}`);
130
+ // istanbul ignore else
131
+ if (focusLocation) {
132
+ focusLocation.focus();
133
+ event.preventDefault();
134
+ event.stopPropagation();
135
+ }
136
+ }
137
+ }
138
+ }
139
+ renderPopup(title) {
140
+ return (React.createElement("div", { className: "components-weightpicker-popup-container" },
141
+ title && React.createElement("h4", null, title),
142
+ React.createElement("ul", { "data-testid": "components-weightpicker-popup-lines", className: "components-weightpicker-popup-lines", onKeyDown: this._handleKeyDown, ref: this._setWeightContainer }, this.props.weights.map((weight, index) => {
143
+ const classNames = (0, classnames_1.default)("components-weightpicker-swatch", weight === this.props.activeWeight && "active");
144
+ return (React.createElement(Swatch_1.LineWeightSwatch, { className: classNames, key: index, colorDef: this.props.colorDef, id: this.buildIdForWeight(weight), hideLabel: this.props.hideLabel, onClick: this._handleWeightPicked.bind(this, weight), weight: weight }));
145
+ }))));
146
+ }
147
+ /** @internal */
148
+ render() {
149
+ const buttonClassNames = (0, classnames_1.default)("components-weightpicker-button", this.props.className);
150
+ return (React.createElement(React.Fragment, null,
151
+ React.createElement("div", { ref: this._target, style: this.props.style },
152
+ React.createElement(Swatch_1.LineWeightSwatch, { "data-testid": "components-weightpicker-button", className: buttonClassNames, weight: this.props.activeWeight, colorDef: this.props.colorDef, readonly: this.props.readonly, disabled: this.props.disabled, hideLabel: this.props.hideLabel, "aria-haspopup": "listbox", "aria-expanded": this.state.showPopup, onClick: this._togglePopup })),
153
+ React.createElement(core_react_1.ElementResizeObserver, { watchedElement: this.state.targetElement, render: ({ width }) => (React.createElement(core_react_1.Popup, { className: "components-weightpicker-popup", style: { width: `${width}px` }, isOpen: this.state.showPopup, position: appui_abstract_1.RelativePosition.Bottom, offset: 0, showShadow: false, onClose: this._closePopup, onOpen: this._onPopupOpened, focusTarget: `#${this.buildIdForWeight(this.props.activeWeight)}`, moveFocus: true, target: this.state.targetElement, closeOnNestedPopupOutsideClick: true }, this.renderPopup(this.props.dropDownTitle))) })));
154
+ }
155
+ }
156
+ exports.WeightPickerButton = WeightPickerButton;
157
+ WeightPickerButton.defaultProps = {
158
+ weights: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
159
+ };
160
160
  //# sourceMappingURL=WeightPickerButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"WeightPickerButton.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/lineweight/WeightPickerButton.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,qCAAmC;AACnC,4DAAoC;AACpC,6CAA+B;AAE/B,0DAAqE;AACrE,kDAA8E;AAC9E,qCAA4C;AAgC5C;;GAEG;AACH,MAAa,kBAAmB,SAAQ,KAAK,CAAC,aAAmD;IAK/F,gBAAgB;IAChB,YAAY,KAAwB;QAClC,KAAK,CAAC,KAAK,CAAC,CAAC;QANP,YAAO,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;QAC5C,sBAAiB,GAA0B,IAAI,CAAC;QAChD,iBAAY,GAAG,KAAK,CAAC,SAAS,EAAqB,CAAC,CAAE,8DAA8D;QAkBpH,iBAAY,GAAG,GAAG,EAAE;YAC1B,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ;gBACrB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AAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;CACzC,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 LineWeight\r\n */\r\n\r\nimport \"./WeightPickerButton.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { ColorDef } from \"@itwin/core-common\";\r\nimport { RelativePosition, SpecialKey } from \"@itwin/appui-abstract\";\r\nimport { CommonProps, ElementResizeObserver, Popup } from \"@itwin/core-react\";\r\nimport { LineWeightSwatch } from \"./Swatch\";\r\n\r\n// cSpell:ignore weightpicker lineweight\r\n\r\n/** Properties for the [[WeightPickerButton]] React component\r\n * @public\r\n */\r\nexport interface WeightPickerProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, CommonProps {\r\n /** active weight */\r\n activeWeight: number;\r\n /** available weights */\r\n weights: number[];\r\n /** color specification */\r\n colorDef?: ColorDef;\r\n /** function to run when user selects weight swatch */\r\n onLineWeightPick?: ((weight: number) => void) | undefined;\r\n /** Disabled or not */\r\n disabled?: boolean;\r\n /** Readonly or not */\r\n readonly?: boolean;\r\n /** hide the weight label */\r\n hideLabel?: boolean;\r\n /** Title to show at top of DropDown */\r\n dropDownTitle?: string;\r\n}\r\n\r\n/** @internal */\r\ninterface WeightPickerState {\r\n showPopup: boolean;\r\n targetElement: HTMLDivElement | null;\r\n}\r\n\r\n/** WeightPickerButton component\r\n * @public\r\n */\r\nexport class WeightPickerButton extends React.PureComponent<WeightPickerProps, WeightPickerState> {\r\n private _target = React.createRef<HTMLDivElement>();\r\n private _weightsContainer: HTMLDivElement | null = null;\r\n private _focusTarget = React.createRef<HTMLButtonElement>(); // weight button that should receive focus after popup is open\r\n\r\n /** @internal */\r\n constructor(props: WeightPickerProps) {\r\n super(props);\r\n\r\n this.state = { showPopup: false, targetElement: null };\r\n }\r\n\r\n public setFocus(): void {\r\n // istanbul ignore next\r\n this._focusTarget.current && this._focusTarget.current.focus();\r\n }\r\n\r\n public static defaultProps = {\r\n weights: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],\r\n };\r\n\r\n private _togglePopup = () => {\r\n if (this.props.readonly)\r\n return;\r\n this.setState((prevState) => ({ showPopup: !prevState.showPopup }));\r\n };\r\n\r\n private _onPopupOpened = () => {\r\n };\r\n\r\n private _closePopup = () => {\r\n this.setState((_prevState) => ({ showPopup: false }));\r\n };\r\n\r\n private _handleWeightPicked = (weight: number) => {\r\n this._closePopup();\r\n this.props.onLineWeightPick && this.props.onLineWeightPick(weight);\r\n };\r\n\r\n public override componentDidMount() {\r\n // eslint-disable-next-line no-console\r\n // console.log(`WeightPickerButton.componentDidMount focusRef=${this._focusTarget && this._focusTarget.current ? \"set\" : \"unset\"}`);\r\n this.setState({ targetElement: this._target.current });\r\n }\r\n\r\n private buildIdForWeight(weight: number): string {\r\n return `ui-core-lineweight-${weight}`;\r\n }\r\n\r\n private moveFocusInPopup(moveUp: boolean, event: React.KeyboardEvent<any>) {\r\n const activeElement = document.activeElement;\r\n // istanbul ignore else\r\n if (this._weightsContainer && activeElement && activeElement.tagName === \"BUTTON\") {\r\n const values = activeElement.id.split(\"-\");\r\n // istanbul ignore else\r\n if (values.length === 4 && values[2] === \"lineweight\") {\r\n const weight = parseInt(values[3], 10);\r\n const foundIndex = this.props.weights.findIndex((val) => val === weight);\r\n // istanbul ignore next\r\n if (foundIndex < 0)\r\n return;\r\n\r\n const nextWeight = moveUp ? (foundIndex <= 0 ? this.props.weights[this.props.weights.length - 1] : this.props.weights[foundIndex - 1]) :\r\n (foundIndex < this.props.weights.length - 1 ? this.props.weights[foundIndex + 1] : this.props.weights[0]);\r\n\r\n const focusLocation = this._weightsContainer.querySelector(`#${this.buildIdForWeight(nextWeight)}`) as HTMLButtonElement;\r\n // istanbul ignore else\r\n if (focusLocation) {\r\n focusLocation.focus();\r\n event.preventDefault();\r\n event.stopPropagation();\r\n }\r\n }\r\n }\r\n }\r\n\r\n private _handleKeyDown = (event: React.KeyboardEvent<any>) => {\r\n if (event.key === SpecialKey.Enter) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n const weightButton = document.activeElement as HTMLElement;\r\n // istanbul ignore else\r\n if (weightButton.tagName === \"BUTTON\") {\r\n try {\r\n const values = weightButton.id.split(\"-\");\r\n // istanbul ignore else\r\n if (values.length) {\r\n const weight = parseInt(values[values.length - 1], 10);\r\n // istanbul ignore else\r\n if (!isNaN(weight)) {\r\n // istanbul ignore else\r\n if (this.props.onLineWeightPick)\r\n this.props.onLineWeightPick(weight);\r\n }\r\n }\r\n } catch { }\r\n }\r\n this._closePopup();\r\n } else {\r\n switch (event.key) {\r\n case SpecialKey.ArrowDown:\r\n this.moveFocusInPopup(false, event);\r\n break;\r\n case SpecialKey.ArrowUp:\r\n this.moveFocusInPopup(true, event);\r\n break;\r\n }\r\n }\r\n };\r\n\r\n private _setWeightContainer = (el: any) => {\r\n this._weightsContainer = el;\r\n };\r\n\r\n private renderPopup(title: string | undefined) {\r\n return (\r\n <div className=\"components-weightpicker-popup-container\">\r\n {title && <h4>{title}</h4>}\r\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */}\r\n <ul data-testid=\"components-weightpicker-popup-lines\" className=\"components-weightpicker-popup-lines\" onKeyDown={this._handleKeyDown} ref={this._setWeightContainer}>\r\n {this.props.weights.map((weight, index) => {\r\n const classNames = classnames(\r\n \"components-weightpicker-swatch\",\r\n weight === this.props.activeWeight && \"active\",\r\n );\r\n return (<LineWeightSwatch\r\n className={classNames}\r\n key={index}\r\n colorDef={this.props.colorDef}\r\n id={this.buildIdForWeight(weight)}\r\n hideLabel={this.props.hideLabel}\r\n onClick={this._handleWeightPicked.bind(this, weight)}\r\n weight={weight} />);\r\n })\r\n }\r\n </ul>\r\n </div>\r\n );\r\n }\r\n\r\n /** @internal */\r\n public override render() {\r\n const buttonClassNames = classnames(\r\n \"components-weightpicker-button\",\r\n this.props.className,\r\n );\r\n\r\n return (\r\n <>\r\n <div ref={this._target} style={this.props.style} >\r\n <LineWeightSwatch\r\n data-testid=\"components-weightpicker-button\"\r\n className={buttonClassNames}\r\n weight={this.props.activeWeight}\r\n colorDef={this.props.colorDef}\r\n readonly={this.props.readonly}\r\n disabled={this.props.disabled}\r\n hideLabel={this.props.hideLabel}\r\n aria-haspopup=\"listbox\"\r\n aria-expanded={this.state.showPopup}\r\n onClick={this._togglePopup} />\r\n </div>\r\n <ElementResizeObserver watchedElement={this.state.targetElement} render=\r\n {({ width }) => (\r\n <Popup\r\n className=\"components-weightpicker-popup\"\r\n style={{ width: `${width}px` }}\r\n isOpen={this.state.showPopup}\r\n position={RelativePosition.Bottom}\r\n offset={0}\r\n showShadow={false}\r\n onClose={this._closePopup}\r\n onOpen={this._onPopupOpened}\r\n focusTarget={`#${this.buildIdForWeight(this.props.activeWeight)}`}\r\n moveFocus={true}\r\n target={this.state.targetElement}\r\n closeOnNestedPopupOutsideClick\r\n >\r\n {this.renderPopup(this.props.dropDownTitle)}\r\n </Popup>\r\n )}\r\n />\r\n </>\r\n );\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"WeightPickerButton.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/lineweight/WeightPickerButton.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,qCAAmC;AACnC,4DAAoC;AACpC,6CAA+B;AAE/B,0DAAqE;AACrE,kDAA8E;AAC9E,qCAA4C;AAgC5C;;GAEG;AACH,MAAa,kBAAmB,SAAQ,KAAK,CAAC,aAAmD;IAK/F,gBAAgB;IAChB,YAAY,KAAwB;QAClC,KAAK,CAAC,KAAK,CAAC,CAAC;QANP,YAAO,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;QAC5C,sBAAiB,GAA0B,IAAI,CAAC;QAChD,iBAAY,GAAG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AyLC;AAxKe,+BAAY,GAAG;IAC3B,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;CACzC,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 LineWeight\n */\n\nimport \"./WeightPickerButton.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { ColorDef } from \"@itwin/core-common\";\nimport { RelativePosition, SpecialKey } from \"@itwin/appui-abstract\";\nimport { CommonProps, ElementResizeObserver, Popup } from \"@itwin/core-react\";\nimport { LineWeightSwatch } from \"./Swatch\";\n\n// cSpell:ignore weightpicker lineweight\n\n/** Properties for the [[WeightPickerButton]] React component\n * @public\n */\nexport interface WeightPickerProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, CommonProps {\n /** active weight */\n activeWeight: number;\n /** available weights */\n weights: number[];\n /** color specification */\n colorDef?: ColorDef;\n /** function to run when user selects weight swatch */\n onLineWeightPick?: ((weight: number) => void) | undefined;\n /** Disabled or not */\n disabled?: boolean;\n /** Readonly or not */\n readonly?: boolean;\n /** hide the weight label */\n hideLabel?: boolean;\n /** Title to show at top of DropDown */\n dropDownTitle?: string;\n}\n\n/** @internal */\ninterface WeightPickerState {\n showPopup: boolean;\n targetElement: HTMLDivElement | null;\n}\n\n/** WeightPickerButton component\n * @public\n */\nexport class WeightPickerButton extends React.PureComponent<WeightPickerProps, WeightPickerState> {\n private _target = React.createRef<HTMLDivElement>();\n private _weightsContainer: HTMLDivElement | null = null;\n private _focusTarget = React.createRef<HTMLButtonElement>(); // weight button that should receive focus after popup is open\n\n /** @internal */\n constructor(props: WeightPickerProps) {\n super(props);\n\n this.state = { showPopup: false, targetElement: null };\n }\n\n public setFocus(): void {\n // istanbul ignore next\n this._focusTarget.current && this._focusTarget.current.focus();\n }\n\n public static defaultProps = {\n weights: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],\n };\n\n private _togglePopup = () => {\n if (this.props.readonly)\n return;\n this.setState((prevState) => ({ showPopup: !prevState.showPopup }));\n };\n\n private _onPopupOpened = () => {\n };\n\n private _closePopup = () => {\n this.setState((_prevState) => ({ showPopup: false }));\n };\n\n private _handleWeightPicked = (weight: number) => {\n this._closePopup();\n this.props.onLineWeightPick && this.props.onLineWeightPick(weight);\n };\n\n public override componentDidMount() {\n // eslint-disable-next-line no-console\n // console.log(`WeightPickerButton.componentDidMount focusRef=${this._focusTarget && this._focusTarget.current ? \"set\" : \"unset\"}`);\n this.setState({ targetElement: this._target.current });\n }\n\n private buildIdForWeight(weight: number): string {\n return `ui-core-lineweight-${weight}`;\n }\n\n private moveFocusInPopup(moveUp: boolean, event: React.KeyboardEvent<any>) {\n const activeElement = document.activeElement;\n // istanbul ignore else\n if (this._weightsContainer && activeElement && activeElement.tagName === \"BUTTON\") {\n const values = activeElement.id.split(\"-\");\n // istanbul ignore else\n if (values.length === 4 && values[2] === \"lineweight\") {\n const weight = parseInt(values[3], 10);\n const foundIndex = this.props.weights.findIndex((val) => val === weight);\n // istanbul ignore next\n if (foundIndex < 0)\n return;\n\n const nextWeight = moveUp ? (foundIndex <= 0 ? this.props.weights[this.props.weights.length - 1] : this.props.weights[foundIndex - 1]) :\n (foundIndex < this.props.weights.length - 1 ? this.props.weights[foundIndex + 1] : this.props.weights[0]);\n\n const focusLocation = this._weightsContainer.querySelector(`#${this.buildIdForWeight(nextWeight)}`) as HTMLButtonElement;\n // istanbul ignore else\n if (focusLocation) {\n focusLocation.focus();\n event.preventDefault();\n event.stopPropagation();\n }\n }\n }\n }\n\n private _handleKeyDown = (event: React.KeyboardEvent<any>) => {\n if (event.key === SpecialKey.Enter) {\n event.preventDefault();\n event.stopPropagation();\n const weightButton = document.activeElement as HTMLElement;\n // istanbul ignore else\n if (weightButton.tagName === \"BUTTON\") {\n try {\n const values = weightButton.id.split(\"-\");\n // istanbul ignore else\n if (values.length) {\n const weight = parseInt(values[values.length - 1], 10);\n // istanbul ignore else\n if (!isNaN(weight)) {\n // istanbul ignore else\n if (this.props.onLineWeightPick)\n this.props.onLineWeightPick(weight);\n }\n }\n } catch { }\n }\n this._closePopup();\n } else {\n switch (event.key) {\n case SpecialKey.ArrowDown:\n this.moveFocusInPopup(false, event);\n break;\n case SpecialKey.ArrowUp:\n this.moveFocusInPopup(true, event);\n break;\n }\n }\n };\n\n private _setWeightContainer = (el: any) => {\n this._weightsContainer = el;\n };\n\n private renderPopup(title: string | undefined) {\n return (\n <div className=\"components-weightpicker-popup-container\">\n {title && <h4>{title}</h4>}\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */}\n <ul data-testid=\"components-weightpicker-popup-lines\" className=\"components-weightpicker-popup-lines\" onKeyDown={this._handleKeyDown} ref={this._setWeightContainer}>\n {this.props.weights.map((weight, index) => {\n const classNames = classnames(\n \"components-weightpicker-swatch\",\n weight === this.props.activeWeight && \"active\",\n );\n return (<LineWeightSwatch\n className={classNames}\n key={index}\n colorDef={this.props.colorDef}\n id={this.buildIdForWeight(weight)}\n hideLabel={this.props.hideLabel}\n onClick={this._handleWeightPicked.bind(this, weight)}\n weight={weight} />);\n })\n }\n </ul>\n </div>\n );\n }\n\n /** @internal */\n public override render() {\n const buttonClassNames = classnames(\n \"components-weightpicker-button\",\n this.props.className,\n );\n\n return (\n <>\n <div ref={this._target} style={this.props.style} >\n <LineWeightSwatch\n data-testid=\"components-weightpicker-button\"\n className={buttonClassNames}\n weight={this.props.activeWeight}\n colorDef={this.props.colorDef}\n readonly={this.props.readonly}\n disabled={this.props.disabled}\n hideLabel={this.props.hideLabel}\n aria-haspopup=\"listbox\"\n aria-expanded={this.state.showPopup}\n onClick={this._togglePopup} />\n </div>\n <ElementResizeObserver watchedElement={this.state.targetElement} render=\n {({ width }) => (\n <Popup\n className=\"components-weightpicker-popup\"\n style={{ width: `${width}px` }}\n isOpen={this.state.showPopup}\n position={RelativePosition.Bottom}\n offset={0}\n showShadow={false}\n onClose={this._closePopup}\n onOpen={this._onPopupOpened}\n focusTarget={`#${this.buildIdForWeight(this.props.activeWeight)}`}\n moveFocus={true}\n target={this.state.targetElement}\n closeOnNestedPopupOutsideClick\n >\n {this.renderPopup(this.props.dropDownTitle)}\n </Popup>\n )}\n />\n </>\n );\n }\n}\n"]}