@itwin/components-react 4.9.0 → 4.10.0

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 (296) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/lib/cjs/components-react/common/DelayedSpinner.d.ts +2 -1
  3. package/lib/cjs/components-react/common/DelayedSpinner.d.ts.map +1 -1
  4. package/lib/cjs/components-react/common/DelayedSpinner.js +2 -3
  5. package/lib/cjs/components-react/common/DelayedSpinner.js.map +1 -1
  6. package/lib/cjs/components-react/common/UseDebouncedAsyncValue.js +1 -2
  7. package/lib/cjs/components-react/common/UseDebouncedAsyncValue.js.map +1 -1
  8. package/lib/cjs/components-react/converters/DateTimeTypeConverter.js +1 -1
  9. package/lib/cjs/components-react/converters/DateTimeTypeConverter.js.map +1 -1
  10. package/lib/cjs/components-react/converters/NumericTypeConverter.js +2 -4
  11. package/lib/cjs/components-react/converters/NumericTypeConverter.js.map +1 -1
  12. package/lib/cjs/components-react/converters/PointTypeConverter.d.ts.map +1 -1
  13. package/lib/cjs/components-react/converters/PointTypeConverter.js +2 -0
  14. package/lib/cjs/components-react/converters/PointTypeConverter.js.map +1 -1
  15. package/lib/cjs/components-react/converters/TypeConverter.d.ts.map +1 -1
  16. package/lib/cjs/components-react/converters/TypeConverter.js +2 -2
  17. package/lib/cjs/components-react/converters/TypeConverter.js.map +1 -1
  18. package/lib/cjs/components-react/datepicker/DateField.scss +2 -5
  19. package/lib/cjs/components-react/datepicker/DatePicker.js +5 -5
  20. package/lib/cjs/components-react/datepicker/DatePicker.js.map +1 -1
  21. package/lib/cjs/components-react/datepicker/TimeField.d.ts.map +1 -1
  22. package/lib/cjs/components-react/datepicker/TimeField.js +29 -22
  23. package/lib/cjs/components-react/datepicker/TimeField.js.map +1 -1
  24. package/lib/cjs/components-react/datepicker/TimeField.scss +4 -7
  25. package/lib/cjs/components-react/editors/BooleanEditor.js +1 -1
  26. package/lib/cjs/components-react/editors/BooleanEditor.js.map +1 -1
  27. package/lib/cjs/components-react/editors/CustomNumberEditor.d.ts.map +1 -1
  28. package/lib/cjs/components-react/editors/CustomNumberEditor.js +13 -14
  29. package/lib/cjs/components-react/editors/CustomNumberEditor.js.map +1 -1
  30. package/lib/cjs/components-react/editors/CustomNumberEditor.scss +3 -5
  31. package/lib/cjs/components-react/editors/DateTimeEditor.js +2 -3
  32. package/lib/cjs/components-react/editors/DateTimeEditor.js.map +1 -1
  33. package/lib/cjs/components-react/editors/EditorContainer.js +3 -3
  34. package/lib/cjs/components-react/editors/EditorContainer.js.map +1 -1
  35. package/lib/cjs/components-react/editors/EnumButtonGroupEditor.js +1 -1
  36. package/lib/cjs/components-react/editors/EnumButtonGroupEditor.js.map +1 -1
  37. package/lib/cjs/components-react/editors/EnumEditor.d.ts.map +1 -1
  38. package/lib/cjs/components-react/editors/EnumEditor.js +8 -1
  39. package/lib/cjs/components-react/editors/EnumEditor.js.map +1 -1
  40. package/lib/cjs/components-react/editors/EnumEditor.scss +4 -6
  41. package/lib/cjs/components-react/editors/IconEditor.d.ts.map +1 -1
  42. package/lib/cjs/components-react/editors/IconEditor.js +1 -1
  43. package/lib/cjs/components-react/editors/IconEditor.js.map +1 -1
  44. package/lib/cjs/components-react/editors/ImageCheckBoxEditor.js +1 -1
  45. package/lib/cjs/components-react/editors/ImageCheckBoxEditor.js.map +1 -1
  46. package/lib/cjs/components-react/editors/NumericInputEditor.js +3 -3
  47. package/lib/cjs/components-react/editors/NumericInputEditor.js.map +1 -1
  48. package/lib/cjs/components-react/editors/NumericInputEditor.scss +3 -5
  49. package/lib/cjs/components-react/editors/PopupButton.js +5 -6
  50. package/lib/cjs/components-react/editors/PopupButton.js.map +1 -1
  51. package/lib/cjs/components-react/editors/SliderEditor.d.ts.map +1 -1
  52. package/lib/cjs/components-react/editors/SliderEditor.js +6 -3
  53. package/lib/cjs/components-react/editors/SliderEditor.js.map +1 -1
  54. package/lib/cjs/components-react/editors/TextEditor.d.ts.map +1 -1
  55. package/lib/cjs/components-react/editors/TextEditor.js +5 -7
  56. package/lib/cjs/components-react/editors/TextEditor.js.map +1 -1
  57. package/lib/cjs/components-react/editors/TextEditor.scss +3 -5
  58. package/lib/cjs/components-react/editors/TextareaEditor.d.ts +1 -0
  59. package/lib/cjs/components-react/editors/TextareaEditor.d.ts.map +1 -1
  60. package/lib/cjs/components-react/editors/TextareaEditor.js +6 -5
  61. package/lib/cjs/components-react/editors/TextareaEditor.js.map +1 -1
  62. package/lib/cjs/components-react/editors/ToggleEditor.js +1 -1
  63. package/lib/cjs/components-react/editors/ToggleEditor.js.map +1 -1
  64. package/lib/cjs/components-react/editors/ToggleEditor.scss +2 -8
  65. package/lib/cjs/components-react/favorite/FavoritePropertyList.js +3 -3
  66. package/lib/cjs/components-react/favorite/FavoritePropertyList.js.map +1 -1
  67. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js +1 -2
  68. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
  69. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.d.ts.map +1 -1
  70. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js +3 -3
  71. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -1
  72. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js +1 -1
  73. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
  74. package/lib/cjs/components-react/filter-builder/FilterBuilderState.js +3 -3
  75. package/lib/cjs/components-react/filter-builder/FilterBuilderState.js.map +1 -1
  76. package/lib/cjs/components-react/filter-builder/Operators.js +13 -13
  77. package/lib/cjs/components-react/filter-builder/Operators.js.map +1 -1
  78. package/lib/cjs/components-react/filtering/FilteringInput.js +1 -1
  79. package/lib/cjs/components-react/filtering/FilteringInput.js.map +1 -1
  80. package/lib/cjs/components-react/filtering/ResultSelector.js +1 -1
  81. package/lib/cjs/components-react/filtering/ResultSelector.js.map +1 -1
  82. package/lib/cjs/components-react/filtering/ResultSelector.scss +1 -1
  83. package/lib/cjs/components-react/inputs/ParsedInput.js +2 -2
  84. package/lib/cjs/components-react/inputs/ParsedInput.js.map +1 -1
  85. package/lib/cjs/components-react/inputs/ParsedInput.scss +1 -4
  86. package/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer.js +3 -4
  87. package/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer.js.map +1 -1
  88. package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.js +1 -1
  89. package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.js.map +1 -1
  90. package/lib/cjs/components-react/properties/renderers/PrimitivePropertyRenderer.js +2 -3
  91. package/lib/cjs/components-react/properties/renderers/PrimitivePropertyRenderer.js.map +1 -1
  92. package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.js +4 -4
  93. package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.js.map +1 -1
  94. package/lib/cjs/components-react/properties/renderers/value/Common.js +1 -2
  95. package/lib/cjs/components-react/properties/renderers/value/Common.js.map +1 -1
  96. package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.js +1 -1
  97. package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.js.map +1 -1
  98. package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js +3 -6
  99. package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js.map +1 -1
  100. package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js +1 -1
  101. package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js.map +1 -1
  102. package/lib/cjs/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js +3 -6
  103. package/lib/cjs/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js.map +1 -1
  104. package/lib/cjs/components-react/propertygrid/PropertyCategoryRendererManager.js +1 -2
  105. package/lib/cjs/components-react/propertygrid/PropertyCategoryRendererManager.js.map +1 -1
  106. package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js +1 -2
  107. package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map +1 -1
  108. package/lib/cjs/components-react/propertygrid/component/PropertyCategoryBlock.d.ts.map +1 -1
  109. package/lib/cjs/components-react/propertygrid/component/PropertyCategoryBlock.js +5 -4
  110. package/lib/cjs/components-react/propertygrid/component/PropertyCategoryBlock.js.map +1 -1
  111. package/lib/cjs/components-react/propertygrid/component/PropertyGrid.scss +0 -17
  112. package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js +2 -2
  113. package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
  114. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js +49 -54
  115. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
  116. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.scss +2 -3
  117. package/lib/cjs/components-react/propertygrid/dataproviders/FilteringDataProvider.js +11 -13
  118. package/lib/cjs/components-react/propertygrid/dataproviders/FilteringDataProvider.js.map +1 -1
  119. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js +2 -2
  120. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js.map +1 -1
  121. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js +1 -2
  122. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js.map +1 -1
  123. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js +1 -2
  124. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js.map +1 -1
  125. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js +2 -2
  126. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
  127. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridCategory.js +2 -3
  128. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridCategory.js.map +1 -1
  129. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js +1 -1
  130. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js.map +1 -1
  131. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js +1 -1
  132. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js.map +1 -1
  133. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js +5 -7
  134. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
  135. package/lib/cjs/components-react/selectable-content/SelectableContent.js +2 -3
  136. package/lib/cjs/components-react/selectable-content/SelectableContent.js.map +1 -1
  137. package/lib/cjs/components-react/toolbar/InternalToolbarComponent.js +4 -6
  138. package/lib/cjs/components-react/toolbar/InternalToolbarComponent.js.map +1 -1
  139. package/lib/cjs/components-react/toolbar/useConditionalSynchedItems.js +5 -6
  140. package/lib/cjs/components-react/toolbar/useConditionalSynchedItems.js.map +1 -1
  141. package/lib/cjs/components-react/tree/controlled/TreeModel.js +7 -8
  142. package/lib/cjs/components-react/tree/controlled/TreeModel.js.map +1 -1
  143. package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js +6 -8
  144. package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
  145. package/lib/cjs/components-react/tree/controlled/internal/SparseTree.js +1 -2
  146. package/lib/cjs/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
  147. package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.js +3 -5
  148. package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
  149. package/lib/esm/components-react/common/DelayedSpinner.d.ts +2 -1
  150. package/lib/esm/components-react/common/DelayedSpinner.d.ts.map +1 -1
  151. package/lib/esm/components-react/common/DelayedSpinner.js +2 -3
  152. package/lib/esm/components-react/common/DelayedSpinner.js.map +1 -1
  153. package/lib/esm/components-react/common/UseDebouncedAsyncValue.js +1 -2
  154. package/lib/esm/components-react/common/UseDebouncedAsyncValue.js.map +1 -1
  155. package/lib/esm/components-react/converters/DateTimeTypeConverter.js +1 -1
  156. package/lib/esm/components-react/converters/DateTimeTypeConverter.js.map +1 -1
  157. package/lib/esm/components-react/converters/NumericTypeConverter.js +2 -4
  158. package/lib/esm/components-react/converters/NumericTypeConverter.js.map +1 -1
  159. package/lib/esm/components-react/converters/PointTypeConverter.d.ts.map +1 -1
  160. package/lib/esm/components-react/converters/PointTypeConverter.js +2 -0
  161. package/lib/esm/components-react/converters/PointTypeConverter.js.map +1 -1
  162. package/lib/esm/components-react/converters/TypeConverter.d.ts.map +1 -1
  163. package/lib/esm/components-react/converters/TypeConverter.js +2 -2
  164. package/lib/esm/components-react/converters/TypeConverter.js.map +1 -1
  165. package/lib/esm/components-react/datepicker/DateField.scss +2 -5
  166. package/lib/esm/components-react/datepicker/DatePicker.js +5 -5
  167. package/lib/esm/components-react/datepicker/DatePicker.js.map +1 -1
  168. package/lib/esm/components-react/datepicker/TimeField.d.ts.map +1 -1
  169. package/lib/esm/components-react/datepicker/TimeField.js +26 -22
  170. package/lib/esm/components-react/datepicker/TimeField.js.map +1 -1
  171. package/lib/esm/components-react/datepicker/TimeField.scss +4 -7
  172. package/lib/esm/components-react/editors/BooleanEditor.js +1 -1
  173. package/lib/esm/components-react/editors/BooleanEditor.js.map +1 -1
  174. package/lib/esm/components-react/editors/CustomNumberEditor.d.ts.map +1 -1
  175. package/lib/esm/components-react/editors/CustomNumberEditor.js +13 -14
  176. package/lib/esm/components-react/editors/CustomNumberEditor.js.map +1 -1
  177. package/lib/esm/components-react/editors/CustomNumberEditor.scss +3 -5
  178. package/lib/esm/components-react/editors/DateTimeEditor.js +2 -3
  179. package/lib/esm/components-react/editors/DateTimeEditor.js.map +1 -1
  180. package/lib/esm/components-react/editors/EditorContainer.js +3 -3
  181. package/lib/esm/components-react/editors/EditorContainer.js.map +1 -1
  182. package/lib/esm/components-react/editors/EnumButtonGroupEditor.js +1 -1
  183. package/lib/esm/components-react/editors/EnumButtonGroupEditor.js.map +1 -1
  184. package/lib/esm/components-react/editors/EnumEditor.d.ts.map +1 -1
  185. package/lib/esm/components-react/editors/EnumEditor.js +8 -1
  186. package/lib/esm/components-react/editors/EnumEditor.js.map +1 -1
  187. package/lib/esm/components-react/editors/EnumEditor.scss +4 -6
  188. package/lib/esm/components-react/editors/IconEditor.d.ts.map +1 -1
  189. package/lib/esm/components-react/editors/IconEditor.js +1 -1
  190. package/lib/esm/components-react/editors/IconEditor.js.map +1 -1
  191. package/lib/esm/components-react/editors/ImageCheckBoxEditor.js +1 -1
  192. package/lib/esm/components-react/editors/ImageCheckBoxEditor.js.map +1 -1
  193. package/lib/esm/components-react/editors/NumericInputEditor.js +3 -3
  194. package/lib/esm/components-react/editors/NumericInputEditor.js.map +1 -1
  195. package/lib/esm/components-react/editors/NumericInputEditor.scss +3 -5
  196. package/lib/esm/components-react/editors/PopupButton.js +5 -6
  197. package/lib/esm/components-react/editors/PopupButton.js.map +1 -1
  198. package/lib/esm/components-react/editors/SliderEditor.d.ts.map +1 -1
  199. package/lib/esm/components-react/editors/SliderEditor.js +6 -3
  200. package/lib/esm/components-react/editors/SliderEditor.js.map +1 -1
  201. package/lib/esm/components-react/editors/TextEditor.d.ts.map +1 -1
  202. package/lib/esm/components-react/editors/TextEditor.js +5 -7
  203. package/lib/esm/components-react/editors/TextEditor.js.map +1 -1
  204. package/lib/esm/components-react/editors/TextEditor.scss +3 -5
  205. package/lib/esm/components-react/editors/TextareaEditor.d.ts +1 -0
  206. package/lib/esm/components-react/editors/TextareaEditor.d.ts.map +1 -1
  207. package/lib/esm/components-react/editors/TextareaEditor.js +6 -5
  208. package/lib/esm/components-react/editors/TextareaEditor.js.map +1 -1
  209. package/lib/esm/components-react/editors/ToggleEditor.js +1 -1
  210. package/lib/esm/components-react/editors/ToggleEditor.js.map +1 -1
  211. package/lib/esm/components-react/editors/ToggleEditor.scss +2 -8
  212. package/lib/esm/components-react/favorite/FavoritePropertyList.js +3 -3
  213. package/lib/esm/components-react/favorite/FavoritePropertyList.js.map +1 -1
  214. package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js +1 -2
  215. package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
  216. package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.d.ts.map +1 -1
  217. package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js +3 -3
  218. package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -1
  219. package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js +1 -1
  220. package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
  221. package/lib/esm/components-react/filter-builder/FilterBuilderState.js +3 -3
  222. package/lib/esm/components-react/filter-builder/FilterBuilderState.js.map +1 -1
  223. package/lib/esm/components-react/filter-builder/Operators.js +13 -13
  224. package/lib/esm/components-react/filter-builder/Operators.js.map +1 -1
  225. package/lib/esm/components-react/filtering/FilteringInput.js +1 -1
  226. package/lib/esm/components-react/filtering/FilteringInput.js.map +1 -1
  227. package/lib/esm/components-react/filtering/ResultSelector.js +1 -1
  228. package/lib/esm/components-react/filtering/ResultSelector.js.map +1 -1
  229. package/lib/esm/components-react/filtering/ResultSelector.scss +1 -1
  230. package/lib/esm/components-react/inputs/ParsedInput.js +2 -2
  231. package/lib/esm/components-react/inputs/ParsedInput.js.map +1 -1
  232. package/lib/esm/components-react/inputs/ParsedInput.scss +1 -4
  233. package/lib/esm/components-react/properties/renderers/CommonPropertyRenderer.js +3 -4
  234. package/lib/esm/components-react/properties/renderers/CommonPropertyRenderer.js.map +1 -1
  235. package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.js +1 -1
  236. package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.js.map +1 -1
  237. package/lib/esm/components-react/properties/renderers/PrimitivePropertyRenderer.js +2 -3
  238. package/lib/esm/components-react/properties/renderers/PrimitivePropertyRenderer.js.map +1 -1
  239. package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.js +4 -4
  240. package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.js.map +1 -1
  241. package/lib/esm/components-react/properties/renderers/value/Common.js +1 -2
  242. package/lib/esm/components-react/properties/renderers/value/Common.js.map +1 -1
  243. package/lib/esm/components-react/properties/renderers/value/DoublePropertyValueRenderer.js +1 -1
  244. package/lib/esm/components-react/properties/renderers/value/DoublePropertyValueRenderer.js.map +1 -1
  245. package/lib/esm/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js +3 -6
  246. package/lib/esm/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js.map +1 -1
  247. package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js +1 -1
  248. package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js.map +1 -1
  249. package/lib/esm/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js +3 -6
  250. package/lib/esm/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js.map +1 -1
  251. package/lib/esm/components-react/propertygrid/PropertyCategoryRendererManager.js +1 -2
  252. package/lib/esm/components-react/propertygrid/PropertyCategoryRendererManager.js.map +1 -1
  253. package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js +1 -2
  254. package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map +1 -1
  255. package/lib/esm/components-react/propertygrid/component/PropertyCategoryBlock.d.ts.map +1 -1
  256. package/lib/esm/components-react/propertygrid/component/PropertyCategoryBlock.js +5 -4
  257. package/lib/esm/components-react/propertygrid/component/PropertyCategoryBlock.js.map +1 -1
  258. package/lib/esm/components-react/propertygrid/component/PropertyGrid.scss +0 -17
  259. package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js +2 -2
  260. package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
  261. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js +49 -54
  262. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
  263. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.scss +2 -3
  264. package/lib/esm/components-react/propertygrid/dataproviders/FilteringDataProvider.js +11 -13
  265. package/lib/esm/components-react/propertygrid/dataproviders/FilteringDataProvider.js.map +1 -1
  266. package/lib/esm/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js +2 -2
  267. package/lib/esm/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js.map +1 -1
  268. package/lib/esm/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js +1 -2
  269. package/lib/esm/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js.map +1 -1
  270. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js +1 -2
  271. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js.map +1 -1
  272. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js +2 -2
  273. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
  274. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.js +2 -3
  275. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.js.map +1 -1
  276. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js +1 -1
  277. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js.map +1 -1
  278. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js +1 -1
  279. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js.map +1 -1
  280. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js +5 -7
  281. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
  282. package/lib/esm/components-react/selectable-content/SelectableContent.js +2 -3
  283. package/lib/esm/components-react/selectable-content/SelectableContent.js.map +1 -1
  284. package/lib/esm/components-react/toolbar/InternalToolbarComponent.js +4 -6
  285. package/lib/esm/components-react/toolbar/InternalToolbarComponent.js.map +1 -1
  286. package/lib/esm/components-react/toolbar/useConditionalSynchedItems.js +5 -6
  287. package/lib/esm/components-react/toolbar/useConditionalSynchedItems.js.map +1 -1
  288. package/lib/esm/components-react/tree/controlled/TreeModel.js +7 -8
  289. package/lib/esm/components-react/tree/controlled/TreeModel.js.map +1 -1
  290. package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js +6 -8
  291. package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
  292. package/lib/esm/components-react/tree/controlled/internal/SparseTree.js +1 -2
  293. package/lib/esm/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
  294. package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.js +3 -5
  295. package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
  296. package/package.json +13 -13
@@ -1 +1 @@
1
- {"version":3,"file":"NumericInputEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/NumericInputEditor.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,qCAAmC;AACnC,4DAAoC;AACpC,6CAA+B;AAO/B,0DAK+B;AAC/B,kDAAgD;AAEhD,mEAGiC;AAgBjC;;GAEG;AACH,MAAa,kBACX,SAAQ,KAAK,CAAC,aAA2D;IAD3E;;QAIU,eAAU,GAAG,KAAK,CAAC;QACnB,kBAAa,GAAsC,KAAK,CAAC,SAAS,EAAE,CAAC;QACtE,aAAQ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C,qCAAqC;QACrC,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AATD,gEASC;AAED,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,MAAM,EACxB,0BAA0B,EAC1B,oCAAmB,CAAC,YAAY,CACjC,CAAC;AACF,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,GAAG,EACrB,0BAA0B,EAC1B,oCAAmB,CAAC,YAAY,CACjC,CAAC;AACF,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,KAAK,EACvB,0BAA0B,EAC1B,oCAAmB,CAAC,YAAY,CACjC,CAAC;AACF,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,MAAM,EACxB,0BAA0B,EAC1B,oCAAmB,CAAC,YAAY,CACjC,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 PropertyEditors\n */\n\nimport \"./NumericInputEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n InputEditorSizeParams,\n PropertyEditorParams,\n PropertyValue,\n RangeEditorParams,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyEditorParamTypes,\n PropertyValueFormat,\n StandardEditorNames,\n StandardTypeNames,\n} from \"@itwin/appui-abstract\";\nimport { NumberInput } from \"@itwin/core-react\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport {\n PropertyEditorBase,\n PropertyEditorManager,\n} from \"./PropertyEditorManager\";\n\n/** @internal */\ninterface NumericInputEditorState {\n value: number;\n readonly: boolean;\n isDisabled?: boolean;\n size?: number;\n maxLength?: number;\n\n min?: number;\n max?: number;\n step?: number;\n precision?: number;\n}\n\n/** NumericInputEditor React component that is a property editor with numeric input & up/down buttons\n * @public\n */\nexport class NumericInputEditor\n extends React.PureComponent<PropertyEditorProps, NumericInputEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _inputElement: React.RefObject<HTMLInputElement> = React.createRef();\n public hasFocus = false; // hot used since containerHandlesEnter is false\n\n /** @internal */\n public override readonly state: Readonly<NumericInputEditorState> = {\n value: 0,\n readonly: false,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.value,\n displayValue: \"\",\n };\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._inputElement.current;\n }\n\n private _handleCommit = async (): Promise<void> => {\n // istanbul ignore else\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (propertyValue !== undefined) {\n this.props.onCommit({\n propertyRecord: this.props.propertyRecord,\n newValue: propertyValue,\n });\n }\n }\n };\n\n private _updateValue = (\n value: number | undefined,\n _stringValue: string\n ): void => {\n const newValue = value !== undefined ? value : /* istanbul ignore next */ 0;\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState(\n {\n value: newValue,\n },\n async () => {\n await this._handleCommit();\n }\n );\n };\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n void this.setStateFromProps();\n }\n\n /** @internal */\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n void this.setStateFromProps();\n }\n }\n\n private async setStateFromProps() {\n const record = this.props.propertyRecord;\n let initialValue = 0;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n initialValue = record.value.value as number;\n }\n\n const readonly =\n record && undefined !== record.isReadonly ? record.isReadonly : false;\n let size: number | undefined;\n let maxLength: number | undefined;\n let min: number | undefined;\n let max: number | undefined;\n let step: number | undefined;\n let precision: number | undefined;\n\n const isDisabled = record ? record.isDisabled : undefined;\n\n if (\n record &&\n record.property &&\n record.property.editor &&\n record.property.editor.params\n ) {\n const editorSizeParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.InputEditorSize\n ) as InputEditorSizeParams;\n if (editorSizeParams) {\n // istanbul ignore else\n if (editorSizeParams.size) size = editorSizeParams.size;\n // istanbul ignore else\n if (editorSizeParams.maxLength) maxLength = editorSizeParams.maxLength;\n }\n\n const rangeParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.Range\n ) as RangeEditorParams;\n if (rangeParams) {\n min = rangeParams.minimum;\n max = rangeParams.maximum;\n step = rangeParams.step;\n precision = rangeParams.precision;\n }\n }\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({\n value: initialValue,\n readonly,\n size,\n maxLength,\n isDisabled,\n min,\n max,\n step,\n precision,\n });\n }\n\n /** @internal */\n public override render(): React.ReactNode {\n const className = classnames(\n \"components-cell-editor\",\n \"components-numeric-input-editor\",\n this.props.className\n );\n const minSize = this.state.size ? this.state.size : 8;\n const style: React.CSSProperties = {\n ...this.props.style,\n minWidth: `${minSize * 0.75}em`,\n };\n\n return (\n <NumberInput\n ref={this._inputElement}\n className={className}\n style={style}\n value={this.state.value}\n min={this.state.min}\n max={this.state.max}\n step={this.state.step}\n precision={this.state.precision}\n readOnly={this.state.readonly}\n maxLength={this.state.maxLength}\n onBlur={this.props.onBlur}\n onChange={this._updateValue}\n setFocus={this.props.setFocus && !this.state.isDisabled}\n isControlled={this.props.shouldCommitOnChange}\n />\n );\n }\n}\n\n/** Numeric Input Property Editor registered for the \"number\" type name and \"numeric-input\" editor name.\n * It uses the [[NumericInputEditor]] React component.\n * @public\n */\nexport class NumericInputPropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <NumericInputEditor />;\n }\n // istanbul ignore next\n public override get containerHandlesEnter(): boolean {\n // let input editor process enter key\n return false;\n }\n}\n\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Number,\n NumericInputPropertyEditor,\n StandardEditorNames.NumericInput\n);\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Int,\n NumericInputPropertyEditor,\n StandardEditorNames.NumericInput\n);\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Float,\n NumericInputPropertyEditor,\n StandardEditorNames.NumericInput\n);\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Double,\n NumericInputPropertyEditor,\n StandardEditorNames.NumericInput\n);\n"]}
1
+ {"version":3,"file":"NumericInputEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/NumericInputEditor.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,qCAAmC;AACnC,4DAAoC;AACpC,6CAA+B;AAO/B,0DAK+B;AAC/B,kDAAgD;AAEhD,mEAGiC;AAgBjC;;GAEG;AACH,MAAa,kBACX,SAAQ,KAAK,CAAC,aAA2D;IAD3E;;QAIU,eAAU,GAAG,KAAK,CAAC;QACnB,kBAAa,GAAsC,KAAK,CAAC,SAAS,EAAE,CAAC;QACtE,aAAQ,GAAG,KAAK,CAAC,CAAC,gDAAgD;QAEzE,gBAAgB;QACS,UAAK,GAAsC;YAClE,KAAK,EAAE,CAAC;YACR,QAAQ,EAAE,KAAK;SAChB,CAAC;QAsBM,kBAAa,GAAG,KAAK,IAAmB,EAAE;YAChD,uBAAuB;YACvB,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;gBACpD,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;gBACpD,uBAAuB;gBACvB,IAAI,aAAa,KAAK,SAAS,EAAE;oBAC/B,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;wBAClB,cAAc,EAAE,IAAI,CAAC,KAAK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EACxB,0BAA0B,EAC1B,oCAAmB,CAAC,YAAY,CACjC,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 PropertyEditors\n */\n\nimport \"./NumericInputEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n InputEditorSizeParams,\n PropertyEditorParams,\n PropertyValue,\n RangeEditorParams,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyEditorParamTypes,\n PropertyValueFormat,\n StandardEditorNames,\n StandardTypeNames,\n} from \"@itwin/appui-abstract\";\nimport { NumberInput } from \"@itwin/core-react\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport {\n PropertyEditorBase,\n PropertyEditorManager,\n} from \"./PropertyEditorManager\";\n\n/** @internal */\ninterface NumericInputEditorState {\n value: number;\n readonly: boolean;\n isDisabled?: boolean;\n size?: number;\n maxLength?: number;\n\n min?: number;\n max?: number;\n step?: number;\n precision?: number;\n}\n\n/** NumericInputEditor React component that is a property editor with numeric input & up/down buttons\n * @public\n */\nexport class NumericInputEditor\n extends React.PureComponent<PropertyEditorProps, NumericInputEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _inputElement: React.RefObject<HTMLInputElement> = React.createRef();\n public hasFocus = false; // hot used since containerHandlesEnter is false\n\n /** @internal */\n public override readonly state: Readonly<NumericInputEditorState> = {\n value: 0,\n readonly: false,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.value,\n displayValue: \"\",\n };\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._inputElement.current;\n }\n\n private _handleCommit = async (): Promise<void> => {\n // istanbul ignore else\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (propertyValue !== undefined) {\n this.props.onCommit({\n propertyRecord: this.props.propertyRecord,\n newValue: propertyValue,\n });\n }\n }\n };\n\n private _updateValue = (\n value: number | undefined,\n _stringValue: string\n ): void => {\n const newValue = value !== undefined ? value : /* istanbul ignore next */ 0;\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState(\n {\n value: newValue,\n },\n async () => {\n await this._handleCommit();\n }\n );\n };\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n void this.setStateFromProps();\n }\n\n /** @internal */\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n void this.setStateFromProps();\n }\n }\n\n private async setStateFromProps() {\n const record = this.props.propertyRecord;\n let initialValue = 0;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n initialValue = record.value.value as number;\n }\n\n const readonly =\n record && undefined !== record.isReadonly ? record.isReadonly : false;\n let size: number | undefined;\n let maxLength: number | undefined;\n let min: number | undefined;\n let max: number | undefined;\n let step: number | undefined;\n let precision: number | undefined;\n\n const isDisabled = record ? record.isDisabled : undefined;\n\n if (\n record &&\n record.property &&\n record.property.editor &&\n record.property.editor.params\n ) {\n const editorSizeParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.InputEditorSize.valueOf()\n ) as InputEditorSizeParams;\n if (editorSizeParams) {\n // istanbul ignore else\n if (editorSizeParams.size) size = editorSizeParams.size;\n // istanbul ignore else\n if (editorSizeParams.maxLength) maxLength = editorSizeParams.maxLength;\n }\n\n const rangeParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.Range.valueOf()\n ) as RangeEditorParams;\n if (rangeParams) {\n min = rangeParams.minimum;\n max = rangeParams.maximum;\n step = rangeParams.step;\n precision = rangeParams.precision;\n }\n }\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({\n value: initialValue,\n readonly,\n size,\n maxLength,\n isDisabled,\n min,\n max,\n step,\n precision,\n });\n }\n\n /** @internal */\n public override render(): React.ReactNode {\n const className = classnames(\n \"components-cell-editor\",\n \"components-numeric-input-editor\",\n this.props.className\n );\n const minSize = this.state.size ? this.state.size : 8;\n const style: React.CSSProperties = {\n ...this.props.style,\n minWidth: `${minSize * 0.75}em`,\n };\n\n return (\n <NumberInput\n ref={this._inputElement}\n className={className}\n style={style}\n value={this.state.value}\n min={this.state.min}\n max={this.state.max}\n step={this.state.step}\n precision={this.state.precision}\n readOnly={this.state.readonly}\n maxLength={this.state.maxLength}\n onBlur={this.props.onBlur}\n onChange={this._updateValue}\n autoFocus={this.props.setFocus && !this.state.isDisabled} // eslint-disable-line jsx-a11y/no-autofocus\n isControlled={this.props.shouldCommitOnChange}\n />\n );\n }\n}\n\n/** Numeric Input Property Editor registered for the \"number\" type name and \"numeric-input\" editor name.\n * It uses the [[NumericInputEditor]] React component.\n * @public\n */\nexport class NumericInputPropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <NumericInputEditor />;\n }\n // istanbul ignore next\n public override get containerHandlesEnter(): boolean {\n // let input editor process enter key\n return false;\n }\n}\n\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Number,\n NumericInputPropertyEditor,\n StandardEditorNames.NumericInput\n);\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Int,\n NumericInputPropertyEditor,\n StandardEditorNames.NumericInput\n);\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Float,\n NumericInputPropertyEditor,\n StandardEditorNames.NumericInput\n);\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Double,\n NumericInputPropertyEditor,\n StandardEditorNames.NumericInput\n);\n"]}
@@ -6,10 +6,8 @@
6
6
 
7
7
  .components-smallEditor-host {
8
8
  .components-numeric-input-editor {
9
- &.iui-input {
10
- min-height: $editor-component-height-small !important;
11
- padding-top: 0px !important;
12
- padding-bottom: 0px !important;
13
- }
9
+ min-height: $editor-component-height-small !important;
10
+ padding-top: 0px !important;
11
+ padding-bottom: 0px !important;
14
12
  }
15
13
  }
@@ -66,9 +66,9 @@ class PopupButton extends React.PureComponent {
66
66
  };
67
67
  this._handleKeyDown = (event) => {
68
68
  // istanbul ignore else
69
- if ((event.key === ts_key_enum_1.Key.ArrowDown ||
69
+ if ((event.key === ts_key_enum_1.Key.ArrowDown.valueOf() ||
70
70
  event.key === " " ||
71
- event.key === ts_key_enum_1.Key.Enter) &&
71
+ event.key === ts_key_enum_1.Key.Enter.valueOf()) &&
72
72
  !this.state.showPopup) {
73
73
  event.preventDefault();
74
74
  event.stopPropagation();
@@ -86,10 +86,9 @@ class PopupButton extends React.PureComponent {
86
86
  }
87
87
  /** @internal */
88
88
  render() {
89
- var _a, _b, _c;
90
- const showArrow = (_a = this.props.showArrow) !== null && _a !== void 0 ? _a : false;
91
- const showShadow = (_b = this.props.showShadow) !== null && _b !== void 0 ? _b : false;
92
- const moveFocus = (_c = this.props.moveFocus) !== null && _c !== void 0 ? _c : true;
89
+ const showArrow = this.props.showArrow ?? false;
90
+ const showShadow = this.props.showShadow ?? false;
91
+ const moveFocus = this.props.moveFocus ?? true;
93
92
  const showPlaceholder = this.props.label === undefined && this.props.placeholder !== undefined;
94
93
  const classNames = (0, classnames_1.default)("components-popup-button", this.state.showPopup && "components-popup-expanded");
95
94
  const valueClassNames = (0, classnames_1.default)("components-popup-button-value", showPlaceholder && "components-popup-button-placeholder");
@@ -1 +1 @@
1
- {"version":3,"file":"PopupButton.js","sourceRoot":"","sources":["../../../../src/components-react/editors/PopupButton.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,8BAA4B;AAC5B,4DAAoC;AACpC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BACW,4BAA4B,EACxC,SAAS,EAAC,KAAK,EACf,KAAK,EAAE,mBAAM,CAAC,SAAS,CAAC,WAAW,CAAC,EACpC,OAAO,EAAE,KAAK,CAAC,IAAI;YAEnB,oBAAC,iBAAI,IAAC,QAAQ,EAAE,oBAAC,kCAAY,OAAG,GAAI,CAC7B;QACT,oBAAC,sBAAM,IACL,SAAS,EAAE,IAAA,oBAAU,EACnB,+BAA+B,EAC/B,gCAAgC,CACjC,iBACW,gCAAgC,EAC5C,KAAK,EAAE,mBAAM,CAAC,SAAS,CAAC,eAAe,CAAC,EACxC,OAAO,EAAE,KAAK,CAAC,QAAQ;YAEvB,oBAAC,iBAAI,IAAC,QAAQ,EAAE,oBAAC,+BAAS,OAAG,GAAI,CAC1B,CACL,CACP,CAAC;AACJ,CAAC;AA5BD,oDA4BC","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 PropertyEditors\n */\n\nimport \"./PopupButton.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport { RelativePosition } from \"@itwin/appui-abstract\";\nimport type { CommonDivProps, CommonProps } from \"@itwin/core-react\";\nimport { Div, Icon, Popup, UiCore } from \"@itwin/core-react\";\nimport { Button } from \"@itwin/itwinui-react\";\nimport {\n SvgCheckmark,\n SvgChevronDown,\n SvgRemove,\n} from \"@itwin/itwinui-icons-react\";\n\n/** Properties for [[PopupButton]] component\n * @alpha\n */\nexport interface PopupButtonProps extends CommonProps {\n /** Label to display in click area. */\n label?: string | React.ReactNode;\n /* Placeholder text used when there is no label yet */\n placeholder?: string;\n /** Contents of the popup */\n children: React.ReactNode;\n /** Title to display as tooltip. */\n title?: string;\n\n /** Set focus to popup - default is to set focus */\n moveFocus?: boolean;\n /** Element to receive focus, specified by React.RefObject or CSS selector string. If undefined and moveFocus is true then focus is moved to first focusable element. */\n focusTarget?: React.RefObject<HTMLElement> | string;\n\n /** Show or hide the box shadow (defaults to false) */\n showShadow?: boolean;\n /** Show or hide the arrow (defaults to false) */\n showArrow?: boolean;\n /** Indicates whether to set focus to the input element */\n setFocus?: boolean;\n /** Indicates whether to close the popup when Enter is pressed (defaults to true) */\n closeOnEnter?: boolean;\n\n /** Listens for click events on button area */\n onClick?: (event: React.MouseEvent) => void;\n /** Listens for popup close events */\n onClose?: () => void;\n /** Listens for Enter key in popup */\n onEnter?: () => void;\n}\n\n/** @internal */\ninterface PopupButtonState {\n showPopup: boolean;\n}\n\n/** PopupButton React component that is a button and property editor popup host\n * @alpha\n */\nexport class PopupButton extends React.PureComponent<\n PopupButtonProps,\n PopupButtonState\n> {\n private _buttonRef = React.createRef<HTMLDivElement>();\n\n /** @internal */\n public override readonly state: Readonly<PopupButtonState> = {\n showPopup: false,\n };\n\n /** @internal */\n public override componentDidMount() {\n if (this.props.setFocus && this._buttonRef.current)\n this._buttonRef.current.focus();\n }\n\n private _togglePopup = (event: React.MouseEvent) => {\n this.setState(\n (prevState) => ({ showPopup: !prevState.showPopup }),\n () => this.props.onClick && this.props.onClick(event)\n );\n };\n\n public closePopup() {\n this._closePopup();\n }\n\n private _closePopup = () => {\n this.setState({ showPopup: false }, () => {\n this.props.onClose && this.props.onClose();\n\n // istanbul ignore else\n if (this._buttonRef.current) this._buttonRef.current.focus();\n });\n };\n\n private _handleKeyDown = (event: React.KeyboardEvent) => {\n // istanbul ignore else\n if (\n (event.key === Key.ArrowDown ||\n event.key === \" \" ||\n event.key === Key.Enter) &&\n !this.state.showPopup\n ) {\n event.preventDefault();\n event.stopPropagation();\n this.setState({ showPopup: true });\n }\n };\n\n /** @internal */\n public override render(): React.ReactNode {\n const showArrow = this.props.showArrow ?? false;\n const showShadow = this.props.showShadow ?? false;\n const moveFocus = this.props.moveFocus ?? true;\n const showPlaceholder =\n this.props.label === undefined && this.props.placeholder !== undefined;\n\n const classNames = classnames(\n \"components-popup-button\",\n this.state.showPopup && \"components-popup-expanded\"\n );\n\n const valueClassNames = classnames(\n \"components-popup-button-value\",\n showPlaceholder && \"components-popup-button-placeholder\"\n );\n\n return (\n <div className={this.props.className}>\n <div\n className={classNames}\n onClick={this._togglePopup}\n onKeyDown={this._handleKeyDown}\n data-testid=\"components-popup-button\"\n tabIndex={0}\n ref={this._buttonRef}\n title={this.props.title}\n role=\"button\"\n >\n <div className={valueClassNames}>\n {this.props.label || this.props.placeholder}\n </div>\n <div className={\"components-popup-button-arrow\"}>\n <div\n className={classnames(\n \"components-popup-button-arrow-icon\",\n \"icon\"\n )}\n >\n <Icon iconSpec={<SvgChevronDown />} />\n </div>\n </div>\n </div>\n <Popup\n className=\"components-popup-button-popup\"\n isOpen={this.state.showPopup}\n position={RelativePosition.Bottom}\n onClose={this._closePopup}\n onEnter={this.props.onEnter}\n closeOnEnter={this.props.closeOnEnter}\n target={this._buttonRef.current}\n showArrow={showArrow}\n showShadow={showShadow}\n moveFocus={moveFocus}\n focusTarget={this.props.focusTarget}\n >\n {this.props.children}\n </Popup>\n </div>\n );\n }\n}\n\n/** Popup content with padding\n * @alpha\n */\nexport function PopupContent(props: CommonDivProps) {\n return <Div {...props} mainClassName=\"components-editor-popup-content\" />;\n}\n\n/** Properties for [[PopupOkCancelButtons]] component\n * @alpha\n */\nexport interface OkCancelProps {\n onOk: (event: React.MouseEvent) => void;\n onCancel: (event: React.MouseEvent) => void;\n}\n\n/** OK/Cancel Buttons\n * @alpha\n */\nexport function PopupOkCancelButtons(props: OkCancelProps) {\n return (\n <div className=\"components-popup-bottom-buttons\">\n <Button\n className={classnames(\n \"components-popup-large-button\",\n \"components-popup-ok-button\"\n )}\n data-testid=\"components-popup-ok-button\"\n styleType=\"cta\"\n title={UiCore.translate(\"dialog.ok\")}\n onClick={props.onOk}\n >\n <Icon iconSpec={<SvgCheckmark />} />\n </Button>\n <Button\n className={classnames(\n \"components-popup-large-button\",\n \"components-popup-cancel-button\"\n )}\n data-testid=\"components-popup-cancel-button\"\n title={UiCore.translate(\"dialog.cancel\")}\n onClick={props.onCancel}\n >\n <Icon iconSpec={<SvgRemove />} />\n </Button>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"PopupButton.js","sourceRoot":"","sources":["../../../../src/components-react/editors/PopupButton.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,8BAA4B;AAC5B,4DAAoC;AACpC,6CAA+B;AAC/B,6CAAkC;AAClC,0DAAyD;AAEzD,kDAA6D;AAC7D,wDAA8C;AAC9C,oEAIoC;AA0CpC;;GAEG;AACH,MAAa,WAAY,SAAQ,KAAK,CAAC,aAGtC;IAHD;;QAIU,eAAU,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;QAEvD,gBAAgB;QACS,UAAK,GAA+B;YAC3D,SAAS,EAAE,KAAK;SACjB,CAAC;QAQM,iBAAY,GAAG,CAAC,KAAuB,EAAE,EAAE;YACjD,IAAI,CAAC,QAAQ,CACX,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC,EACpD,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CACtD,CAAC;QACJ,CAAC,CAAC;QAMM,gBAAW,GAAG,GAAG,EAAE;YACzB,IAAI,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE;gBACvC,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;gBAE3C,uBAAuB;gBACvB,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO;oBAAE,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YAC/D,CAAC,CA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iHC;AAED;;GAEG;AACH,SAAgB,YAAY,CAAC,KAAqB;IAChD,OAAO,oBAAC,gBAAG,OAAK,KAAK,EAAE,aAAa,EAAC,iCAAiC,GAAG,CAAC;AAC5E,CAAC;AAFD,oCAEC;AAUD;;GAEG;AACH,SAAgB,oBAAoB,CAAC,KAAoB;IACvD,OAAO,CACL,6BAAK,SAAS,EAAC,iCAAiC;QAC9C,oBAAC,sBAAM,IACL,SAAS,EAAE,IAAA,oBAAU,EACnB,+BAA+B,EAC/B,4BAA4B,CAC7B,iBACW,4BAA4B,EACxC,SAAS,EAAC,KAAK,EACf,KAAK,EAAE,mBAAM,CAAC,SAAS,CAAC,WAAW,CAAC,EACpC,OAAO,EAAE,KAAK,CAAC,IAAI;YAEnB,oBAAC,iBAAI,IAAC,QAAQ,EAAE,oBAAC,kCAAY,OAAG,GAAI,CAC7B;QACT,oBAAC,sBAAM,IACL,SAAS,EAAE,IAAA,oBAAU,EACnB,+BAA+B,EAC/B,gCAAgC,CACjC,iBACW,gCAAgC,EAC5C,KAAK,EAAE,mBAAM,CAAC,SAAS,CAAC,eAAe,CAAC,EACxC,OAAO,EAAE,KAAK,CAAC,QAAQ;YAEvB,oBAAC,iBAAI,IAAC,QAAQ,EAAE,oBAAC,+BAAS,OAAG,GAAI,CAC1B,CACL,CACP,CAAC;AACJ,CAAC;AA5BD,oDA4BC","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 PropertyEditors\n */\n\nimport \"./PopupButton.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport { RelativePosition } from \"@itwin/appui-abstract\";\nimport type { CommonDivProps, CommonProps } from \"@itwin/core-react\";\nimport { Div, Icon, Popup, UiCore } from \"@itwin/core-react\";\nimport { Button } from \"@itwin/itwinui-react\";\nimport {\n SvgCheckmark,\n SvgChevronDown,\n SvgRemove,\n} from \"@itwin/itwinui-icons-react\";\n\n/** Properties for [[PopupButton]] component\n * @alpha\n */\nexport interface PopupButtonProps extends CommonProps {\n /** Label to display in click area. */\n label?: string | React.ReactNode;\n /* Placeholder text used when there is no label yet */\n placeholder?: string;\n /** Contents of the popup */\n children: React.ReactNode;\n /** Title to display as tooltip. */\n title?: string;\n\n /** Set focus to popup - default is to set focus */\n moveFocus?: boolean;\n /** Element to receive focus, specified by React.RefObject or CSS selector string. If undefined and moveFocus is true then focus is moved to first focusable element. */\n focusTarget?: React.RefObject<HTMLElement> | string;\n\n /** Show or hide the box shadow (defaults to false) */\n showShadow?: boolean;\n /** Show or hide the arrow (defaults to false) */\n showArrow?: boolean;\n /** Indicates whether to set focus to the input element */\n setFocus?: boolean;\n /** Indicates whether to close the popup when Enter is pressed (defaults to true) */\n closeOnEnter?: boolean;\n\n /** Listens for click events on button area */\n onClick?: (event: React.MouseEvent) => void;\n /** Listens for popup close events */\n onClose?: () => void;\n /** Listens for Enter key in popup */\n onEnter?: () => void;\n}\n\n/** @internal */\ninterface PopupButtonState {\n showPopup: boolean;\n}\n\n/** PopupButton React component that is a button and property editor popup host\n * @alpha\n */\nexport class PopupButton extends React.PureComponent<\n PopupButtonProps,\n PopupButtonState\n> {\n private _buttonRef = React.createRef<HTMLDivElement>();\n\n /** @internal */\n public override readonly state: Readonly<PopupButtonState> = {\n showPopup: false,\n };\n\n /** @internal */\n public override componentDidMount() {\n if (this.props.setFocus && this._buttonRef.current)\n this._buttonRef.current.focus();\n }\n\n private _togglePopup = (event: React.MouseEvent) => {\n this.setState(\n (prevState) => ({ showPopup: !prevState.showPopup }),\n () => this.props.onClick && this.props.onClick(event)\n );\n };\n\n public closePopup() {\n this._closePopup();\n }\n\n private _closePopup = () => {\n this.setState({ showPopup: false }, () => {\n this.props.onClose && this.props.onClose();\n\n // istanbul ignore else\n if (this._buttonRef.current) this._buttonRef.current.focus();\n });\n };\n\n private _handleKeyDown = (event: React.KeyboardEvent) => {\n // istanbul ignore else\n if (\n (event.key === Key.ArrowDown.valueOf() ||\n event.key === \" \" ||\n event.key === Key.Enter.valueOf()) &&\n !this.state.showPopup\n ) {\n event.preventDefault();\n event.stopPropagation();\n this.setState({ showPopup: true });\n }\n };\n\n /** @internal */\n public override render(): React.ReactNode {\n const showArrow = this.props.showArrow ?? false;\n const showShadow = this.props.showShadow ?? false;\n const moveFocus = this.props.moveFocus ?? true;\n const showPlaceholder =\n this.props.label === undefined && this.props.placeholder !== undefined;\n\n const classNames = classnames(\n \"components-popup-button\",\n this.state.showPopup && \"components-popup-expanded\"\n );\n\n const valueClassNames = classnames(\n \"components-popup-button-value\",\n showPlaceholder && \"components-popup-button-placeholder\"\n );\n\n return (\n <div className={this.props.className}>\n <div\n className={classNames}\n onClick={this._togglePopup}\n onKeyDown={this._handleKeyDown}\n data-testid=\"components-popup-button\"\n tabIndex={0}\n ref={this._buttonRef}\n title={this.props.title}\n role=\"button\"\n >\n <div className={valueClassNames}>\n {this.props.label || this.props.placeholder}\n </div>\n <div className={\"components-popup-button-arrow\"}>\n <div\n className={classnames(\n \"components-popup-button-arrow-icon\",\n \"icon\"\n )}\n >\n <Icon iconSpec={<SvgChevronDown />} />\n </div>\n </div>\n </div>\n <Popup\n className=\"components-popup-button-popup\"\n isOpen={this.state.showPopup}\n position={RelativePosition.Bottom}\n onClose={this._closePopup}\n onEnter={this.props.onEnter}\n closeOnEnter={this.props.closeOnEnter}\n target={this._buttonRef.current}\n showArrow={showArrow}\n showShadow={showShadow}\n moveFocus={moveFocus}\n focusTarget={this.props.focusTarget}\n >\n {this.props.children}\n </Popup>\n </div>\n );\n }\n}\n\n/** Popup content with padding\n * @alpha\n */\nexport function PopupContent(props: CommonDivProps) {\n return <Div {...props} mainClassName=\"components-editor-popup-content\" />;\n}\n\n/** Properties for [[PopupOkCancelButtons]] component\n * @alpha\n */\nexport interface OkCancelProps {\n onOk: (event: React.MouseEvent) => void;\n onCancel: (event: React.MouseEvent) => void;\n}\n\n/** OK/Cancel Buttons\n * @alpha\n */\nexport function PopupOkCancelButtons(props: OkCancelProps) {\n return (\n <div className=\"components-popup-bottom-buttons\">\n <Button\n className={classnames(\n \"components-popup-large-button\",\n \"components-popup-ok-button\"\n )}\n data-testid=\"components-popup-ok-button\"\n styleType=\"cta\"\n title={UiCore.translate(\"dialog.ok\")}\n onClick={props.onOk}\n >\n <Icon iconSpec={<SvgCheckmark />} />\n </Button>\n <Button\n className={classnames(\n \"components-popup-large-button\",\n \"components-popup-cancel-button\"\n )}\n data-testid=\"components-popup-cancel-button\"\n title={UiCore.translate(\"dialog.cancel\")}\n onClick={props.onCancel}\n >\n <Icon iconSpec={<SvgRemove />} />\n </Button>\n </div>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SliderEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/editors/SliderEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,qBAAqB,CAAC;AAE7B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAEV,aAAa,EAEd,MAAM,uBAAuB,CAAC;AAU/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EACL,kBAAkB,EAEnB,MAAM,yBAAyB,CAAC;AAGjC,gBAAgB;AAChB,UAAU,iBAAiB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC1C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SAAyB,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAIzD;IAEW,gBAAgB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IAgBnE,IAAW,WAAW,IAAI,WAAW,GAAG,IAAI,CAE3C;IAED,IAAW,QAAQ,IAAI,OAAO,CAM7B;IAED,OAAO,CAAC,aAAa,CAQnB;IAEF,gBAAgB;IACA,iBAAiB;IAKjC,gBAAgB;IACA,oBAAoB;IAIpC,gBAAgB;IACA,kBAAkB,CAAC,SAAS,EAAE,mBAAmB;IAMjE,OAAO,CAAC,qBAAqB,CAO3B;YAEY,iBAAiB;IAkH/B,OAAO,CAAC,YAAY,CAGlB;IAEF,OAAO,CAAC,YAAY,CAOlB;IAEF,OAAO,CAAC,SAAS,CAEf;IAEF,OAAO,CAAC,aAAa,CAKnB;IAEF,OAAO,CAAC,aAAa,CAYnB;IAEF,OAAO,CAAC,YAAY,CASlB;IAEF,gBAAgB;IACA,MAAM,IAAI,KAAK,CAAC,SAAS;CAsD1C;AAED;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,kBAAkB;IAC1D,IAAW,SAAS,IAAI,KAAK,CAAC,SAAS,CAEtC;CACF"}
@@ -182,7 +182,7 @@ class SliderEditor extends React.PureComponent {
182
182
  record.property &&
183
183
  record.property.editor &&
184
184
  record.property.editor.params) {
185
- const sliderParams = record.property.editor.params.find((param) => param.type === appui_abstract_1.PropertyEditorParamTypes.Slider);
185
+ const sliderParams = record.property.editor.params.find((param) => param.type === appui_abstract_1.PropertyEditorParamTypes.Slider.valueOf());
186
186
  // istanbul ignore else
187
187
  if (sliderParams) {
188
188
  min = sliderParams.minimum;
@@ -254,9 +254,12 @@ class SliderEditor extends React.PureComponent {
254
254
  ...this.props.style,
255
255
  minWidth: `${minSize}px`,
256
256
  };
257
- const popupContent = (React.createElement(itwinui_react_1.Slider, { className: "components-slider-editor-slider", style: style, values: [this.state.value], min: this.state.min, max: this.state.max, step: this.state.step, thumbMode: this.state.thumbMode, trackDisplayMode: this.state.trackDisplayMode, disabled: this.state.isDisabled, minLabel: this.state.minLabel, maxLabel: this.state.maxLabel, tooltipProps: this.tooltipProps, tickLabels: this.state.tickLabels, onChange: this._handleChange }));
257
+ const tickProps = {
258
+ "data-testid": "components-tick",
259
+ };
260
+ const popupContent = (React.createElement(itwinui_react_1.Slider, { className: "components-slider-editor-slider", style: style, values: [this.state.value], min: this.state.min, max: this.state.max, step: this.state.step, thumbMode: this.state.thumbMode, trackDisplayMode: this.state.trackDisplayMode, disabled: this.state.isDisabled, minLabel: this.state.minLabel, maxLabel: this.state.maxLabel, tooltipProps: this.tooltipProps, tickLabels: this.state.tickLabels, tickProps: tickProps, onChange: this._handleChange }));
258
261
  return (React.createElement("div", { className: className, ref: this._divElement },
259
- React.createElement(PopupButton_1.PopupButton, { label: this.state.value, onClose: this._handleClose, onEnter: this._handleEnter, setFocus: this.props.setFocus, focusTarget: ".core-slider-handle" },
262
+ React.createElement(PopupButton_1.PopupButton, { label: this.state.value, onClose: this._handleClose, onEnter: this._handleEnter, setFocus: this.props.setFocus },
260
263
  React.createElement(PopupButton_1.PopupContent, null,
261
264
  popupContent,
262
265
  React.createElement(PopupButton_1.PopupOkCancelButtons, { onOk: this._handleOk, onCancel: this._handleCancel })))));
@@ -1 +1 @@
1
- {"version":3,"file":"SliderEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/SliderEditor.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,+BAA6B;AAC7B,4DAAoC;AACpC,6CAA+B;AAM/B,0DAK+B;AAC/B,kDAAyC;AAEzC,wDAA8C;AAE9C,mEAGiC;AACjC,+CAAgF;AAoBhF;;GAEG;AACH,MAAa,YACX,SAAQ,KAAK,CAAC,aAAqD;IADrE;;QAIU,eAAU,GAAG,KAAK,CAAC;QACnB,cAAS,GAAG,KAAK,CAAC;QAClB,gBAAW,GAAG,KAAK,CAAC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AC1D,IAAW,SAAS;QAClB,OAAO,oBAAC,YAAY,OAAG,CAAC;IAC1B,CAAC;CACF;AAJD,oDAIC;AAED,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,MAAM,EACxB,oBAAoB,EACpB,oCAAmB,CAAC,MAAM,CAC3B,CAAC;AACF,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,GAAG,EACrB,oBAAoB,EACpB,oCAAmB,CAAC,MAAM,CAC3B,CAAC;AACF,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,KAAK,EACvB,oBAAoB,EACpB,oCAAmB,CAAC,MAAM,CAC3B,CAAC;AACF,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,MAAM,EACxB,oBAAoB,EACpB,oCAAmB,CAAC,MAAM,CAC3B,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 PropertyEditors\n */\n\nimport \"./SliderEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n PropertyEditorParams,\n PropertyValue,\n SliderEditorParams,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyEditorParamTypes,\n PropertyValueFormat,\n StandardEditorNames,\n StandardTypeNames,\n} from \"@itwin/appui-abstract\";\nimport { Icon } from \"@itwin/core-react\";\nimport type { TooltipProps } from \"@itwin/itwinui-react\";\nimport { Slider } from \"@itwin/itwinui-react\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport {\n PropertyEditorBase,\n PropertyEditorManager,\n} from \"./PropertyEditorManager\";\nimport { PopupButton, PopupContent, PopupOkCancelButtons } from \"./PopupButton\";\n\n/** @internal */\ninterface SliderEditorState {\n value: number;\n isDisabled?: boolean;\n min: number;\n max: number;\n size?: number;\n step?: number;\n showTooltip?: boolean;\n tooltipBelow?: boolean;\n formatTooltip?: (value: number) => string;\n thumbMode?: \"allow-crossing\" | \"inhibit-crossing\";\n trackDisplayMode?: \"auto\" | \"none\" | \"odd-segments\" | \"even-segments\";\n minLabel?: React.ReactNode;\n maxLabel?: React.ReactNode;\n tickLabels?: React.ReactNode;\n}\n\n/** SliderEditor React component that is a property editor with numeric input & up/down buttons\n * @public\n */\nexport class SliderEditor\n extends React.PureComponent<PropertyEditorProps, SliderEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _enterKey = false;\n private _divElement = React.createRef<HTMLDivElement>();\n\n /** @internal */\n public override readonly state: Readonly<SliderEditorState> = {\n value: 0,\n min: 0,\n max: 100,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.value,\n displayValue: \"\",\n };\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._divElement.current;\n }\n\n public get hasFocus(): boolean {\n let containsFocus = false;\n // istanbul ignore else\n if (this.htmlElement)\n containsFocus = this.htmlElement.contains(document.activeElement);\n return containsFocus;\n }\n\n private _handleChange = (values: readonly number[]): void => {\n const newValue = values[0];\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({\n value: newValue,\n });\n };\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n void this.setStateFromProps();\n }\n\n /** @internal */\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n void this.setStateFromProps();\n }\n }\n\n private internalFormatTooltip = (value: number, step = 1) => {\n if (Number.isInteger(step)) return value.toFixed(0);\n\n const stepString = step.toString();\n const decimalIndex = stepString.indexOf(\".\");\n const numDecimals = step.toString().length - (decimalIndex + 1);\n return value.toFixed(numDecimals);\n };\n\n private async setStateFromProps() {\n const record = this.props.propertyRecord;\n let initialValue = 0;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n initialValue = record.value.value as number;\n }\n\n let size: number | undefined;\n let min = 0;\n let max = 100;\n let step: number | undefined;\n let showTooltip: boolean | undefined;\n let tooltipBelow: boolean | undefined;\n let formatTooltip: ((value: number) => string) | undefined;\n let tickLabels: string[] | undefined;\n let minLabel: React.ReactNode | undefined;\n let maxLabel: React.ReactNode | undefined;\n let trackDisplayMode:\n | \"auto\"\n | \"none\"\n | \"odd-segments\"\n | \"even-segments\"\n | undefined;\n let thumbMode: \"allow-crossing\" | \"inhibit-crossing\" | undefined;\n\n const isDisabled = record ? record.isDisabled : undefined;\n\n if (\n record &&\n record.property &&\n record.property.editor &&\n record.property.editor.params\n ) {\n const sliderParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.Slider\n ) as SliderEditorParams;\n // istanbul ignore else\n if (sliderParams) {\n min = sliderParams.minimum;\n max = sliderParams.maximum;\n size = sliderParams.size;\n step = sliderParams.step;\n thumbMode =\n 1 === sliderParams.mode ? \"allow-crossing\" : \"inhibit-crossing\";\n trackDisplayMode = !sliderParams.reversed ? \"auto\" : \"odd-segments\";\n showTooltip = sliderParams.showTooltip;\n tooltipBelow = sliderParams.tooltipBelow;\n formatTooltip = sliderParams.formatTooltip;\n\n minLabel = !sliderParams.showMinMax ? (\n \"\"\n ) : sliderParams.minIconSpec ? (\n <Icon iconSpec={sliderParams.minIconSpec} />\n ) : undefined;\n maxLabel = !sliderParams.showMinMax ? (\n \"\"\n ) : sliderParams.maxIconSpec ? (\n <Icon iconSpec={sliderParams.maxIconSpec} />\n ) : undefined;\n\n if (sliderParams.showTicks) {\n const count = sliderParams.getTickCount\n ? sliderParams.getTickCount()\n : 0;\n if (count) {\n tickLabels = [];\n const increment = (max - min) / count;\n for (let i = 0; i <= count; i++) {\n const value = i * increment + min;\n if (sliderParams.showTickLabels) {\n const label = sliderParams.formatTick\n ? sliderParams.formatTick(value)\n : this.internalFormatTooltip(value, step);\n tickLabels.push(label);\n } else {\n tickLabels.push(\"\");\n }\n }\n } else if (sliderParams.getTickValues) {\n tickLabels = sliderParams\n .getTickValues()\n .map((val: number) =>\n sliderParams.formatTick\n ? sliderParams.formatTick(val)\n : this.internalFormatTooltip(val, step)\n );\n }\n }\n }\n }\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({\n value: initialValue,\n isDisabled,\n size,\n min,\n max,\n step,\n trackDisplayMode,\n showTooltip,\n tooltipBelow,\n formatTooltip,\n minLabel,\n maxLabel,\n tickLabels,\n thumbMode,\n });\n }\n\n private _handleEnter = async (): Promise<void> => {\n this._enterKey = true;\n await this._handleCommit();\n };\n\n private _handleClose = async (): Promise<void> => {\n if (this._enterKey) {\n this._enterKey = false;\n } else {\n // istanbul ignore else\n if (this.props.onCancel) this.props.onCancel();\n }\n };\n\n private _handleOk = async (_event: React.MouseEvent): Promise<void> => {\n await this._handleCommit();\n };\n\n private _handleCancel = (_event: React.MouseEvent): void => {\n // istanbul ignore else\n if (this.props.onCancel) {\n this.props.onCancel();\n }\n };\n\n private _handleCommit = async (): Promise<void> => {\n // istanbul ignore else\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (propertyValue !== undefined) {\n this.props.onCommit({\n propertyRecord: this.props.propertyRecord,\n newValue: propertyValue,\n });\n }\n }\n };\n\n private tooltipProps = (_index: number, val: number) => {\n const content = this.state.formatTooltip\n ? this.state.formatTooltip(val)\n : this.internalFormatTooltip(val, this.state.step);\n return {\n placement: this.state.tooltipBelow ? \"bottom\" : \"top\",\n content,\n visible: this.state.showTooltip,\n } as Partial<Omit<TooltipProps, \"children\">>;\n };\n\n /** @internal */\n public override render(): React.ReactNode {\n const className = classnames(\n \"components-cell-editor\",\n \"components-slider-editor\",\n this.props.className\n );\n const minSize = this.state.size ? this.state.size : 100;\n const style: React.CSSProperties = {\n ...this.props.style,\n minWidth: `${minSize}px`,\n };\n\n const popupContent = (\n <Slider\n className=\"components-slider-editor-slider\"\n style={style}\n values={[this.state.value]}\n min={this.state.min}\n max={this.state.max}\n step={this.state.step}\n thumbMode={this.state.thumbMode}\n trackDisplayMode={this.state.trackDisplayMode}\n disabled={this.state.isDisabled}\n minLabel={this.state.minLabel}\n maxLabel={this.state.maxLabel}\n tooltipProps={this.tooltipProps}\n tickLabels={this.state.tickLabels}\n onChange={this._handleChange}\n />\n );\n\n return (\n <div className={className} ref={this._divElement}>\n <PopupButton\n label={this.state.value}\n onClose={this._handleClose}\n onEnter={this._handleEnter}\n setFocus={this.props.setFocus}\n focusTarget=\".core-slider-handle\"\n >\n <PopupContent>\n {popupContent}\n <PopupOkCancelButtons\n onOk={this._handleOk}\n onCancel={this._handleCancel}\n />\n </PopupContent>\n </PopupButton>\n </div>\n );\n }\n}\n\n/** Slider Property Editor registered for the \"number\" type name and \"slider\" editor name.\n * It uses the [[SliderEditor]] React component.\n * @public\n */\nexport class SliderPropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <SliderEditor />;\n }\n}\n\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Number,\n SliderPropertyEditor,\n StandardEditorNames.Slider\n);\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Int,\n SliderPropertyEditor,\n StandardEditorNames.Slider\n);\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Float,\n SliderPropertyEditor,\n StandardEditorNames.Slider\n);\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Double,\n SliderPropertyEditor,\n StandardEditorNames.Slider\n);\n"]}
1
+ {"version":3,"file":"SliderEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/SliderEditor.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,+BAA6B;AAC7B,4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B,OAAO,EAAE,IAAI,CAAC,YAAY,EAC1B,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ;gBAE7B,oBAAC,0BAAY;oBACV,YAAY;oBACb,oBAAC,kCAAoB,IACnB,IAAI,EAAE,IAAI,CAAC,SAAS,EACpB,QAAQ,EAAE,IAAI,CAAC,aAAa,GAC5B,CACW,CACH,CACV,CACP,CAAC;IACJ,CAAC;CACF;AA3SD,oCA2SC;AAED;;;GAGG;AACH,MAAa,oBAAqB,SAAQ,0CAAkB;IAC1D,IAAW,SAAS;QAClB,OAAO,oBAAC,YAAY,OAAG,CAAC;IAC1B,CAAC;CACF;AAJD,oDAIC;AAED,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,MAAM,EACxB,oBAAoB,EACpB,oCAAmB,CAAC,MAAM,CAC3B,CAAC;AACF,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,GAAG,EACrB,oBAAoB,EACpB,oCAAmB,CAAC,MAAM,CAC3B,CAAC;AACF,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,KAAK,EACvB,oBAAoB,EACpB,oCAAmB,CAAC,MAAM,CAC3B,CAAC;AACF,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,MAAM,EACxB,oBAAoB,EACpB,oCAAmB,CAAC,MAAM,CAC3B,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 PropertyEditors\n */\n\nimport \"./SliderEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n PropertyEditorParams,\n PropertyValue,\n SliderEditorParams,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyEditorParamTypes,\n PropertyValueFormat,\n StandardEditorNames,\n StandardTypeNames,\n} from \"@itwin/appui-abstract\";\nimport { Icon } from \"@itwin/core-react\";\nimport type { Tooltip } from \"@itwin/itwinui-react\";\nimport { Slider } from \"@itwin/itwinui-react\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport {\n PropertyEditorBase,\n PropertyEditorManager,\n} from \"./PropertyEditorManager\";\nimport { PopupButton, PopupContent, PopupOkCancelButtons } from \"./PopupButton\";\n\ntype TooltipProps = React.ComponentPropsWithoutRef<typeof Tooltip>;\n\n/** @internal */\ninterface SliderEditorState {\n value: number;\n isDisabled?: boolean;\n min: number;\n max: number;\n size?: number;\n step?: number;\n showTooltip?: boolean;\n tooltipBelow?: boolean;\n formatTooltip?: (value: number) => string;\n thumbMode?: \"allow-crossing\" | \"inhibit-crossing\";\n trackDisplayMode?: \"auto\" | \"none\" | \"odd-segments\" | \"even-segments\";\n minLabel?: React.ReactNode;\n maxLabel?: React.ReactNode;\n tickLabels?: React.ReactNode;\n}\n\n/** SliderEditor React component that is a property editor with numeric input & up/down buttons\n * @public\n */\nexport class SliderEditor\n extends React.PureComponent<PropertyEditorProps, SliderEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _enterKey = false;\n private _divElement = React.createRef<HTMLDivElement>();\n\n /** @internal */\n public override readonly state: Readonly<SliderEditorState> = {\n value: 0,\n min: 0,\n max: 100,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.value,\n displayValue: \"\",\n };\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._divElement.current;\n }\n\n public get hasFocus(): boolean {\n let containsFocus = false;\n // istanbul ignore else\n if (this.htmlElement)\n containsFocus = this.htmlElement.contains(document.activeElement);\n return containsFocus;\n }\n\n private _handleChange = (values: readonly number[]): void => {\n const newValue = values[0];\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({\n value: newValue,\n });\n };\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n void this.setStateFromProps();\n }\n\n /** @internal */\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n void this.setStateFromProps();\n }\n }\n\n private internalFormatTooltip = (value: number, step = 1) => {\n if (Number.isInteger(step)) return value.toFixed(0);\n\n const stepString = step.toString();\n const decimalIndex = stepString.indexOf(\".\");\n const numDecimals = step.toString().length - (decimalIndex + 1);\n return value.toFixed(numDecimals);\n };\n\n private async setStateFromProps() {\n const record = this.props.propertyRecord;\n let initialValue = 0;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n initialValue = record.value.value as number;\n }\n\n let size: number | undefined;\n let min = 0;\n let max = 100;\n let step: number | undefined;\n let showTooltip: boolean | undefined;\n let tooltipBelow: boolean | undefined;\n let formatTooltip: ((value: number) => string) | undefined;\n let tickLabels: string[] | undefined;\n let minLabel: React.ReactNode | undefined;\n let maxLabel: React.ReactNode | undefined;\n let trackDisplayMode:\n | \"auto\"\n | \"none\"\n | \"odd-segments\"\n | \"even-segments\"\n | undefined;\n let thumbMode: \"allow-crossing\" | \"inhibit-crossing\" | undefined;\n\n const isDisabled = record ? record.isDisabled : undefined;\n\n if (\n record &&\n record.property &&\n record.property.editor &&\n record.property.editor.params\n ) {\n const sliderParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.Slider.valueOf()\n ) as SliderEditorParams;\n // istanbul ignore else\n if (sliderParams) {\n min = sliderParams.minimum;\n max = sliderParams.maximum;\n size = sliderParams.size;\n step = sliderParams.step;\n thumbMode =\n 1 === sliderParams.mode ? \"allow-crossing\" : \"inhibit-crossing\";\n trackDisplayMode = !sliderParams.reversed ? \"auto\" : \"odd-segments\";\n showTooltip = sliderParams.showTooltip;\n tooltipBelow = sliderParams.tooltipBelow;\n formatTooltip = sliderParams.formatTooltip;\n\n minLabel = !sliderParams.showMinMax ? (\n \"\"\n ) : sliderParams.minIconSpec ? (\n <Icon iconSpec={sliderParams.minIconSpec} />\n ) : undefined;\n maxLabel = !sliderParams.showMinMax ? (\n \"\"\n ) : sliderParams.maxIconSpec ? (\n <Icon iconSpec={sliderParams.maxIconSpec} />\n ) : undefined;\n\n if (sliderParams.showTicks) {\n const count = sliderParams.getTickCount\n ? sliderParams.getTickCount()\n : 0;\n if (count) {\n tickLabels = [];\n const increment = (max - min) / count;\n for (let i = 0; i <= count; i++) {\n const value = i * increment + min;\n if (sliderParams.showTickLabels) {\n const label = sliderParams.formatTick\n ? sliderParams.formatTick(value)\n : this.internalFormatTooltip(value, step);\n tickLabels.push(label);\n } else {\n tickLabels.push(\"\");\n }\n }\n } else if (sliderParams.getTickValues) {\n tickLabels = sliderParams\n .getTickValues()\n .map((val: number) =>\n sliderParams.formatTick\n ? sliderParams.formatTick(val)\n : this.internalFormatTooltip(val, step)\n );\n }\n }\n }\n }\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({\n value: initialValue,\n isDisabled,\n size,\n min,\n max,\n step,\n trackDisplayMode,\n showTooltip,\n tooltipBelow,\n formatTooltip,\n minLabel,\n maxLabel,\n tickLabels,\n thumbMode,\n });\n }\n\n private _handleEnter = async (): Promise<void> => {\n this._enterKey = true;\n await this._handleCommit();\n };\n\n private _handleClose = async (): Promise<void> => {\n if (this._enterKey) {\n this._enterKey = false;\n } else {\n // istanbul ignore else\n if (this.props.onCancel) this.props.onCancel();\n }\n };\n\n private _handleOk = async (_event: React.MouseEvent): Promise<void> => {\n await this._handleCommit();\n };\n\n private _handleCancel = (_event: React.MouseEvent): void => {\n // istanbul ignore else\n if (this.props.onCancel) {\n this.props.onCancel();\n }\n };\n\n private _handleCommit = async (): Promise<void> => {\n // istanbul ignore else\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (propertyValue !== undefined) {\n this.props.onCommit({\n propertyRecord: this.props.propertyRecord,\n newValue: propertyValue,\n });\n }\n }\n };\n\n private tooltipProps = (_index: number, val: number) => {\n const content = this.state.formatTooltip\n ? this.state.formatTooltip(val)\n : this.internalFormatTooltip(val, this.state.step);\n return {\n placement: this.state.tooltipBelow ? \"bottom\" : \"top\",\n content,\n visible: this.state.showTooltip,\n } as Partial<Omit<TooltipProps, \"children\">>;\n };\n\n /** @internal */\n public override render(): React.ReactNode {\n const className = classnames(\n \"components-cell-editor\",\n \"components-slider-editor\",\n this.props.className\n );\n const minSize = this.state.size ? this.state.size : 100;\n const style: React.CSSProperties = {\n ...this.props.style,\n minWidth: `${minSize}px`,\n };\n\n const tickProps = {\n \"data-testid\": \"components-tick\",\n } as React.ComponentProps<\"span\">;\n const popupContent = (\n <Slider\n className=\"components-slider-editor-slider\"\n style={style}\n values={[this.state.value]}\n min={this.state.min}\n max={this.state.max}\n step={this.state.step}\n thumbMode={this.state.thumbMode}\n trackDisplayMode={this.state.trackDisplayMode}\n disabled={this.state.isDisabled}\n minLabel={this.state.minLabel}\n maxLabel={this.state.maxLabel}\n tooltipProps={this.tooltipProps}\n tickLabels={this.state.tickLabels}\n tickProps={tickProps}\n onChange={this._handleChange}\n />\n );\n\n return (\n <div className={className} ref={this._divElement}>\n <PopupButton\n label={this.state.value}\n onClose={this._handleClose}\n onEnter={this._handleEnter}\n setFocus={this.props.setFocus}\n >\n <PopupContent>\n {popupContent}\n <PopupOkCancelButtons\n onOk={this._handleOk}\n onCancel={this._handleCancel}\n />\n </PopupContent>\n </PopupButton>\n </div>\n );\n }\n}\n\n/** Slider Property Editor registered for the \"number\" type name and \"slider\" editor name.\n * It uses the [[SliderEditor]] React component.\n * @public\n */\nexport class SliderPropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <SliderEditor />;\n }\n}\n\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Number,\n SliderPropertyEditor,\n StandardEditorNames.Slider\n);\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Int,\n SliderPropertyEditor,\n StandardEditorNames.Slider\n);\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Float,\n SliderPropertyEditor,\n StandardEditorNames.Slider\n);\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Double,\n SliderPropertyEditor,\n StandardEditorNames.Slider\n);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"TextEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/editors/TextEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,mBAAmB,CAAC;AAE3B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAKV,aAAa,EACd,MAAM,uBAAuB,CAAC;AAS/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGzE,gBAAgB;AAChB,UAAU,eAAe;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,qBAAa,UACX,SAAQ,KAAK,CAAC,aAAa,CAAC,mBAAmB,EAAE,eAAe,CAChE,YAAW,UAAU;IAErB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,UAAU,CAAyC;IAC3D,OAAO,CAAC,aAAa,CAAuC;IAE5D,gBAAgB;IAChB,SAAyB,KAAK,EAAE,QAAQ,CAAC,eAAe,CAAC,CAGvD;IAEW,gBAAgB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IAgBnE,IAAW,WAAW,IAAI,WAAW,GAAG,IAAI,CAE3C;IAED,IAAW,QAAQ,IAAI,OAAO,CAE7B;IAED,O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AAiB;IAKjC,gBAAgB;IACA,oBAAoB;IAIpC,gBAAgB;IACA,kBAAkB,CAAC,SAAS,EAAE,mBAAmB;YAMnD,iBAAiB;IA2D/B,gBAAgB;IACA,MAAM,IAAI,KAAK,CAAC,SAAS;CAiD1C"}
@@ -77,12 +77,11 @@ class TextEditor extends React.PureComponent {
77
77
  };
78
78
  }
79
79
  async getPropertyValue() {
80
- var _a;
81
80
  const record = this.props.propertyRecord;
82
81
  let propertyValue;
83
82
  // istanbul ignore else
84
83
  if (record && record.value.valueFormat === appui_abstract_1.PropertyValueFormat.Primitive) {
85
- propertyValue = await TypeConverterManager_1.TypeConverterManager.getConverter(record.property.typename, (_a = record.property.converter) === null || _a === void 0 ? void 0 : _a.name).convertFromStringToPropertyValue(this.state.inputValue, record);
84
+ propertyValue = await TypeConverterManager_1.TypeConverterManager.getConverter(record.property.typename, record.property.converter?.name).convertFromStringToPropertyValue(this.state.inputValue, record);
86
85
  propertyValue.displayValue = this.state.inputValue;
87
86
  }
88
87
  return propertyValue;
@@ -109,13 +108,12 @@ class TextEditor extends React.PureComponent {
109
108
  }
110
109
  }
111
110
  async setStateFromProps() {
112
- var _a;
113
111
  const record = this.props.propertyRecord;
114
112
  let initialValue = "";
115
113
  // istanbul ignore else
116
114
  if (record && record.value.valueFormat === appui_abstract_1.PropertyValueFormat.Primitive) {
117
115
  const value = record.value.value;
118
- initialValue = await TypeConverterManager_1.TypeConverterManager.getConverter(record.property.typename, (_a = record.property.converter) === null || _a === void 0 ? void 0 : _a.name).convertPropertyToString(record.property, value);
116
+ initialValue = await TypeConverterManager_1.TypeConverterManager.getConverter(record.property.typename, record.property.converter?.name).convertPropertyToString(record.property, value);
119
117
  }
120
118
  const readonly = record && undefined !== record.isReadonly ? record.isReadonly : false;
121
119
  let size;
@@ -126,7 +124,7 @@ class TextEditor extends React.PureComponent {
126
124
  record.property &&
127
125
  record.property.editor &&
128
126
  record.property.editor.params) {
129
- const editorSizeParams = record.property.editor.params.find((param) => param.type === appui_abstract_1.PropertyEditorParamTypes.InputEditorSize);
127
+ const editorSizeParams = record.property.editor.params.find((param) => param.type === appui_abstract_1.PropertyEditorParamTypes.InputEditorSize.valueOf());
130
128
  if (editorSizeParams) {
131
129
  // istanbul ignore else
132
130
  if (editorSizeParams.size)
@@ -135,7 +133,7 @@ class TextEditor extends React.PureComponent {
135
133
  if (editorSizeParams.maxLength)
136
134
  maxLength = editorSizeParams.maxLength;
137
135
  }
138
- const iconParams = record.property.editor.params.find((param) => param.type === appui_abstract_1.PropertyEditorParamTypes.Icon);
136
+ const iconParams = record.property.editor.params.find((param) => param.type === appui_abstract_1.PropertyEditorParamTypes.Icon.valueOf());
139
137
  if (iconParams) {
140
138
  iconSpec = iconParams.definition.iconSpec;
141
139
  }
@@ -168,7 +166,7 @@ class TextEditor extends React.PureComponent {
168
166
  value: this.state.inputValue,
169
167
  onBlur: this.props.onBlur,
170
168
  onChange: this._updateInputValue,
171
- setFocus: this.props.setFocus && !this.state.isDisabled,
169
+ autoFocus: this.props.setFocus && !this.state.isDisabled,
172
170
  };
173
171
  inputProps["aria-label"] = this._ariaLabel;
174
172
  let reactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"TextEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/TextEditor.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6BAA2B;AAC3B,4DAAoC;AACpC,6CAA+B;AAQ/B,0DAG+B;AAC/B,kDAAoD;AAEpD,wDAA6C;AAC7C,6EAA0E;AAE1E,kDAA+C;AAY/C;;GAEG;AACH,MAAa,UACX,SAAQ,KAAK,CAAC,aAAmD;IADnE;;QAIU,eAAU,GAAG,KAAK,CAAC;QACnB,eAAU,GAAG,2BAAY,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;QACnD,kBAAa,GAAG,KAAK,CAAC,SAAS,EAAoB,CAAC;QAE5D,gBAAgB;QACS,UAAK,GAA8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,GAAG,CACV,oBAAC,qBAAK,OACA,UAAU,EACd,GAAG,EAAE,IAAI,CAAC,aAAa,iBACX,wBAAwB,EACpC,IAAI,EAAC,OAAO,GACZ,CACH,CAAC;SACH;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AA9LD,gCA8LC","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 PropertyEditors\n */\n\nimport \"./TextEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n IconEditorParams,\n InputEditorSizeParams,\n PrimitiveValue,\n PropertyEditorParams,\n PropertyValue,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyEditorParamTypes,\n PropertyValueFormat,\n} from \"@itwin/appui-abstract\";\nimport { Icon, IconInput } from \"@itwin/core-react\";\nimport type { InputProps } from \"@itwin/itwinui-react\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport { TypeConverterManager } from \"../converters/TypeConverterManager\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport { UiComponents } from \"../UiComponents\";\n\n/** @internal */\ninterface TextEditorState {\n inputValue: string;\n readonly: boolean;\n isDisabled?: boolean;\n size?: number;\n maxLength?: number;\n iconSpec?: string;\n}\n\n/** TextEditor React component that is a property editor with text input\n * @public\n */\nexport class TextEditor\n extends React.PureComponent<PropertyEditorProps, TextEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _ariaLabel = UiComponents.translate(\"editor.text\");\n private _inputElement = React.createRef<HTMLInputElement>();\n\n /** @internal */\n public override readonly state: Readonly<TextEditorState> = {\n inputValue: \"\",\n readonly: false,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = await TypeConverterManager.getConverter(\n record.property.typename,\n record.property.converter?.name\n ).convertFromStringToPropertyValue(this.state.inputValue, record);\n (propertyValue as PrimitiveValue).displayValue = this.state.inputValue;\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._inputElement.current;\n }\n\n public get hasFocus(): boolean {\n return document.activeElement === this._inputElement.current;\n }\n\n private _updateInputValue = (e: React.ChangeEvent<HTMLInputElement>) => {\n // istanbul ignore else\n if (this._isMounted)\n this.setState(\n {\n inputValue: e.target.value,\n },\n async () => {\n if (\n this.props.shouldCommitOnChange &&\n this.props.onCommit &&\n this.props.propertyRecord\n ) {\n const newValue = await this.getPropertyValue();\n // istanbul ignore else\n if (newValue)\n this.props.onCommit({\n propertyRecord: this.props.propertyRecord,\n newValue,\n });\n }\n }\n );\n };\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n void this.setStateFromProps();\n }\n\n /** @internal */\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n void this.setStateFromProps();\n }\n }\n\n private async setStateFromProps() {\n const record = this.props.propertyRecord;\n let initialValue = \"\";\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n const value = record.value.value;\n initialValue = await TypeConverterManager.getConverter(\n record.property.typename,\n record.property.converter?.name\n ).convertPropertyToString(record.property, value);\n }\n\n const readonly =\n record && undefined !== record.isReadonly ? record.isReadonly : false;\n let size: number | undefined;\n let maxLength: number | undefined;\n let iconSpec: string | undefined;\n\n const isDisabled = record ? record.isDisabled : undefined;\n\n if (\n record &&\n record.property &&\n record.property.editor &&\n record.property.editor.params\n ) {\n const editorSizeParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.InputEditorSize\n ) as InputEditorSizeParams;\n if (editorSizeParams) {\n // istanbul ignore else\n if (editorSizeParams.size) size = editorSizeParams.size;\n // istanbul ignore else\n if (editorSizeParams.maxLength) maxLength = editorSizeParams.maxLength;\n }\n\n const iconParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.Icon\n ) as IconEditorParams;\n if (iconParams) {\n iconSpec = iconParams.definition.iconSpec;\n }\n }\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({\n inputValue: initialValue,\n readonly,\n size,\n maxLength,\n isDisabled,\n iconSpec,\n });\n }\n\n /** @internal */\n public override render(): React.ReactNode {\n const className = classnames(\n \"components-cell-editor\",\n \"components-text-editor\",\n this.props.className\n );\n const minSize = this.state.size ? this.state.size : 8;\n const minWidthStyle: React.CSSProperties = {\n minWidth: `${minSize * 0.75}em`,\n };\n const inputProps: InputProps = {\n type: \"text\",\n className,\n style: this.props.style ? this.props.style : minWidthStyle,\n readOnly: this.state.readonly,\n disabled: this.state.isDisabled,\n maxLength: this.state.maxLength,\n value: this.state.inputValue,\n onBlur: this.props.onBlur,\n onChange: this._updateInputValue,\n setFocus: this.props.setFocus && !this.state.isDisabled,\n };\n\n inputProps[\"aria-label\"] = this._ariaLabel;\n\n let reactNode: React.ReactNode;\n if (this.state.iconSpec) {\n const icon = <Icon iconSpec={this.state.iconSpec} />;\n reactNode = (\n <IconInput\n {...inputProps}\n ref={this._inputElement}\n icon={icon}\n data-testid=\"components-text-editor\"\n />\n );\n } else {\n reactNode = (\n <Input\n {...inputProps}\n ref={this._inputElement}\n data-testid=\"components-text-editor\"\n size=\"small\"\n />\n );\n }\n\n return reactNode;\n }\n}\n"]}
1
+ {"version":3,"file":"TextEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/TextEditor.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6BAA2B;AAC3B,4DAAoC;AACpC,6CAA+B;AAQ/B,0DAG+B;AAC/B,kDAAoD;AACpD,wDA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AAC,KAAK,CAAC,QAAQ,EAAE;YACvB,MAAM,IAAI,GAAG,oBAAC,iBAAI,IAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAI,CAAC;YACrD,SAAS,GAAG,CACV,oBAAC,sBAAS,OACJ,UAAU,EACd,GAAG,EAAE,IAAI,CAAC,aAAa,EACvB,IAAI,EAAE,IAAI,iBACE,wBAAwB,GACpC,CACH,CAAC;SACH;aAAM;YACL,SAAS,GAAG,CACV,oBAAC,qBAAK,OACA,UAAU,EACd,GAAG,EAAE,IAAI,CAAC,aAAa,iBACX,wBAAwB,EACpC,IAAI,EAAC,OAAO,GACZ,CACH,CAAC;SACH;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AA9LD,gCA8LC","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 PropertyEditors\n */\n\nimport \"./TextEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n IconEditorParams,\n InputEditorSizeParams,\n PrimitiveValue,\n PropertyEditorParams,\n PropertyValue,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyEditorParamTypes,\n PropertyValueFormat,\n} from \"@itwin/appui-abstract\";\nimport { Icon, IconInput } from \"@itwin/core-react\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport { TypeConverterManager } from \"../converters/TypeConverterManager\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport { UiComponents } from \"../UiComponents\";\n\ntype InputProps = React.ComponentPropsWithoutRef<typeof Input>;\n\n/** @internal */\ninterface TextEditorState {\n inputValue: string;\n readonly: boolean;\n isDisabled?: boolean;\n size?: number;\n maxLength?: number;\n iconSpec?: string;\n}\n\n/** TextEditor React component that is a property editor with text input\n * @public\n */\nexport class TextEditor\n extends React.PureComponent<PropertyEditorProps, TextEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _ariaLabel = UiComponents.translate(\"editor.text\");\n private _inputElement = React.createRef<HTMLInputElement>();\n\n /** @internal */\n public override readonly state: Readonly<TextEditorState> = {\n inputValue: \"\",\n readonly: false,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = await TypeConverterManager.getConverter(\n record.property.typename,\n record.property.converter?.name\n ).convertFromStringToPropertyValue(this.state.inputValue, record);\n (propertyValue as PrimitiveValue).displayValue = this.state.inputValue;\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._inputElement.current;\n }\n\n public get hasFocus(): boolean {\n return document.activeElement === this._inputElement.current;\n }\n\n private _updateInputValue = (e: React.ChangeEvent<HTMLInputElement>) => {\n // istanbul ignore else\n if (this._isMounted)\n this.setState(\n {\n inputValue: e.target.value,\n },\n async () => {\n if (\n this.props.shouldCommitOnChange &&\n this.props.onCommit &&\n this.props.propertyRecord\n ) {\n const newValue = await this.getPropertyValue();\n // istanbul ignore else\n if (newValue)\n this.props.onCommit({\n propertyRecord: this.props.propertyRecord,\n newValue,\n });\n }\n }\n );\n };\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n void this.setStateFromProps();\n }\n\n /** @internal */\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n void this.setStateFromProps();\n }\n }\n\n private async setStateFromProps() {\n const record = this.props.propertyRecord;\n let initialValue = \"\";\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n const value = record.value.value;\n initialValue = await TypeConverterManager.getConverter(\n record.property.typename,\n record.property.converter?.name\n ).convertPropertyToString(record.property, value);\n }\n\n const readonly =\n record && undefined !== record.isReadonly ? record.isReadonly : false;\n let size: number | undefined;\n let maxLength: number | undefined;\n let iconSpec: string | undefined;\n\n const isDisabled = record ? record.isDisabled : undefined;\n\n if (\n record &&\n record.property &&\n record.property.editor &&\n record.property.editor.params\n ) {\n const editorSizeParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.InputEditorSize.valueOf()\n ) as InputEditorSizeParams;\n if (editorSizeParams) {\n // istanbul ignore else\n if (editorSizeParams.size) size = editorSizeParams.size;\n // istanbul ignore else\n if (editorSizeParams.maxLength) maxLength = editorSizeParams.maxLength;\n }\n\n const iconParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.Icon.valueOf()\n ) as IconEditorParams;\n if (iconParams) {\n iconSpec = iconParams.definition.iconSpec;\n }\n }\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({\n inputValue: initialValue,\n readonly,\n size,\n maxLength,\n isDisabled,\n iconSpec,\n });\n }\n\n /** @internal */\n public override render(): React.ReactNode {\n const className = classnames(\n \"components-cell-editor\",\n \"components-text-editor\",\n this.props.className\n );\n const minSize = this.state.size ? this.state.size : 8;\n const minWidthStyle: React.CSSProperties = {\n minWidth: `${minSize * 0.75}em`,\n };\n const inputProps: InputProps = {\n type: \"text\",\n className,\n style: this.props.style ? this.props.style : minWidthStyle,\n readOnly: this.state.readonly,\n disabled: this.state.isDisabled,\n maxLength: this.state.maxLength,\n value: this.state.inputValue,\n onBlur: this.props.onBlur,\n onChange: this._updateInputValue,\n autoFocus: this.props.setFocus && !this.state.isDisabled,\n };\n\n inputProps[\"aria-label\"] = this._ariaLabel;\n\n let reactNode: React.ReactNode;\n if (this.state.iconSpec) {\n const icon = <Icon iconSpec={this.state.iconSpec} />;\n reactNode = (\n <IconInput\n {...inputProps}\n ref={this._inputElement}\n icon={icon}\n data-testid=\"components-text-editor\"\n />\n );\n } else {\n reactNode = (\n <Input\n {...inputProps}\n ref={this._inputElement}\n data-testid=\"components-text-editor\"\n size=\"small\"\n />\n );\n }\n\n return reactNode;\n }\n}\n"]}
@@ -12,10 +12,8 @@
12
12
 
13
13
  .components-smallEditor-host {
14
14
  .components-text-editor {
15
- &.iui-input {
16
- min-height: $editor-component-height-small !important;
17
- padding-top: 1px !important;
18
- padding-bottom: 1px !important;
19
- }
15
+ min-height: $editor-component-height-small !important;
16
+ padding-top: 1px !important;
17
+ padding-bottom: 1px !important;
20
18
  }
21
19
  }
@@ -22,6 +22,7 @@ export declare class TextareaEditor extends React.PureComponent<PropertyEditorPr
22
22
  private _isMounted;
23
23
  private _ariaLabel;
24
24
  private _divElement;
25
+ private _textAreaElement;
25
26
  /** @internal */
26
27
  readonly state: Readonly<TextareaEditorState>;
27
28
  getPropertyValue(): Promise<PropertyValue | undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"TextareaEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/editors/TextareaEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,uBAAuB,CAAC;AAE/B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAKV,aAAa,EACd,MAAM,uBAAuB,CAAC;AAU/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EACL,kBAAkB,EAEnB,MAAM,yBAAyB,CAAC;AAIjC,gBAAgB;AAChB,UAAU,mBAAmB;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;CACd;AAID;;GAEG;AACH,qBAAa,cACX,SAAQ,KAAK,CAAC,aAAa,CAAC,mBAAmB,EAAE,mBAAmB,CACpE,YAAW,UAAU;IAErB,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Components.translate("editor.textarea");
55
55
  this._divElement = React.createRef();
56
+ this._textAreaElement = React.createRef();
56
57
  /** @internal */
57
58
  this.state = {
58
59
  inputValue: "",
@@ -140,7 +141,7 @@ class TextareaEditor extends React.PureComponent {
140
141
  record.property &&
141
142
  record.property.editor &&
142
143
  record.property.editor.params) {
143
- const editorSizeParams = record.property.editor.params.find((param) => param.type === appui_abstract_1.PropertyEditorParamTypes.InputEditorSize);
144
+ const editorSizeParams = record.property.editor.params.find((param) => param.type === appui_abstract_1.PropertyEditorParamTypes.InputEditorSize.valueOf());
144
145
  if (editorSizeParams) {
145
146
  // istanbul ignore else
146
147
  if (editorSizeParams.size)
@@ -149,7 +150,7 @@ class TextareaEditor extends React.PureComponent {
149
150
  if (editorSizeParams.maxLength)
150
151
  maxLength = editorSizeParams.maxLength;
151
152
  }
152
- const multilineParams = record.property.editor.params.find((param) => param.type === appui_abstract_1.PropertyEditorParamTypes.MultilineText);
153
+ const multilineParams = record.property.editor.params.find((param) => param.type === appui_abstract_1.PropertyEditorParamTypes.MultilineText.valueOf());
153
154
  if (multilineParams) {
154
155
  rows = multilineParams.rows;
155
156
  }
@@ -182,13 +183,13 @@ class TextareaEditor extends React.PureComponent {
182
183
  maxLength: this.state.maxLength,
183
184
  value: this.state.inputValue,
184
185
  onChange: this._updateTextareaValue,
185
- setFocus: this.props.setFocus && !this.state.isDisabled,
186
+ autoFocus: this.props.setFocus && !this.state.isDisabled,
186
187
  };
187
188
  textareaProps["aria-label"] = this._ariaLabel;
188
189
  return (React.createElement("div", { className: className, ref: this._divElement },
189
- React.createElement(PopupButton_1.PopupButton, { label: this.state.inputValue, closeOnEnter: false, setFocus: this.props.setFocus, focusTarget: ".iui-input" },
190
+ React.createElement(PopupButton_1.PopupButton, { label: this.state.inputValue, closeOnEnter: false, setFocus: this.props.setFocus, focusTarget: this._textAreaElement },
190
191
  React.createElement(PopupButton_1.PopupContent, null,
191
- React.createElement(itwinui_react_1.Textarea, { ...textareaProps, "data-testid": "components-textarea-editor" }),
192
+ React.createElement(itwinui_react_1.Textarea, { ...textareaProps, "data-testid": "components-textarea-editor", ref: this._textAreaElement }),
192
193
  React.createElement(PopupButton_1.PopupOkCancelButtons, { onOk: this._handleOk, onCancel: this._handleCancel })))));
193
194
  }
194
195
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TextareaEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/TextareaEditor.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iCAA+B;AAC/B,4DAAoC;AACpC,6CAA+B;AAQ/B,0DAK+B;AAE/B,wDAAgD;AAChD,6EAA0E;AAE1E,mEAGiC;AACjC,+CAAgF;AAChF,kDAA+C;AAY/C,MAAM,YAAY,GAAG,CAAC,CAAC;AAEvB;;GAEG;AACH,MAAa,cACX,SAAQ,KAAK,CAAC,aAAuD;IADvE;;QAIU,eAAU,GAAG,KAAK,CAAC;QACnB,eAAU,GAAG,2BAAY,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;QACvD,gBAAW,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;QAExD,gBAAgB;QACS,UAAK,GAAkC;YAC9D,UAAU,EAAE,EAAE;YACd,QAAQ,EAAE,KAAK;YACf,IAAI,EAAE,YAAY;SACnB,CAAC;QA+BM,yBAAoB,GAAG,CAC7B,CAAyC,EACzC,EAAE;YACF,uBAAuB;YACvB,IAAI,IAAI,CAAC,UAAU;gBACjB,IAAI,CAAC,QAAQ,CAAC;oBACZ,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK;iBAC3B,CAAC,CAAC;QACP,CAAC,CAAC;QA8EM,cAAS,GAAG,KAAK,EAAE,MAAwB,EAAiB,EAAE;YACpE,uBAAuB;YACvB,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;gBACpD,MAAM,aAAa,GAAG,M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O,KAAK,CAAC;IACf,CAAC;IACD,uBAAuB;IACvB,IAAoB,qBAAqB;QACvC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,uBAAuB;IACvB,IAAoB,mBAAmB;QACrC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAW,SAAS;QAClB,OAAO,oBAAC,cAAc,OAAG,CAAC;IAC5B,CAAC;CACF;AAjBD,wDAiBC;AAED,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,IAAI,EACtB,sBAAsB,EACtB,oCAAmB,CAAC,SAAS,CAC9B,CAAC;AACF,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,MAAM,EACxB,sBAAsB,EACtB,oCAAmB,CAAC,SAAS,CAC9B,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 PropertyEditors\n */\n\nimport \"./TextareaEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n InputEditorSizeParams,\n MultilineTextEditorParams,\n PrimitiveValue,\n PropertyEditorParams,\n PropertyValue,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyEditorParamTypes,\n PropertyValueFormat,\n StandardEditorNames,\n StandardTypeNames,\n} from \"@itwin/appui-abstract\";\nimport type { TextareaProps } from \"@itwin/itwinui-react\";\nimport { Textarea } from \"@itwin/itwinui-react\";\nimport { TypeConverterManager } from \"../converters/TypeConverterManager\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport {\n PropertyEditorBase,\n PropertyEditorManager,\n} from \"./PropertyEditorManager\";\nimport { PopupButton, PopupContent, PopupOkCancelButtons } from \"./PopupButton\";\nimport { UiComponents } from \"../UiComponents\";\n\n/** @internal */\ninterface TextareaEditorState {\n inputValue: string;\n readonly: boolean;\n isDisabled?: boolean;\n size?: number;\n maxLength?: number;\n rows: number;\n}\n\nconst DEFAULT_ROWS = 3;\n\n/** TextareaEditor React component that is a property editor with text input\n * @public\n */\nexport class TextareaEditor\n extends React.PureComponent<PropertyEditorProps, TextareaEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _ariaLabel = UiComponents.translate(\"editor.textarea\");\n private _divElement = React.createRef<HTMLDivElement>();\n\n /** @internal */\n public override readonly state: Readonly<TextareaEditorState> = {\n inputValue: \"\",\n readonly: false,\n rows: DEFAULT_ROWS,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = await TypeConverterManager.getConverter(\n record.property.typename\n ).convertFromStringToPropertyValue(this.state.inputValue, record);\n (propertyValue as PrimitiveValue).displayValue = this.state.inputValue;\n }\n\n return propertyValue;\n }\n\n // istanbul ignore next\n public get htmlElement(): HTMLElement | null {\n return this._divElement.current;\n }\n\n // istanbul ignore next\n public get hasFocus(): boolean {\n let containsFocus = false;\n // istanbul ignore else\n if (this._divElement.current)\n containsFocus = this._divElement.current.contains(document.activeElement);\n return containsFocus;\n }\n\n private _updateTextareaValue = (\n e: React.ChangeEvent<HTMLTextAreaElement>\n ) => {\n // istanbul ignore else\n if (this._isMounted)\n this.setState({\n inputValue: e.target.value,\n });\n };\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n void this.setStateFromProps();\n }\n\n /** @internal */\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n void this.setStateFromProps();\n }\n }\n\n private async setStateFromProps() {\n const record = this.props.propertyRecord;\n let initialValue = \"\";\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n const value = record.value.value;\n initialValue = await TypeConverterManager.getConverter(\n record.property.typename\n ).convertPropertyToString(record.property, value);\n }\n\n const readonly =\n record && undefined !== record.isReadonly ? record.isReadonly : false;\n let size: number | undefined;\n let maxLength: number | undefined;\n let rows: number = DEFAULT_ROWS;\n\n const isDisabled = record ? record.isDisabled : undefined;\n\n if (\n record &&\n record.property &&\n record.property.editor &&\n record.property.editor.params\n ) {\n const editorSizeParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.InputEditorSize\n ) as InputEditorSizeParams;\n if (editorSizeParams) {\n // istanbul ignore else\n if (editorSizeParams.size) size = editorSizeParams.size;\n // istanbul ignore else\n if (editorSizeParams.maxLength) maxLength = editorSizeParams.maxLength;\n }\n\n const multilineParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.MultilineText\n ) as MultilineTextEditorParams;\n if (multilineParams) {\n rows = multilineParams.rows;\n }\n }\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({\n inputValue: initialValue,\n readonly,\n size,\n maxLength,\n isDisabled,\n rows,\n });\n }\n\n private _handleOk = async (_event: React.MouseEvent): Promise<void> => {\n // istanbul ignore else\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (propertyValue !== undefined) {\n this.props.onCommit({\n propertyRecord: this.props.propertyRecord,\n newValue: propertyValue,\n });\n }\n }\n };\n\n private _handleCancel = (_event: React.MouseEvent): void => {\n // istanbul ignore else\n if (this.props.onCancel) {\n this.props.onCancel();\n }\n };\n\n /** @internal */\n public override render(): React.ReactNode {\n const className = classnames(\n \"components-cell-editor\",\n \"components-textarea-editor\",\n this.props.className\n );\n const minSize = this.state.size ? this.state.size : 8;\n const style: React.CSSProperties = {\n ...this.props.style,\n minWidth: `${minSize * 0.75}em`,\n };\n const textareaProps: TextareaProps = {\n className: \"components-textarea-editor-textarea\",\n style,\n rows: this.state.rows,\n readOnly: this.state.readonly,\n disabled: this.state.isDisabled,\n maxLength: this.state.maxLength,\n value: this.state.inputValue,\n onChange: this._updateTextareaValue,\n setFocus: this.props.setFocus && !this.state.isDisabled,\n };\n\n textareaProps[\"aria-label\"] = this._ariaLabel;\n\n return (\n <div className={className} ref={this._divElement}>\n <PopupButton\n label={this.state.inputValue}\n closeOnEnter={false}\n setFocus={this.props.setFocus}\n focusTarget=\".iui-input\"\n >\n <PopupContent>\n <Textarea\n {...textareaProps}\n data-testid=\"components-textarea-editor\"\n />\n <PopupOkCancelButtons\n onOk={this._handleOk}\n onCancel={this._handleCancel}\n />\n </PopupContent>\n </PopupButton>\n </div>\n );\n }\n}\n\n/** Textarea Property Editor registered for the \"text\" and \"string\" type names and \"multi-line\" editor name.\n * It uses the [[TextareaEditor]] React component.\n * @public\n */\nexport class TextareaPropertyEditor extends PropertyEditorBase {\n // istanbul ignore next\n public override get containerHandlesBlur(): boolean {\n return false;\n }\n // istanbul ignore next\n public override get containerHandlesEnter(): boolean {\n return false;\n }\n // istanbul ignore next\n public override get containerHandlesTab(): boolean {\n return false;\n }\n\n public get reactNode(): React.ReactNode {\n return <TextareaEditor />;\n }\n}\n\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Text,\n TextareaPropertyEditor,\n StandardEditorNames.MultiLine\n);\nPropertyEditorManager.registerEditor(\n StandardTypeNames.String,\n TextareaPropertyEditor,\n StandardEditorNames.MultiLine\n);\n"]}
1
+ {"version":3,"file":"TextareaEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/TextareaEditor.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iCAA+B;AAC/B,4DAAoC;AACpC,6CAA+B;AAQ/B,0DAK+B;AAC/B,wDAAgD;AAChD,6EAA0E;AAE1E,mEAGiC;AACjC,+CAAgF;AAChF,kDAA+C;AAc/C,MAAM,YAAY,GAAG,CAAC,CAAC;AAEvB;;GAEG;AACH,MAAa,cACX,SAAQ,KAAK,CAAC,aAAuD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AAmB,CAAC,SAAS,CAC9B,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 PropertyEditors\n */\n\nimport \"./TextareaEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n InputEditorSizeParams,\n MultilineTextEditorParams,\n PrimitiveValue,\n PropertyEditorParams,\n PropertyValue,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyEditorParamTypes,\n PropertyValueFormat,\n StandardEditorNames,\n StandardTypeNames,\n} from \"@itwin/appui-abstract\";\nimport { Textarea } from \"@itwin/itwinui-react\";\nimport { TypeConverterManager } from \"../converters/TypeConverterManager\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport {\n PropertyEditorBase,\n PropertyEditorManager,\n} from \"./PropertyEditorManager\";\nimport { PopupButton, PopupContent, PopupOkCancelButtons } from \"./PopupButton\";\nimport { UiComponents } from \"../UiComponents\";\n\ntype TextareaProps = React.ComponentPropsWithoutRef<typeof Textarea>;\n\n/** @internal */\ninterface TextareaEditorState {\n inputValue: string;\n readonly: boolean;\n isDisabled?: boolean;\n size?: number;\n maxLength?: number;\n rows: number;\n}\n\nconst DEFAULT_ROWS = 3;\n\n/** TextareaEditor React component that is a property editor with text input\n * @public\n */\nexport class TextareaEditor\n extends React.PureComponent<PropertyEditorProps, TextareaEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _ariaLabel = UiComponents.translate(\"editor.textarea\");\n private _divElement = React.createRef<HTMLDivElement>();\n private _textAreaElement = React.createRef<HTMLTextAreaElement>();\n\n /** @internal */\n public override readonly state: Readonly<TextareaEditorState> = {\n inputValue: \"\",\n readonly: false,\n rows: DEFAULT_ROWS,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = await TypeConverterManager.getConverter(\n record.property.typename\n ).convertFromStringToPropertyValue(this.state.inputValue, record);\n (propertyValue as PrimitiveValue).displayValue = this.state.inputValue;\n }\n\n return propertyValue;\n }\n\n // istanbul ignore next\n public get htmlElement(): HTMLElement | null {\n return this._divElement.current;\n }\n\n // istanbul ignore next\n public get hasFocus(): boolean {\n let containsFocus = false;\n // istanbul ignore else\n if (this._divElement.current)\n containsFocus = this._divElement.current.contains(document.activeElement);\n return containsFocus;\n }\n\n private _updateTextareaValue = (\n e: React.ChangeEvent<HTMLTextAreaElement>\n ) => {\n // istanbul ignore else\n if (this._isMounted)\n this.setState({\n inputValue: e.target.value,\n });\n };\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n void this.setStateFromProps();\n }\n\n /** @internal */\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n void this.setStateFromProps();\n }\n }\n\n private async setStateFromProps() {\n const record = this.props.propertyRecord;\n let initialValue = \"\";\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n const value = record.value.value;\n initialValue = await TypeConverterManager.getConverter(\n record.property.typename\n ).convertPropertyToString(record.property, value);\n }\n\n const readonly =\n record && undefined !== record.isReadonly ? record.isReadonly : false;\n let size: number | undefined;\n let maxLength: number | undefined;\n let rows: number = DEFAULT_ROWS;\n\n const isDisabled = record ? record.isDisabled : undefined;\n\n if (\n record &&\n record.property &&\n record.property.editor &&\n record.property.editor.params\n ) {\n const editorSizeParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.InputEditorSize.valueOf()\n ) as InputEditorSizeParams;\n if (editorSizeParams) {\n // istanbul ignore else\n if (editorSizeParams.size) size = editorSizeParams.size;\n // istanbul ignore else\n if (editorSizeParams.maxLength) maxLength = editorSizeParams.maxLength;\n }\n\n const multilineParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.MultilineText.valueOf()\n ) as MultilineTextEditorParams;\n if (multilineParams) {\n rows = multilineParams.rows;\n }\n }\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({\n inputValue: initialValue,\n readonly,\n size,\n maxLength,\n isDisabled,\n rows,\n });\n }\n\n private _handleOk = async (_event: React.MouseEvent): Promise<void> => {\n // istanbul ignore else\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (propertyValue !== undefined) {\n this.props.onCommit({\n propertyRecord: this.props.propertyRecord,\n newValue: propertyValue,\n });\n }\n }\n };\n\n private _handleCancel = (_event: React.MouseEvent): void => {\n // istanbul ignore else\n if (this.props.onCancel) {\n this.props.onCancel();\n }\n };\n\n /** @internal */\n public override render(): React.ReactNode {\n const className = classnames(\n \"components-cell-editor\",\n \"components-textarea-editor\",\n this.props.className\n );\n const minSize = this.state.size ? this.state.size : 8;\n const style: React.CSSProperties = {\n ...this.props.style,\n minWidth: `${minSize * 0.75}em`,\n };\n const textareaProps: TextareaProps = {\n className: \"components-textarea-editor-textarea\",\n style,\n rows: this.state.rows,\n readOnly: this.state.readonly,\n disabled: this.state.isDisabled,\n maxLength: this.state.maxLength,\n value: this.state.inputValue,\n onChange: this._updateTextareaValue,\n autoFocus: this.props.setFocus && !this.state.isDisabled,\n };\n\n textareaProps[\"aria-label\"] = this._ariaLabel;\n\n return (\n <div className={className} ref={this._divElement}>\n <PopupButton\n label={this.state.inputValue}\n closeOnEnter={false}\n setFocus={this.props.setFocus}\n focusTarget={this._textAreaElement}\n >\n <PopupContent>\n <Textarea\n {...textareaProps}\n data-testid=\"components-textarea-editor\"\n ref={this._textAreaElement}\n />\n <PopupOkCancelButtons\n onOk={this._handleOk}\n onCancel={this._handleCancel}\n />\n </PopupContent>\n </PopupButton>\n </div>\n );\n }\n}\n\n/** Textarea Property Editor registered for the \"text\" and \"string\" type names and \"multi-line\" editor name.\n * It uses the [[TextareaEditor]] React component.\n * @public\n */\nexport class TextareaPropertyEditor extends PropertyEditorBase {\n // istanbul ignore next\n public override get containerHandlesBlur(): boolean {\n return false;\n }\n // istanbul ignore next\n public override get containerHandlesEnter(): boolean {\n return false;\n }\n // istanbul ignore next\n public override get containerHandlesTab(): boolean {\n return false;\n }\n\n public get reactNode(): React.ReactNode {\n return <TextareaEditor />;\n }\n}\n\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Text,\n TextareaPropertyEditor,\n StandardEditorNames.MultiLine\n);\nPropertyEditorManager.registerEditor(\n StandardTypeNames.String,\n TextareaPropertyEditor,\n StandardEditorNames.MultiLine\n);\n"]}
@@ -134,7 +134,7 @@ class ToggleEditor extends React.PureComponent {
134
134
  const className = (0, classnames_1.default)("components-cell-editor", "components-toggle-editor", this.props.className);
135
135
  const isChecked = this.state.toggleValue;
136
136
  const isDisabled = !!this.state.isDisabled;
137
- return (React.createElement(itwinui_react_1.ToggleSwitch, { ref: this._inputElement, onBlur: this.props.onBlur, className: className, style: this.props.style, checked: isChecked, disabled: isDisabled, onChange: this._updateToggleValue, "data-testid": "components-toggle-editor", setFocus: this.props.setFocus }));
137
+ return (React.createElement(itwinui_react_1.ToggleSwitch, { ref: this._inputElement, onBlur: this.props.onBlur, className: className, style: this.props.style, checked: isChecked, disabled: isDisabled, onChange: this._updateToggleValue, "data-testid": "components-toggle-editor", autoFocus: this.props.setFocus }));
138
138
  }
139
139
  }
140
140
  exports.ToggleEditor = ToggleEditor;