@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":"DatePicker.js","sourceRoot":"","sources":["../../../../src/components-react/datepicker/DatePicker.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,4BAA4B,CA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3B,qCAAqC,EACrC,QAAQ,IAAI,UAAU,EACtB,CAAC,cAAc,IAAI,iBAAiB,EACpC,SAAS,IAAI,SAAS,CACvB,CAAC;YACF,MAAM,SAAS,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;YAChC,OAAO;YACL,oEAAoE;YACpE,4BACE,SAAS,EAAE,UAAU,EACrB,GAAG,EAAE,GAAG,aAAa,IAAI,mBAAmB,QAAQ,QAAQ,EAAE,EAC9D,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAC/B,IAAI,EAAC,QAAQ,mBACE,QAAQ,gBACX,GAAG,CAAC,OAAO,EAAE;gBAEzB,kCAAO,SAAS,CAAQ,CACrB,CACN,CAAC;QACJ,CAAC,CAAC,CACa,CAClB,CAAC,CACC,CACD,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Date\n */\n\nimport * as React from \"react\";\nimport classnames from \"classnames\";\nimport { Key } from \"ts-key-enum\";\nimport { UiComponents } from \"../UiComponents\";\nimport { Icon } from \"@itwin/core-react\";\nimport { SvgChevronLeft, SvgChevronRight } from \"@itwin/itwinui-icons-react\";\nimport \"./DatePicker.scss\";\n\nfunction isSameDay(a: Date, b: Date) {\n return (\n a &&\n b &&\n a.getFullYear() === b.getFullYear() &&\n a.getMonth() === b.getMonth() &&\n a.getDate() === b.getDate()\n );\n}\n\n/**\n * Props for [[DatePicker]] component.\n * @alpha\n */\nexport interface DatePickerProps {\n /** defines both date and time */\n selected: Date;\n /** function to call when date or time has changed */\n onDateChange?: (day: Date) => void;\n /** show focus outlines, useful for keyboard navigation */\n showFocusOutline?: boolean;\n}\n\n/** DatePicker component. Show a month selector and a day calendar to select a specific date.\n * @alpha\n */\nexport function DatePicker(props: DatePickerProps) {\n const previousMonthLabel = React.useRef(\n UiComponents.localization.getLocalizedString(\n \"UiComponents:datepicker.previousMonth\"\n )\n );\n const nextMonthLabel = React.useRef(\n UiComponents.localization.getLocalizedString(\n \"UiComponents:datepicker.nextMonth\"\n )\n );\n const monthsLong = React.useRef([\n UiComponents.localization.getLocalizedString(\n \"UiComponents:month.long.january\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:month.long.february\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:month.long.march\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:month.long.april\"\n ),\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.may\"),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:month.long.june\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:month.long.july\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:month.long.august\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:month.long.september\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:month.long.october\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:month.long.november\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:month.long.december\"\n ),\n ]);\n\n const daysLong = React.useRef([\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.long.sunday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.long.monday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.long.tuesday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.long.wednesday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.long.thursday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.long.friday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.long.saturday\"\n ),\n ]);\n\n const daysShort = React.useRef([\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.short.sunday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.short.monday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.short.tuesday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.short.wednesday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.short.thursday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.short.friday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.short.saturday\"\n ),\n ]);\n\n const [selectedDay, setSelectedDay] = React.useState(\n new Date(props.selected.getTime())\n );\n const [displayedMonthIndex, setDisplayedMonthIndex] = React.useState(\n selectedDay.getMonth()\n );\n const [displayedYear, setDisplayedYear] = React.useState(\n selectedDay.getFullYear()\n );\n const [focusedDay, setFocusedDay] = React.useState(selectedDay);\n React.useEffect(() => {\n const newSelectedDay = new Date(props.selected);\n setSelectedDay(new Date(props.selected));\n setDisplayedMonthIndex(newSelectedDay.getMonth());\n setDisplayedYear(newSelectedDay.getFullYear());\n setFocusedDay(newSelectedDay);\n }, [props.selected]);\n const days = React.useMemo(() => {\n const msFirstDayOfMonth = new Date(\n displayedYear,\n displayedMonthIndex,\n 1\n ).getTime();\n let offsetToFirst = new Date(msFirstDayOfMonth).getDay();\n if (0 === offsetToFirst) offsetToFirst = 7;\n\n const daysInMonth: Date[] = [];\n // generate 6 weeks of dates\n for (let i = 0; i < 42; i++) {\n const adjustedDay = 1 + i - offsetToFirst;\n daysInMonth.push(\n new Date(displayedYear, displayedMonthIndex, adjustedDay)\n );\n }\n return daysInMonth;\n }, [displayedMonthIndex, displayedYear]);\n\n const weeks = React.useMemo(() => {\n const weeksInMonth = [];\n const weekCount = Math.ceil(days.length / 7);\n for (let i = 0; i < weekCount; i++) {\n weeksInMonth.push(days.slice(i * 7, (i + 1) * 7));\n }\n return weeksInMonth;\n }, [days]);\n\n const setMonthAndYear = React.useCallback(\n (newMonth: number, newYear: number) => {\n setDisplayedMonthIndex(newMonth);\n setDisplayedYear(newYear);\n if (\n selectedDay.getFullYear() === newYear &&\n selectedDay.getMonth() === newMonth\n ) {\n setFocusedDay(new Date(selectedDay.getTime()));\n } else {\n const newFocusDay = new Date(focusedDay.getTime());\n newFocusDay.setFullYear(newYear, newMonth, 1);\n setFocusedDay(newFocusDay);\n }\n },\n [focusedDay, selectedDay]\n );\n\n const handleMoveToPreviousMonth = React.useCallback(() => {\n const newMonth = displayedMonthIndex !== 0 ? displayedMonthIndex - 1 : 11;\n const newYear =\n displayedMonthIndex !== 0 ? displayedYear : displayedYear - 1;\n setMonthAndYear(newMonth, newYear);\n }, [displayedMonthIndex, displayedYear, setMonthAndYear]);\n\n const handleMoveToNextMonth = React.useCallback(() => {\n const newMonth = displayedMonthIndex !== 11 ? displayedMonthIndex + 1 : 0;\n const newYear =\n displayedMonthIndex !== 11 ? displayedYear : displayedYear + 1;\n setMonthAndYear(newMonth, newYear);\n }, [displayedMonthIndex, displayedYear, setMonthAndYear]);\n\n // when invoked, it will return another function which can be used for the onClick React listener.\n const handleOnDayChange = React.useCallback(\n (day: Date) => () => {\n setSelectedDay(day);\n setFocusedDay(day);\n props.onDateChange && props.onDateChange(day);\n },\n [props]\n );\n\n const handleCalendarKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLUListElement>) => {\n if (event.key === Key.ArrowDown) {\n const focusedDayIndex = days.findIndex((day) =>\n isSameDay(day, focusedDay)\n );\n if (focusedDayIndex + 7 > 41) setFocusedDay(days[focusedDayIndex % 7]);\n else setFocusedDay(days[focusedDayIndex + 7]);\n event.preventDefault();\n }\n if (event.key === Key.ArrowUp) {\n const focusedDayIndex = days.findIndex((day) =>\n isSameDay(day, focusedDay)\n );\n if (focusedDayIndex - 7 < 0)\n setFocusedDay(days[(focusedDayIndex % 7) + 35]);\n else setFocusedDay(days[focusedDayIndex - 7]);\n event.preventDefault();\n }\n if (event.key === Key.ArrowLeft) {\n const focusedDayIndex = days.findIndex((day) =>\n isSameDay(day, focusedDay)\n );\n // istanbul ignore else\n if (focusedDayIndex - 1 >= 0) setFocusedDay(days[focusedDayIndex - 1]);\n event.preventDefault();\n }\n if (event.key === Key.ArrowRight) {\n const focusedDayIndex = days.findIndex((day) =>\n isSameDay(day, focusedDay)\n );\n // istanbul ignore else\n if (focusedDayIndex + 1 <= 41) setFocusedDay(days[focusedDayIndex + 1]);\n event.preventDefault();\n }\n if (event.key === Key.Enter || event.key === \" \") {\n handleOnDayChange(focusedDay)(); // NB: immediately call returned handler function\n event.preventDefault();\n }\n },\n [days, focusedDay, handleOnDayChange]\n );\n\n const previousButtonClass = classnames(\n \"components-previous-month\",\n props.showFocusOutline && \"showFocusOutline\"\n );\n const nextButtonClass = classnames(\n \"components-next-month\",\n props.showFocusOutline && \"showFocusOutline\"\n );\n const calendarClass = classnames(\n \"components-date-picker-calendar-month\",\n props.showFocusOutline && \"showFocusOutline\"\n );\n\n return (\n <div className=\"components-date-picker-calendar\">\n <div className=\"components-date-picker-calendar-header-months\">\n <button\n className={previousButtonClass}\n title={previousMonthLabel.current}\n onClick={handleMoveToPreviousMonth}\n >\n <Icon iconSpec={<SvgChevronLeft />} />\n </button>\n <span className=\"components-month-year\">\n {monthsLong.current[displayedMonthIndex]} {displayedYear}\n </span>\n <button\n className={nextButtonClass}\n title={nextMonthLabel.current}\n onClick={handleMoveToNextMonth}\n >\n <Icon iconSpec={<SvgChevronRight />} />\n </button>\n </div>\n <div className=\"components-date-picker-calendar-header-weekdays\">\n {[0, 1, 2, 3, 4, 5, 6].map((dayOfWeek) => (\n <div\n key={`day-${dayOfWeek}`}\n className=\"components-date-picker-calendar-header-day-short\"\n title={daysLong.current[dayOfWeek]}\n >\n <span>{daysShort.current[dayOfWeek]}</span>\n </div>\n ))}\n </div>\n <ul\n tabIndex={0}\n onKeyDown={handleCalendarKeyDown}\n data-testid=\"components-date-picker-calendar-list\"\n className={calendarClass}\n role=\"listbox\"\n >\n {weeks.map((weekdays, weekIndex) => (\n <React.Fragment key={`week-${weekIndex}`}>\n {weekdays.map((day: Date, dayIndex: number) => {\n const isActive =\n selectedDay && day && isSameDay(selectedDay, day);\n const isFocused =\n focusedDay &&\n day &&\n isSameDay(focusedDay, day) &&\n props.showFocusOutline;\n const isCurrentMonth = day.getMonth() === displayedMonthIndex;\n const classNames = classnames(\n \"components-date-picker-calendar-day\",\n isActive && \"selected\",\n !isCurrentMonth && \"notCurrentMonth\",\n isFocused && \"focused\"\n );\n const dateValue = day.getDate();\n return (\n /* eslint-disable-next-line jsx-a11y/click-events-have-key-events */\n <li\n className={classNames}\n key={`${displayedYear}.${displayedMonthIndex}.day.${dayIndex}`}\n onClick={handleOnDayChange(day)}\n role=\"option\"\n aria-selected={isActive}\n data-value={day.getTime()}\n >\n <span>{dateValue}</span>\n </li>\n );\n })}\n </React.Fragment>\n ))}\n </ul>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"DatePicker.js","sourceRoot":"","sources":["../../../../src/components-react/datepicker/DatePicker.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7E,OAAO,mBAAmB,CAAC;AAE3B,SAAS,SAAS,CAAC,CAAO,EAAE,CAAO;IACjC,OAAO,CACL,CAAC;QACD,CAAC;QACD,CAAC,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,WAAW,EAAE;QACnC,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,QAAQ,EAAE;QAC7B,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,OAAO,EAAE,CAC5B,CAAC;AACJ,CAAC;AAeD;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC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AQ,EAAE,EAC9D,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAC/B,IAAI,EAAC,QAAQ,mBACE,QAAQ,gBACX,GAAG,CAAC,OAAO,EAAE;gBAEzB,kCAAO,SAAS,CAAQ,CACrB,CACN,CAAC;QACJ,CAAC,CAAC,CACa,CAClB,CAAC,CACC,CACD,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Date\n */\n\nimport * as React from \"react\";\nimport classnames from \"classnames\";\nimport { Key } from \"ts-key-enum\";\nimport { UiComponents } from \"../UiComponents\";\nimport { Icon } from \"@itwin/core-react\";\nimport { SvgChevronLeft, SvgChevronRight } from \"@itwin/itwinui-icons-react\";\nimport \"./DatePicker.scss\";\n\nfunction isSameDay(a: Date, b: Date) {\n return (\n a &&\n b &&\n a.getFullYear() === b.getFullYear() &&\n a.getMonth() === b.getMonth() &&\n a.getDate() === b.getDate()\n );\n}\n\n/**\n * Props for [[DatePicker]] component.\n * @alpha\n */\nexport interface DatePickerProps {\n /** defines both date and time */\n selected: Date;\n /** function to call when date or time has changed */\n onDateChange?: (day: Date) => void;\n /** show focus outlines, useful for keyboard navigation */\n showFocusOutline?: boolean;\n}\n\n/** DatePicker component. Show a month selector and a day calendar to select a specific date.\n * @alpha\n */\nexport function DatePicker(props: DatePickerProps) {\n const previousMonthLabel = React.useRef(\n UiComponents.localization.getLocalizedString(\n \"UiComponents:datepicker.previousMonth\"\n )\n );\n const nextMonthLabel = React.useRef(\n UiComponents.localization.getLocalizedString(\n \"UiComponents:datepicker.nextMonth\"\n )\n );\n const monthsLong = React.useRef([\n UiComponents.localization.getLocalizedString(\n \"UiComponents:month.long.january\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:month.long.february\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:month.long.march\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:month.long.april\"\n ),\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.may\"),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:month.long.june\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:month.long.july\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:month.long.august\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:month.long.september\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:month.long.october\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:month.long.november\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:month.long.december\"\n ),\n ]);\n\n const daysLong = React.useRef([\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.long.sunday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.long.monday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.long.tuesday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.long.wednesday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.long.thursday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.long.friday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.long.saturday\"\n ),\n ]);\n\n const daysShort = React.useRef([\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.short.sunday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.short.monday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.short.tuesday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.short.wednesday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.short.thursday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.short.friday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.short.saturday\"\n ),\n ]);\n\n const [selectedDay, setSelectedDay] = React.useState(\n new Date(props.selected.getTime())\n );\n const [displayedMonthIndex, setDisplayedMonthIndex] = React.useState(\n selectedDay.getMonth()\n );\n const [displayedYear, setDisplayedYear] = React.useState(\n selectedDay.getFullYear()\n );\n const [focusedDay, setFocusedDay] = React.useState(selectedDay);\n React.useEffect(() => {\n const newSelectedDay = new Date(props.selected);\n setSelectedDay(new Date(props.selected));\n setDisplayedMonthIndex(newSelectedDay.getMonth());\n setDisplayedYear(newSelectedDay.getFullYear());\n setFocusedDay(newSelectedDay);\n }, [props.selected]);\n const days = React.useMemo(() => {\n const msFirstDayOfMonth = new Date(\n displayedYear,\n displayedMonthIndex,\n 1\n ).getTime();\n let offsetToFirst = new Date(msFirstDayOfMonth).getDay();\n if (0 === offsetToFirst) offsetToFirst = 7;\n\n const daysInMonth: Date[] = [];\n // generate 6 weeks of dates\n for (let i = 0; i < 42; i++) {\n const adjustedDay = 1 + i - offsetToFirst;\n daysInMonth.push(\n new Date(displayedYear, displayedMonthIndex, adjustedDay)\n );\n }\n return daysInMonth;\n }, [displayedMonthIndex, displayedYear]);\n\n const weeks = React.useMemo(() => {\n const weeksInMonth = [];\n const weekCount = Math.ceil(days.length / 7);\n for (let i = 0; i < weekCount; i++) {\n weeksInMonth.push(days.slice(i * 7, (i + 1) * 7));\n }\n return weeksInMonth;\n }, [days]);\n\n const setMonthAndYear = React.useCallback(\n (newMonth: number, newYear: number) => {\n setDisplayedMonthIndex(newMonth);\n setDisplayedYear(newYear);\n if (\n selectedDay.getFullYear() === newYear &&\n selectedDay.getMonth() === newMonth\n ) {\n setFocusedDay(new Date(selectedDay.getTime()));\n } else {\n const newFocusDay = new Date(focusedDay.getTime());\n newFocusDay.setFullYear(newYear, newMonth, 1);\n setFocusedDay(newFocusDay);\n }\n },\n [focusedDay, selectedDay]\n );\n\n const handleMoveToPreviousMonth = React.useCallback(() => {\n const newMonth = displayedMonthIndex !== 0 ? displayedMonthIndex - 1 : 11;\n const newYear =\n displayedMonthIndex !== 0 ? displayedYear : displayedYear - 1;\n setMonthAndYear(newMonth, newYear);\n }, [displayedMonthIndex, displayedYear, setMonthAndYear]);\n\n const handleMoveToNextMonth = React.useCallback(() => {\n const newMonth = displayedMonthIndex !== 11 ? displayedMonthIndex + 1 : 0;\n const newYear =\n displayedMonthIndex !== 11 ? displayedYear : displayedYear + 1;\n setMonthAndYear(newMonth, newYear);\n }, [displayedMonthIndex, displayedYear, setMonthAndYear]);\n\n // when invoked, it will return another function which can be used for the onClick React listener.\n const handleOnDayChange = React.useCallback(\n (day: Date) => () => {\n setSelectedDay(day);\n setFocusedDay(day);\n props.onDateChange && props.onDateChange(day);\n },\n [props]\n );\n\n const handleCalendarKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLUListElement>) => {\n if (event.key === Key.ArrowDown.valueOf()) {\n const focusedDayIndex = days.findIndex((day) =>\n isSameDay(day, focusedDay)\n );\n if (focusedDayIndex + 7 > 41) setFocusedDay(days[focusedDayIndex % 7]);\n else setFocusedDay(days[focusedDayIndex + 7]);\n event.preventDefault();\n }\n if (event.key === Key.ArrowUp.valueOf()) {\n const focusedDayIndex = days.findIndex((day) =>\n isSameDay(day, focusedDay)\n );\n if (focusedDayIndex - 7 < 0)\n setFocusedDay(days[(focusedDayIndex % 7) + 35]);\n else setFocusedDay(days[focusedDayIndex - 7]);\n event.preventDefault();\n }\n if (event.key === Key.ArrowLeft.valueOf()) {\n const focusedDayIndex = days.findIndex((day) =>\n isSameDay(day, focusedDay)\n );\n // istanbul ignore else\n if (focusedDayIndex - 1 >= 0) setFocusedDay(days[focusedDayIndex - 1]);\n event.preventDefault();\n }\n if (event.key === Key.ArrowRight.valueOf()) {\n const focusedDayIndex = days.findIndex((day) =>\n isSameDay(day, focusedDay)\n );\n // istanbul ignore else\n if (focusedDayIndex + 1 <= 41) setFocusedDay(days[focusedDayIndex + 1]);\n event.preventDefault();\n }\n if (event.key === Key.Enter.valueOf() || event.key === \" \") {\n handleOnDayChange(focusedDay)(); // NB: immediately call returned handler function\n event.preventDefault();\n }\n },\n [days, focusedDay, handleOnDayChange]\n );\n\n const previousButtonClass = classnames(\n \"components-previous-month\",\n props.showFocusOutline && \"showFocusOutline\"\n );\n const nextButtonClass = classnames(\n \"components-next-month\",\n props.showFocusOutline && \"showFocusOutline\"\n );\n const calendarClass = classnames(\n \"components-date-picker-calendar-month\",\n props.showFocusOutline && \"showFocusOutline\"\n );\n\n return (\n <div className=\"components-date-picker-calendar\">\n <div className=\"components-date-picker-calendar-header-months\">\n <button\n className={previousButtonClass}\n title={previousMonthLabel.current}\n onClick={handleMoveToPreviousMonth}\n >\n <Icon iconSpec={<SvgChevronLeft />} />\n </button>\n <span className=\"components-month-year\">\n {monthsLong.current[displayedMonthIndex]} {displayedYear}\n </span>\n <button\n className={nextButtonClass}\n title={nextMonthLabel.current}\n onClick={handleMoveToNextMonth}\n >\n <Icon iconSpec={<SvgChevronRight />} />\n </button>\n </div>\n <div className=\"components-date-picker-calendar-header-weekdays\">\n {[0, 1, 2, 3, 4, 5, 6].map((dayOfWeek) => (\n <div\n key={`day-${dayOfWeek}`}\n className=\"components-date-picker-calendar-header-day-short\"\n title={daysLong.current[dayOfWeek]}\n >\n <span>{daysShort.current[dayOfWeek]}</span>\n </div>\n ))}\n </div>\n <ul\n tabIndex={0}\n onKeyDown={handleCalendarKeyDown}\n data-testid=\"components-date-picker-calendar-list\"\n className={calendarClass}\n role=\"listbox\"\n >\n {weeks.map((weekdays, weekIndex) => (\n <React.Fragment key={`week-${weekIndex}`}>\n {weekdays.map((day: Date, dayIndex: number) => {\n const isActive =\n selectedDay && day && isSameDay(selectedDay, day);\n const isFocused =\n focusedDay &&\n day &&\n isSameDay(focusedDay, day) &&\n props.showFocusOutline;\n const isCurrentMonth = day.getMonth() === displayedMonthIndex;\n const classNames = classnames(\n \"components-date-picker-calendar-day\",\n isActive && \"selected\",\n !isCurrentMonth && \"notCurrentMonth\",\n isFocused && \"focused\"\n );\n const dateValue = day.getDate();\n return (\n /* eslint-disable-next-line jsx-a11y/click-events-have-key-events */\n <li\n className={classNames}\n key={`${displayedYear}.${displayedMonthIndex}.day.${dayIndex}`}\n onClick={handleOnDayChange(day)}\n role=\"option\"\n aria-selected={isActive}\n data-value={day.getTime()}\n >\n <span>{dateValue}</span>\n </li>\n );\n })}\n </React.Fragment>\n ))}\n </ul>\n </div>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"TimeField.d.ts","sourceRoot":"","sources":["../../../../src/components-react/datepicker/TimeField.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,kBAAkB,CAAC;AAE1B;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,QAAQ,CAAC;IACf,WAAW,EAAE,WAAW,CAAC;IACzB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAwBD;;;GAGG;AACH,wBAAgB,SAAS,CAAC,EACxB,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,YAAY,GACb,EAAE,cAAc,qBAgVhB"}
1
+ {"version":3,"file":"TimeField.d.ts","sourceRoot":"","sources":["../../../../src/components-react/datepicker/TimeField.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,kBAAkB,CAAC;AAE1B;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,QAAQ,CAAC;IACf,WAAW,EAAE,WAAW,CAAC;IACzB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAwBD;;;GAGG;AACH,wBAAgB,SAAS,CAAC,EACxB,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,YAAY,GACb,EAAE,cAAc,qBA4VhB"}
@@ -6,6 +6,7 @@
6
6
  * @module Date
7
7
  */
8
8
  import * as React from "react";
9
+ import classnames from "classnames";
9
10
  import { Key } from "ts-key-enum";
10
11
  import { Input } from "@itwin/itwinui-react";
11
12
  import { UiComponents } from "../UiComponents";
@@ -127,8 +128,9 @@ export function TimeField({ time, timeDisplay, readOnly, onTimeChange, }) {
127
128
  }, [dayPeriodText, hours, timeSpec, updateTimeSpec]);
128
129
  const handleHoursOnKeyDown = React.useCallback((event) => {
129
130
  // istanbul ignore else
130
- if (event.key === Key.ArrowDown || event.key === Key.ArrowUp) {
131
- let newHours = hours + (event.key === Key.ArrowDown ? -1 : 1);
131
+ if (event.key === Key.ArrowDown.valueOf() ||
132
+ event.key === Key.ArrowUp.valueOf()) {
133
+ let newHours = hours + (event.key === Key.ArrowDown.valueOf() ? -1 : 1);
132
134
  if (newHours < 0)
133
135
  newHours = 24;
134
136
  if (newHours > 24 || (newHours > 23 && minutes + seconds > 0))
@@ -139,7 +141,7 @@ export function TimeField({ time, timeDisplay, readOnly, onTimeChange, }) {
139
141
  setDayPeriodText(newHours >= 12 ? pmLabelRef.current : amLabelRef.current);
140
142
  event.preventDefault();
141
143
  }
142
- else if (event.key === Key.Enter) {
144
+ else if (event.key === Key.Enter.valueOf()) {
143
145
  const newHours = getValidInt(hoursText, 0, 24, hours);
144
146
  setHoursText(getDisplayHours(newHours).toString().padStart(2, "0"));
145
147
  updateTimeSpec({ ...timeSpec, hours: newHours });
@@ -159,25 +161,26 @@ export function TimeField({ time, timeDisplay, readOnly, onTimeChange, }) {
159
161
  ]);
160
162
  const handleMinutesOnKeyDown = React.useCallback((event) => {
161
163
  // istanbul ignore else
162
- if (event.key === Key.ArrowDown) {
164
+ if (event.key === Key.ArrowDown.valueOf()) {
163
165
  const newMinutes = minutes === 0 ? 59 : minutes - 1;
164
166
  setMinutesText(newMinutes.toString().padStart(2, "0"));
165
167
  updateTimeSpec({ ...timeSpec, minutes: newMinutes });
166
168
  event.preventDefault();
167
169
  }
168
- else if (event.key === Key.ArrowUp) {
170
+ else if (event.key === Key.ArrowUp.valueOf()) {
169
171
  const newMinutes = minutes === 59 ? 0 : minutes + 1;
170
172
  setMinutesText(newMinutes.toString().padStart(2, "0"));
171
173
  updateTimeSpec({ ...timeSpec, minutes: newMinutes });
172
174
  event.preventDefault();
173
175
  }
174
- else if (event.key === Key.Home || event.key === Key.End) {
175
- const newMinutes = event.key === Key.Home ? 0 : 59;
176
+ else if (event.key === Key.Home.valueOf() ||
177
+ event.key === Key.End.valueOf()) {
178
+ const newMinutes = event.key === Key.Home.valueOf() ? 0 : 59;
176
179
  setMinutesText(newMinutes.toString().padStart(2, "0"));
177
180
  updateTimeSpec({ ...timeSpec, minutes: newMinutes });
178
181
  event.preventDefault();
179
182
  }
180
- else if (event.key === Key.Enter) {
183
+ else if (event.key === Key.Enter.valueOf()) {
181
184
  const newMinutes = getValidInt(minutesText, 0, 59, minutes);
182
185
  setMinutesText(newMinutes.toString().padStart(2, "0"));
183
186
  updateTimeSpec({ ...timeSpec, minutes: newMinutes });
@@ -186,25 +189,26 @@ export function TimeField({ time, timeDisplay, readOnly, onTimeChange, }) {
186
189
  }, [minutesText, minutes, timeSpec, updateTimeSpec]);
187
190
  const handleSecondsOnKeyDown = React.useCallback((event) => {
188
191
  // istanbul ignore else
189
- if (event.key === Key.ArrowDown) {
192
+ if (event.key === Key.ArrowDown.valueOf()) {
190
193
  const newSeconds = seconds === 0 ? 59 : seconds - 1;
191
194
  setSecondsText(newSeconds.toString().padStart(2, "0"));
192
195
  updateTimeSpec({ ...timeSpec, seconds: newSeconds });
193
196
  event.preventDefault();
194
197
  }
195
- else if (event.key === Key.ArrowUp) {
198
+ else if (event.key === Key.ArrowUp.valueOf()) {
196
199
  const newSeconds = seconds === 59 ? 0 : seconds + 1;
197
200
  setSecondsText(newSeconds.toString().padStart(2, "0"));
198
201
  updateTimeSpec({ ...timeSpec, seconds: newSeconds });
199
202
  event.preventDefault();
200
203
  }
201
- else if (event.key === Key.Home || event.key === Key.End) {
202
- const newSeconds = event.key === Key.Home ? 0 : 59;
204
+ else if (event.key === Key.Home.valueOf() ||
205
+ event.key === Key.End.valueOf()) {
206
+ const newSeconds = event.key === Key.Home.valueOf() ? 0 : 59;
203
207
  setSecondsText(newSeconds.toString().padStart(2, "0"));
204
208
  updateTimeSpec({ ...timeSpec, seconds: newSeconds });
205
209
  event.preventDefault();
206
210
  }
207
- else if (event.key === Key.Enter) {
211
+ else if (event.key === Key.Enter.valueOf()) {
208
212
  const newSeconds = getValidInt(secondsText, 0, 59, seconds);
209
213
  setSecondsText(newSeconds.toString().padStart(2, "0"));
210
214
  updateTimeSpec({ ...timeSpec, seconds: newSeconds });
@@ -214,21 +218,21 @@ export function TimeField({ time, timeDisplay, readOnly, onTimeChange, }) {
214
218
  const handleDayPeriodOnKeyDown = React.useCallback((event) => {
215
219
  let newPeriodText;
216
220
  // istanbul ignore else
217
- if (event.key === Key.ArrowDown ||
218
- event.key === Key.Home ||
221
+ if (event.key === Key.ArrowDown.valueOf() ||
222
+ event.key === Key.Home.valueOf() ||
219
223
  event.key === "a" ||
220
224
  event.key === "A") {
221
225
  newPeriodText = amLabelRef.current;
222
226
  event.preventDefault();
223
227
  }
224
- else if (event.key === Key.ArrowUp ||
225
- event.key === Key.End ||
228
+ else if (event.key === Key.ArrowUp.valueOf() ||
229
+ event.key === Key.End.valueOf() ||
226
230
  event.key === "p" ||
227
231
  event.key === "P") {
228
232
  newPeriodText = pmLabelRef.current;
229
233
  event.preventDefault();
230
234
  }
231
- else if (event.key === Key.Enter) {
235
+ else if (event.key === Key.Enter.valueOf()) {
232
236
  if (dayPeriodText === "AM" ||
233
237
  dayPeriodText === "am" ||
234
238
  dayPeriodText === amLabelRef.current)
@@ -253,12 +257,12 @@ export function TimeField({ time, timeDisplay, readOnly, onTimeChange, }) {
253
257
  }, [dayPeriodText, hours, timeSpec, updateTimeSpec]);
254
258
  const showSeconds = -1 !== timeDisplay.search(":ss");
255
259
  return (React.createElement("div", { "data-testid": "components-time-input", className: "components-time" },
256
- React.createElement(Input, { className: "components-time-input", onKeyDown: handleHoursOnKeyDown, onBlur: handleHoursOnBlur, onChange: handleHoursChange, value: hoursText, disabled: readOnly, size: "small" }),
260
+ React.createElement(Input, { className: classnames("components-time-input", "components-input"), onKeyDown: handleHoursOnKeyDown, onBlur: handleHoursOnBlur, onChange: handleHoursChange, value: hoursText, disabled: readOnly, size: "small" }),
257
261
  React.createElement("span", { className: "component-time-separator" }, ":"),
258
- React.createElement(Input, { className: "components-time-input", onKeyDown: handleMinutesOnKeyDown, onBlur: handleMinutesOnBlur, onChange: handleMinutesChange, value: minutesText, disabled: readOnly, size: "small" }),
262
+ React.createElement(Input, { className: classnames("components-time-input", "components-input"), onKeyDown: handleMinutesOnKeyDown, onBlur: handleMinutesOnBlur, onChange: handleMinutesChange, value: minutesText, disabled: readOnly, size: "small" }),
259
263
  showSeconds && (React.createElement(React.Fragment, null,
260
264
  React.createElement("span", { className: "component-time-separator" }, ":"),
261
- React.createElement(Input, { className: "components-time-input", onKeyDown: handleSecondsOnKeyDown, onBlur: handleSecondsOnBlur, onChange: handleSecondsChange, value: secondsText, disabled: readOnly, size: "small" }))),
262
- dayPeriodText && (React.createElement(Input, { className: "components-time-period-input", onKeyDown: handleDayPeriodOnKeyDown, onBlur: handleDayPeriodOnBlur, onChange: handleDayPeriodChange, value: dayPeriodText, disabled: readOnly, size: "small" }))));
265
+ React.createElement(Input, { className: classnames("components-time-input", "components-input"), onKeyDown: handleSecondsOnKeyDown, onBlur: handleSecondsOnBlur, onChange: handleSecondsChange, value: secondsText, disabled: readOnly, size: "small" }))),
266
+ dayPeriodText && (React.createElement(Input, { className: classnames("components-time-period-input", "components-input"), onKeyDown: handleDayPeriodOnKeyDown, onBlur: handleDayPeriodOnBlur, onChange: handleDayPeriodChange, value: dayPeriodText, disabled: readOnly, size: "small" }))));
263
267
  }
264
268
  //# sourceMappingURL=TimeField.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TimeField.js","sourceRoot":"","sources":["../../../../src/components-react/datepicker/TimeField.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,kBAAkB,CAAC;AAsB1B,SAAS,WAAW,CAClB,OAAe,EACf,GAAW,EACX,GAAW,EACX,YAAoB;IAEpB,IAAI;QACF,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACvC,IAAI,QAAQ,IAAI,GAAG,IAAI,QAAQ,IAAI,GAAG;YAAE,OAAO,QAAQ,CAAC;KACzD;IAAC,OAAO,EAAE,EAAE;QACX,uBAAuB;QACvB,OAAO,YAAY,CAAC;KACrB;IACD,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,UAAU,CAAC,CAAW,EAAE,CAAW;IAC1C,OAAO,CACL,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO,KAAK,C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,IACJ,SAAS,EAAC,uBAAuB,EACjC,SAAS,EAAE,oBAAoB,EAC/B,MAAM,EAAE,iBAAiB,EACzB,QAAQ,EAAE,iBAAiB,EAC3B,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAC,OAAO,GACZ;QACF,8BAAM,SAAS,EAAC,0BAA0B,QAAS;QACnD,oBAAC,KAAK,IACJ,SAAS,EAAC,uBAAuB,EACjC,SAAS,EAAE,sBAAsB,EACjC,MAAM,EAAE,mBAAmB,EAC3B,QAAQ,EAAE,mBAAmB,EAC7B,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAC,OAAO,GACZ;QACD,WAAW,IAAI,CACd;YACE,8BAAM,SAAS,EAAC,0BAA0B,QAAS;YACnD,oBAAC,KAAK,IACJ,SAAS,EAAC,uBAAuB,EACjC,SAAS,EAAE,sBAAsB,EACjC,MAAM,EAAE,mBAAmB,EAC3B,QAAQ,EAAE,mBAAmB,EAC7B,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAC,OAAO,GACZ,CACD,CACJ;QACA,aAAa,IAAI,CAChB,oBAAC,KAAK,IACJ,SAAS,EAAC,8BAA8B,EACxC,SAAS,EAAE,wBAAwB,EACnC,MAAM,EAAE,qBAAqB,EAC7B,QAAQ,EAAE,qBAAqB,EAC/B,KAAK,EAAE,aAAa,EACpB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAC,OAAO,GACZ,CACH,CACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Date\n */\n\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport type { TimeDisplay } from \"@itwin/appui-abstract\";\nimport { UiComponents } from \"../UiComponents\";\nimport \"./TimeField.scss\";\n\n/** Interface used to hold 24 hour time in\n * hours, minutes, and seconds.\n * @internal\n */\nexport interface TimeSpec {\n hours: number;\n minutes: number;\n seconds: number;\n}\n\n/** Interface for props used by [[TimeField]] component.\n * @internal\n */\nexport interface TimeFieldProps {\n time: TimeSpec;\n timeDisplay: TimeDisplay;\n onTimeChange?: (time: TimeSpec) => void;\n readOnly?: boolean;\n}\n\nfunction getValidInt(\n intText: string,\n min: number,\n max: number,\n defaultValue: number\n) {\n try {\n const newValue = parseInt(intText, 10);\n if (newValue >= min && newValue <= max) return newValue;\n } catch (_e) {\n // istanbul ignore next\n return defaultValue;\n }\n return defaultValue;\n}\n\nfunction isSameTime(a: TimeSpec, b: TimeSpec) {\n return (\n a.hours === b.hours && a.minutes === b.minutes && a.seconds === b.seconds\n );\n}\n\n/** Field used to set the Hour:Minutes:Seconds in the [[DatePicker]] Popup panel. The user may key-in the value or use up/down keys to\n * change the time.\n * @internal\n */\nexport function TimeField({\n time,\n timeDisplay,\n readOnly,\n onTimeChange,\n}: TimeFieldProps) {\n const initialDateRef = React.useRef(time);\n const amLabelRef = React.useRef(\n UiComponents.translate(\"timepicker.day-period-am\")\n );\n const pmLabelRef = React.useRef(\n UiComponents.translate(\"timepicker.day-period-pm\")\n );\n const [timeSpec, setTimeSpec] = React.useState(time);\n const { hours, minutes, seconds } = timeSpec;\n const showDayPeriod = -1 !== (timeDisplay as string).search(\"aa\");\n\n const getDisplayHours = React.useCallback(\n (timeHours: number) => {\n if (!showDayPeriod) {\n return timeHours;\n }\n const outHours =\n 0 === timeHours ? 12 : timeHours > 12 ? timeHours - 12 : timeHours;\n return outHours;\n },\n [showDayPeriod]\n );\n\n // See if new initialDate props have changed since component mounted\n React.useEffect(() => {\n if (!isSameTime(time, initialDateRef.current)) {\n setTimeSpec(time);\n initialDateRef.current = time;\n }\n }, [time]);\n\n const displayHour = getDisplayHours(hours);\n const [dayPeriodText, setDayPeriodText] = React.useState(\n showDayPeriod\n ? hours >= 12\n ? pmLabelRef.current\n : amLabelRef.current\n : undefined\n );\n const [hoursText, setHoursText] = React.useState(\n displayHour.toString().padStart(2, \"0\")\n );\n const [minutesText, setMinutesText] = React.useState(\n minutes.toString().padStart(2, \"0\")\n );\n const [secondsText, setSecondsText] = React.useState(\n seconds.toString().padStart(2, \"0\")\n );\n\n const updateTimeSpec = React.useCallback(\n (newTime: TimeSpec) => {\n if (\n newTime.hours !== timeSpec.hours ||\n newTime.minutes !== timeSpec.minutes ||\n newTime.seconds !== timeSpec.seconds\n ) {\n setTimeSpec(newTime);\n onTimeChange && onTimeChange(newTime);\n }\n },\n [onTimeChange, timeSpec.hours, timeSpec.minutes, timeSpec.seconds]\n );\n\n const handleHoursChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n setHoursText(event.currentTarget.value);\n },\n []\n );\n\n const handleMinutesChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n setMinutesText(event.currentTarget.value);\n },\n []\n );\n const handleSecondsChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n setSecondsText(event.currentTarget.value);\n },\n []\n );\n const handleDayPeriodChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n setDayPeriodText(event.currentTarget.value);\n },\n []\n );\n\n const handleHoursOnBlur = React.useCallback(() => {\n const newHours = getValidInt(hoursText, 0, 24, hours);\n setHoursText(getDisplayHours(newHours).toString().padStart(2, \"0\"));\n updateTimeSpec({ ...timeSpec, hours: newHours });\n showDayPeriod &&\n setDayPeriodText(\n newHours >= 12 ? pmLabelRef.current : amLabelRef.current\n );\n }, [\n getDisplayHours,\n hours,\n hoursText,\n showDayPeriod,\n timeSpec,\n updateTimeSpec,\n ]);\n const handleMinutesOnBlur = React.useCallback(() => {\n const newMinutes = getValidInt(minutesText, 0, 59, minutes);\n setMinutesText(newMinutes.toString().padStart(2, \"0\"));\n updateTimeSpec({ ...timeSpec, minutes: newMinutes });\n }, [minutes, minutesText, timeSpec, updateTimeSpec]);\n const handleSecondsOnBlur = React.useCallback(() => {\n const newSeconds = getValidInt(secondsText, 0, 59, seconds);\n setSecondsText(newSeconds.toString().padStart(2, \"0\"));\n updateTimeSpec({ ...timeSpec, seconds: newSeconds });\n }, [seconds, secondsText, timeSpec, updateTimeSpec]);\n const handleDayPeriodOnBlur = React.useCallback(() => {\n let newPeriodText: string | undefined;\n // istanbul ignore else\n if (\n dayPeriodText === \"AM\" ||\n dayPeriodText === \"am\" ||\n dayPeriodText === amLabelRef.current\n )\n newPeriodText = amLabelRef.current;\n else if (\n dayPeriodText === \"PM\" ||\n dayPeriodText === \"pm\" ||\n dayPeriodText === pmLabelRef.current\n )\n newPeriodText = pmLabelRef.current;\n\n // istanbul ignore else\n if (undefined !== newPeriodText) {\n setDayPeriodText(newPeriodText);\n if (newPeriodText === amLabelRef.current && hours > 12) {\n updateTimeSpec({ ...timeSpec, hours: hours - 12 });\n } else if (newPeriodText === pmLabelRef.current && hours <= 11) {\n updateTimeSpec({ ...timeSpec, hours: hours + 12 });\n }\n }\n }, [dayPeriodText, hours, timeSpec, updateTimeSpec]);\n\n const handleHoursOnKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n // istanbul ignore else\n if (event.key === Key.ArrowDown || event.key === Key.ArrowUp) {\n let newHours = hours + (event.key === Key.ArrowDown ? -1 : 1);\n if (newHours < 0) newHours = 24;\n if (newHours > 24 || (newHours > 23 && minutes + seconds > 0))\n newHours = 0;\n setHoursText(getDisplayHours(newHours).toString().padStart(2, \"0\"));\n updateTimeSpec({ ...timeSpec, hours: newHours });\n showDayPeriod &&\n setDayPeriodText(\n newHours >= 12 ? pmLabelRef.current : amLabelRef.current\n );\n event.preventDefault();\n } else if (event.key === Key.Enter) {\n const newHours = getValidInt(hoursText, 0, 24, hours);\n setHoursText(getDisplayHours(newHours).toString().padStart(2, \"0\"));\n updateTimeSpec({ ...timeSpec, hours: newHours });\n showDayPeriod &&\n setDayPeriodText(\n newHours >= 12 ? pmLabelRef.current : amLabelRef.current\n );\n event.preventDefault();\n }\n },\n [\n getDisplayHours,\n hours,\n hoursText,\n minutes,\n seconds,\n showDayPeriod,\n timeSpec,\n updateTimeSpec,\n ]\n );\n\n const handleMinutesOnKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n // istanbul ignore else\n if (event.key === Key.ArrowDown) {\n const newMinutes = minutes === 0 ? 59 : minutes - 1;\n setMinutesText(newMinutes.toString().padStart(2, \"0\"));\n updateTimeSpec({ ...timeSpec, minutes: newMinutes });\n event.preventDefault();\n } else if (event.key === Key.ArrowUp) {\n const newMinutes = minutes === 59 ? 0 : minutes + 1;\n setMinutesText(newMinutes.toString().padStart(2, \"0\"));\n updateTimeSpec({ ...timeSpec, minutes: newMinutes });\n event.preventDefault();\n } else if (event.key === Key.Home || event.key === Key.End) {\n const newMinutes = event.key === Key.Home ? 0 : 59;\n setMinutesText(newMinutes.toString().padStart(2, \"0\"));\n updateTimeSpec({ ...timeSpec, minutes: newMinutes });\n event.preventDefault();\n } else if (event.key === Key.Enter) {\n const newMinutes = getValidInt(minutesText, 0, 59, minutes);\n setMinutesText(newMinutes.toString().padStart(2, \"0\"));\n updateTimeSpec({ ...timeSpec, minutes: newMinutes });\n event.preventDefault();\n }\n },\n [minutesText, minutes, timeSpec, updateTimeSpec]\n );\n\n const handleSecondsOnKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n // istanbul ignore else\n if (event.key === Key.ArrowDown) {\n const newSeconds = seconds === 0 ? 59 : seconds - 1;\n setSecondsText(newSeconds.toString().padStart(2, \"0\"));\n updateTimeSpec({ ...timeSpec, seconds: newSeconds });\n event.preventDefault();\n } else if (event.key === Key.ArrowUp) {\n const newSeconds = seconds === 59 ? 0 : seconds + 1;\n setSecondsText(newSeconds.toString().padStart(2, \"0\"));\n updateTimeSpec({ ...timeSpec, seconds: newSeconds });\n event.preventDefault();\n } else if (event.key === Key.Home || event.key === Key.End) {\n const newSeconds = event.key === Key.Home ? 0 : 59;\n setSecondsText(newSeconds.toString().padStart(2, \"0\"));\n updateTimeSpec({ ...timeSpec, seconds: newSeconds });\n event.preventDefault();\n } else if (event.key === Key.Enter) {\n const newSeconds = getValidInt(secondsText, 0, 59, seconds);\n setSecondsText(newSeconds.toString().padStart(2, \"0\"));\n updateTimeSpec({ ...timeSpec, seconds: newSeconds });\n event.preventDefault();\n }\n },\n [seconds, secondsText, timeSpec, updateTimeSpec]\n );\n\n const handleDayPeriodOnKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n let newPeriodText: string | undefined;\n // istanbul ignore else\n if (\n event.key === Key.ArrowDown ||\n event.key === Key.Home ||\n event.key === \"a\" ||\n event.key === \"A\"\n ) {\n newPeriodText = amLabelRef.current;\n event.preventDefault();\n } else if (\n event.key === Key.ArrowUp ||\n event.key === Key.End ||\n event.key === \"p\" ||\n event.key === \"P\"\n ) {\n newPeriodText = pmLabelRef.current;\n event.preventDefault();\n } else if (event.key === Key.Enter) {\n if (\n dayPeriodText === \"AM\" ||\n dayPeriodText === \"am\" ||\n dayPeriodText === amLabelRef.current\n )\n newPeriodText = amLabelRef.current;\n else if (\n dayPeriodText === \"PM\" ||\n dayPeriodText === \"pm\" ||\n dayPeriodText === pmLabelRef.current\n )\n newPeriodText = pmLabelRef.current;\n event.preventDefault();\n }\n // istanbul ignore else\n if (undefined !== newPeriodText) {\n setDayPeriodText(newPeriodText);\n /* istanbul ignore else */\n if (newPeriodText === amLabelRef.current && hours > 12) {\n updateTimeSpec({ ...timeSpec, hours: hours - 12 });\n } else if (newPeriodText === pmLabelRef.current && hours <= 11) {\n updateTimeSpec({ ...timeSpec, hours: hours + 12 });\n }\n }\n },\n [dayPeriodText, hours, timeSpec, updateTimeSpec]\n );\n\n const showSeconds = -1 !== (timeDisplay as string).search(\":ss\");\n\n return (\n <div data-testid=\"components-time-input\" className=\"components-time\">\n <Input\n className=\"components-time-input\"\n onKeyDown={handleHoursOnKeyDown}\n onBlur={handleHoursOnBlur}\n onChange={handleHoursChange}\n value={hoursText}\n disabled={readOnly}\n size=\"small\"\n />\n <span className=\"component-time-separator\">:</span>\n <Input\n className=\"components-time-input\"\n onKeyDown={handleMinutesOnKeyDown}\n onBlur={handleMinutesOnBlur}\n onChange={handleMinutesChange}\n value={minutesText}\n disabled={readOnly}\n size=\"small\"\n />\n {showSeconds && (\n <>\n <span className=\"component-time-separator\">:</span>\n <Input\n className=\"components-time-input\"\n onKeyDown={handleSecondsOnKeyDown}\n onBlur={handleSecondsOnBlur}\n onChange={handleSecondsChange}\n value={secondsText}\n disabled={readOnly}\n size=\"small\"\n />\n </>\n )}\n {dayPeriodText && (\n <Input\n className=\"components-time-period-input\"\n onKeyDown={handleDayPeriodOnKeyDown}\n onBlur={handleDayPeriodOnBlur}\n onChange={handleDayPeriodChange}\n value={dayPeriodText}\n disabled={readOnly}\n size=\"small\"\n />\n )}\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"TimeField.js","sourceRoot":"","sources":["../../../../src/components-react/datepicker/TimeField.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,kBAAkB,CAAC;AAsB1B,SAAS,WAAW,CAClB,OAAe,EACf,GAAW,EACX,GAAW,EACX,YAAoB;IAEpB,IAAI;QACF,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACvC,IAAI,QAAQ,IAAI,GAAG,IAAI,QAAQ,IAAI,GAAG;YAAE,OAAO,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A0B,QAAS;YACnD,oBAAC,KAAK,IACJ,SAAS,EAAE,UAAU,CAAC,uBAAuB,EAAE,kBAAkB,CAAC,EAClE,SAAS,EAAE,sBAAsB,EACjC,MAAM,EAAE,mBAAmB,EAC3B,QAAQ,EAAE,mBAAmB,EAC7B,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAC,OAAO,GACZ,CACD,CACJ;QACA,aAAa,IAAI,CAChB,oBAAC,KAAK,IACJ,SAAS,EAAE,UAAU,CACnB,8BAA8B,EAC9B,kBAAkB,CACnB,EACD,SAAS,EAAE,wBAAwB,EACnC,MAAM,EAAE,qBAAqB,EAC7B,QAAQ,EAAE,qBAAqB,EAC/B,KAAK,EAAE,aAAa,EACpB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAC,OAAO,GACZ,CACH,CACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Date\n */\n\nimport * as React from \"react\";\nimport classnames from \"classnames\";\nimport { Key } from \"ts-key-enum\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport type { TimeDisplay } from \"@itwin/appui-abstract\";\nimport { UiComponents } from \"../UiComponents\";\nimport \"./TimeField.scss\";\n\n/** Interface used to hold 24 hour time in\n * hours, minutes, and seconds.\n * @internal\n */\nexport interface TimeSpec {\n hours: number;\n minutes: number;\n seconds: number;\n}\n\n/** Interface for props used by [[TimeField]] component.\n * @internal\n */\nexport interface TimeFieldProps {\n time: TimeSpec;\n timeDisplay: TimeDisplay;\n onTimeChange?: (time: TimeSpec) => void;\n readOnly?: boolean;\n}\n\nfunction getValidInt(\n intText: string,\n min: number,\n max: number,\n defaultValue: number\n) {\n try {\n const newValue = parseInt(intText, 10);\n if (newValue >= min && newValue <= max) return newValue;\n } catch (_e) {\n // istanbul ignore next\n return defaultValue;\n }\n return defaultValue;\n}\n\nfunction isSameTime(a: TimeSpec, b: TimeSpec) {\n return (\n a.hours === b.hours && a.minutes === b.minutes && a.seconds === b.seconds\n );\n}\n\n/** Field used to set the Hour:Minutes:Seconds in the [[DatePicker]] Popup panel. The user may key-in the value or use up/down keys to\n * change the time.\n * @internal\n */\nexport function TimeField({\n time,\n timeDisplay,\n readOnly,\n onTimeChange,\n}: TimeFieldProps) {\n const initialDateRef = React.useRef(time);\n const amLabelRef = React.useRef(\n UiComponents.translate(\"timepicker.day-period-am\")\n );\n const pmLabelRef = React.useRef(\n UiComponents.translate(\"timepicker.day-period-pm\")\n );\n const [timeSpec, setTimeSpec] = React.useState(time);\n const { hours, minutes, seconds } = timeSpec;\n const showDayPeriod = -1 !== (timeDisplay as string).search(\"aa\");\n\n const getDisplayHours = React.useCallback(\n (timeHours: number) => {\n if (!showDayPeriod) {\n return timeHours;\n }\n const outHours =\n 0 === timeHours ? 12 : timeHours > 12 ? timeHours - 12 : timeHours;\n return outHours;\n },\n [showDayPeriod]\n );\n\n // See if new initialDate props have changed since component mounted\n React.useEffect(() => {\n if (!isSameTime(time, initialDateRef.current)) {\n setTimeSpec(time);\n initialDateRef.current = time;\n }\n }, [time]);\n\n const displayHour = getDisplayHours(hours);\n const [dayPeriodText, setDayPeriodText] = React.useState(\n showDayPeriod\n ? hours >= 12\n ? pmLabelRef.current\n : amLabelRef.current\n : undefined\n );\n const [hoursText, setHoursText] = React.useState(\n displayHour.toString().padStart(2, \"0\")\n );\n const [minutesText, setMinutesText] = React.useState(\n minutes.toString().padStart(2, \"0\")\n );\n const [secondsText, setSecondsText] = React.useState(\n seconds.toString().padStart(2, \"0\")\n );\n\n const updateTimeSpec = React.useCallback(\n (newTime: TimeSpec) => {\n if (\n newTime.hours !== timeSpec.hours ||\n newTime.minutes !== timeSpec.minutes ||\n newTime.seconds !== timeSpec.seconds\n ) {\n setTimeSpec(newTime);\n onTimeChange && onTimeChange(newTime);\n }\n },\n [onTimeChange, timeSpec.hours, timeSpec.minutes, timeSpec.seconds]\n );\n\n const handleHoursChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n setHoursText(event.currentTarget.value);\n },\n []\n );\n\n const handleMinutesChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n setMinutesText(event.currentTarget.value);\n },\n []\n );\n const handleSecondsChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n setSecondsText(event.currentTarget.value);\n },\n []\n );\n const handleDayPeriodChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n setDayPeriodText(event.currentTarget.value);\n },\n []\n );\n\n const handleHoursOnBlur = React.useCallback(() => {\n const newHours = getValidInt(hoursText, 0, 24, hours);\n setHoursText(getDisplayHours(newHours).toString().padStart(2, \"0\"));\n updateTimeSpec({ ...timeSpec, hours: newHours });\n showDayPeriod &&\n setDayPeriodText(\n newHours >= 12 ? pmLabelRef.current : amLabelRef.current\n );\n }, [\n getDisplayHours,\n hours,\n hoursText,\n showDayPeriod,\n timeSpec,\n updateTimeSpec,\n ]);\n const handleMinutesOnBlur = React.useCallback(() => {\n const newMinutes = getValidInt(minutesText, 0, 59, minutes);\n setMinutesText(newMinutes.toString().padStart(2, \"0\"));\n updateTimeSpec({ ...timeSpec, minutes: newMinutes });\n }, [minutes, minutesText, timeSpec, updateTimeSpec]);\n const handleSecondsOnBlur = React.useCallback(() => {\n const newSeconds = getValidInt(secondsText, 0, 59, seconds);\n setSecondsText(newSeconds.toString().padStart(2, \"0\"));\n updateTimeSpec({ ...timeSpec, seconds: newSeconds });\n }, [seconds, secondsText, timeSpec, updateTimeSpec]);\n const handleDayPeriodOnBlur = React.useCallback(() => {\n let newPeriodText: string | undefined;\n // istanbul ignore else\n if (\n dayPeriodText === \"AM\" ||\n dayPeriodText === \"am\" ||\n dayPeriodText === amLabelRef.current\n )\n newPeriodText = amLabelRef.current;\n else if (\n dayPeriodText === \"PM\" ||\n dayPeriodText === \"pm\" ||\n dayPeriodText === pmLabelRef.current\n )\n newPeriodText = pmLabelRef.current;\n\n // istanbul ignore else\n if (undefined !== newPeriodText) {\n setDayPeriodText(newPeriodText);\n if (newPeriodText === amLabelRef.current && hours > 12) {\n updateTimeSpec({ ...timeSpec, hours: hours - 12 });\n } else if (newPeriodText === pmLabelRef.current && hours <= 11) {\n updateTimeSpec({ ...timeSpec, hours: hours + 12 });\n }\n }\n }, [dayPeriodText, hours, timeSpec, updateTimeSpec]);\n\n const handleHoursOnKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n // istanbul ignore else\n if (\n event.key === Key.ArrowDown.valueOf() ||\n event.key === Key.ArrowUp.valueOf()\n ) {\n let newHours = hours + (event.key === Key.ArrowDown.valueOf() ? -1 : 1);\n if (newHours < 0) newHours = 24;\n if (newHours > 24 || (newHours > 23 && minutes + seconds > 0))\n newHours = 0;\n setHoursText(getDisplayHours(newHours).toString().padStart(2, \"0\"));\n updateTimeSpec({ ...timeSpec, hours: newHours });\n showDayPeriod &&\n setDayPeriodText(\n newHours >= 12 ? pmLabelRef.current : amLabelRef.current\n );\n event.preventDefault();\n } else if (event.key === Key.Enter.valueOf()) {\n const newHours = getValidInt(hoursText, 0, 24, hours);\n setHoursText(getDisplayHours(newHours).toString().padStart(2, \"0\"));\n updateTimeSpec({ ...timeSpec, hours: newHours });\n showDayPeriod &&\n setDayPeriodText(\n newHours >= 12 ? pmLabelRef.current : amLabelRef.current\n );\n event.preventDefault();\n }\n },\n [\n getDisplayHours,\n hours,\n hoursText,\n minutes,\n seconds,\n showDayPeriod,\n timeSpec,\n updateTimeSpec,\n ]\n );\n\n const handleMinutesOnKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n // istanbul ignore else\n if (event.key === Key.ArrowDown.valueOf()) {\n const newMinutes = minutes === 0 ? 59 : minutes - 1;\n setMinutesText(newMinutes.toString().padStart(2, \"0\"));\n updateTimeSpec({ ...timeSpec, minutes: newMinutes });\n event.preventDefault();\n } else if (event.key === Key.ArrowUp.valueOf()) {\n const newMinutes = minutes === 59 ? 0 : minutes + 1;\n setMinutesText(newMinutes.toString().padStart(2, \"0\"));\n updateTimeSpec({ ...timeSpec, minutes: newMinutes });\n event.preventDefault();\n } else if (\n event.key === Key.Home.valueOf() ||\n event.key === Key.End.valueOf()\n ) {\n const newMinutes = event.key === Key.Home.valueOf() ? 0 : 59;\n setMinutesText(newMinutes.toString().padStart(2, \"0\"));\n updateTimeSpec({ ...timeSpec, minutes: newMinutes });\n event.preventDefault();\n } else if (event.key === Key.Enter.valueOf()) {\n const newMinutes = getValidInt(minutesText, 0, 59, minutes);\n setMinutesText(newMinutes.toString().padStart(2, \"0\"));\n updateTimeSpec({ ...timeSpec, minutes: newMinutes });\n event.preventDefault();\n }\n },\n [minutesText, minutes, timeSpec, updateTimeSpec]\n );\n\n const handleSecondsOnKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n // istanbul ignore else\n if (event.key === Key.ArrowDown.valueOf()) {\n const newSeconds = seconds === 0 ? 59 : seconds - 1;\n setSecondsText(newSeconds.toString().padStart(2, \"0\"));\n updateTimeSpec({ ...timeSpec, seconds: newSeconds });\n event.preventDefault();\n } else if (event.key === Key.ArrowUp.valueOf()) {\n const newSeconds = seconds === 59 ? 0 : seconds + 1;\n setSecondsText(newSeconds.toString().padStart(2, \"0\"));\n updateTimeSpec({ ...timeSpec, seconds: newSeconds });\n event.preventDefault();\n } else if (\n event.key === Key.Home.valueOf() ||\n event.key === Key.End.valueOf()\n ) {\n const newSeconds = event.key === Key.Home.valueOf() ? 0 : 59;\n setSecondsText(newSeconds.toString().padStart(2, \"0\"));\n updateTimeSpec({ ...timeSpec, seconds: newSeconds });\n event.preventDefault();\n } else if (event.key === Key.Enter.valueOf()) {\n const newSeconds = getValidInt(secondsText, 0, 59, seconds);\n setSecondsText(newSeconds.toString().padStart(2, \"0\"));\n updateTimeSpec({ ...timeSpec, seconds: newSeconds });\n event.preventDefault();\n }\n },\n [seconds, secondsText, timeSpec, updateTimeSpec]\n );\n\n const handleDayPeriodOnKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n let newPeriodText: string | undefined;\n // istanbul ignore else\n if (\n event.key === Key.ArrowDown.valueOf() ||\n event.key === Key.Home.valueOf() ||\n event.key === \"a\" ||\n event.key === \"A\"\n ) {\n newPeriodText = amLabelRef.current;\n event.preventDefault();\n } else if (\n event.key === Key.ArrowUp.valueOf() ||\n event.key === Key.End.valueOf() ||\n event.key === \"p\" ||\n event.key === \"P\"\n ) {\n newPeriodText = pmLabelRef.current;\n event.preventDefault();\n } else if (event.key === Key.Enter.valueOf()) {\n if (\n dayPeriodText === \"AM\" ||\n dayPeriodText === \"am\" ||\n dayPeriodText === amLabelRef.current\n )\n newPeriodText = amLabelRef.current;\n else if (\n dayPeriodText === \"PM\" ||\n dayPeriodText === \"pm\" ||\n dayPeriodText === pmLabelRef.current\n )\n newPeriodText = pmLabelRef.current;\n event.preventDefault();\n }\n // istanbul ignore else\n if (undefined !== newPeriodText) {\n setDayPeriodText(newPeriodText);\n /* istanbul ignore else */\n if (newPeriodText === amLabelRef.current && hours > 12) {\n updateTimeSpec({ ...timeSpec, hours: hours - 12 });\n } else if (newPeriodText === pmLabelRef.current && hours <= 11) {\n updateTimeSpec({ ...timeSpec, hours: hours + 12 });\n }\n }\n },\n [dayPeriodText, hours, timeSpec, updateTimeSpec]\n );\n\n const showSeconds = -1 !== (timeDisplay as string).search(\":ss\");\n\n return (\n <div data-testid=\"components-time-input\" className=\"components-time\">\n <Input\n className={classnames(\"components-time-input\", \"components-input\")}\n onKeyDown={handleHoursOnKeyDown}\n onBlur={handleHoursOnBlur}\n onChange={handleHoursChange}\n value={hoursText}\n disabled={readOnly}\n size=\"small\"\n />\n <span className=\"component-time-separator\">:</span>\n <Input\n className={classnames(\"components-time-input\", \"components-input\")}\n onKeyDown={handleMinutesOnKeyDown}\n onBlur={handleMinutesOnBlur}\n onChange={handleMinutesChange}\n value={minutesText}\n disabled={readOnly}\n size=\"small\"\n />\n {showSeconds && (\n <>\n <span className=\"component-time-separator\">:</span>\n <Input\n className={classnames(\"components-time-input\", \"components-input\")}\n onKeyDown={handleSecondsOnKeyDown}\n onBlur={handleSecondsOnBlur}\n onChange={handleSecondsChange}\n value={secondsText}\n disabled={readOnly}\n size=\"small\"\n />\n </>\n )}\n {dayPeriodText && (\n <Input\n className={classnames(\n \"components-time-period-input\",\n \"components-input\"\n )}\n onKeyDown={handleDayPeriodOnKeyDown}\n onBlur={handleDayPeriodOnBlur}\n onChange={handleDayPeriodChange}\n value={dayPeriodText}\n disabled={readOnly}\n size=\"small\"\n />\n )}\n </div>\n );\n}\n"]}
@@ -22,16 +22,13 @@
22
22
 
23
23
  .components-time-input {
24
24
  box-sizing: border-box;
25
- width: 2em;
25
+ width: 2.5em;
26
26
  text-align: center;
27
27
  border: none;
28
28
  box-shadow: none;
29
29
  margin: 0;
30
-
31
- &.iui-input {
32
- padding-left: 0;
33
- padding-right: 0;
34
- }
30
+ padding-left: 0;
31
+ padding-right: 0;
35
32
 
36
33
  &:focus {
37
34
  outline: 0px;
@@ -70,7 +67,7 @@
70
67
  padding: 0 1px;
71
68
  }
72
69
 
73
- .iui-input {
70
+ .components-input {
74
71
  padding: $uicore-iui-input-padding;
75
72
  }
76
73
  }
@@ -105,7 +105,7 @@ export class BooleanEditor extends React.PureComponent {
105
105
  const className = classnames("components-cell-editor", "components-boolean-editor", this.props.className);
106
106
  const checked = this.state.checkboxValue;
107
107
  const isDisabled = !!this.state.isDisabled;
108
- return (React.createElement(Checkbox, { ref: this._inputElement, onBlur: this.props.onBlur, className: className, style: this.props.style, checked: checked, onChange: this._updateCheckboxValue, setFocus: this.props.setFocus, disabled: isDisabled, "data-testid": "components-checkbox-editor" }));
108
+ return (React.createElement(Checkbox, { ref: this._inputElement, onBlur: this.props.onBlur, className: className, style: this.props.style, checked: checked, onChange: this._updateCheckboxValue, autoFocus: this.props.setFocus, disabled: isDisabled, "data-testid": "components-checkbox-editor" }));
109
109
  }
110
110
  }
111
111
  /** Boolean Property Editor registered for the "bool" and "boolean" type names.
@@ -1 +1 @@
1
- {"version":3,"file":"BooleanEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/BooleanEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,sBAAsB,CAAC;AAC9B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EACL,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AAQjC;;GAEG;AACH,MAAM,OAAO,aACX,SAAQ,KAAK,CAAC,aAAsD;IADtE;;QAIU,eAAU,GAAG,KAAK,CAAC;QACnB,kBAAa,GAAG,KAAK,CAAC,SAAS,EAAoB,CAAC;QAE5D,gBAAgB;QACS,UAAK,GAAiC;YAC7D,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,KAAK;SAClB,CAAC;QA8BM,yBAAoB,GAAG,CAAC,CAAsC,EAAE,EAAE;YACxE,uBAAuB;YACvB,IAAI,IAAI,CAAC,UAAU,EAAE;gBACnB,MAAM,aAAa,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;gBAEzC,IAAI,CAAC,QAAQ,CACX;oBACE,aAAa;iBACd,EACD,GAAG,EAAE;oBACH,uBAAuB;oBACvB,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;wBACpD,MAAM,aAAa,GAAG,IAAI,CAAC,oBAAoB,EAAE,CAAC;wBAClD,uBAAuB;wBACvB,IAAI,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,CAAC;IACJ,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,qBAAsB,SAAQ,kBAAkB;IAC3D,uBAAuB;IACvB,IAAoB,oBAAoB;QACtC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAW,SAAS;QAClB,OAAO,oBAAC,aAAa,OAAG,CAAC;IAC3B,CAAC;CACF;AAED,qBAAqB,CAAC,cAAc,CAClC,iBAAiB,CAAC,IAAI,EACtB,qBAAqB,CACtB,CAAC;AACF,qBAAqB,CAAC,cAAc,CAClC,iBAAiB,CAAC,OAAO,EACzB,qBAAqB,CACtB,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 \"./BooleanEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { PropertyValue } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat, StandardTypeNames } from \"@itwin/appui-abstract\";\nimport { Checkbox } from \"@itwin/itwinui-react\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport {\n PropertyEditorBase,\n PropertyEditorManager,\n} from \"./PropertyEditorManager\";\n\n/** @internal */\ninterface BooleanEditorState {\n checkboxValue: boolean;\n isDisabled?: boolean;\n}\n\n/** BooleanEditor React component that is a property editor with checkbox input\n * @public\n */\nexport class BooleanEditor\n extends React.PureComponent<PropertyEditorProps, BooleanEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _inputElement = React.createRef<HTMLInputElement>();\n\n /** @internal */\n public override readonly state: Readonly<BooleanEditorState> = {\n checkboxValue: false,\n isDisabled: false,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n return this.getPropertyValueSync();\n }\n\n private getPropertyValueSync(): 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.checkboxValue,\n displayValue: \"\",\n };\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 _updateCheckboxValue = (e: React.ChangeEvent<HTMLInputElement>) => {\n // istanbul ignore else\n if (this._isMounted) {\n const checkboxValue = !!e.target.checked;\n\n this.setState(\n {\n checkboxValue,\n },\n () => {\n // istanbul ignore else\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = this.getPropertyValueSync();\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 }\n };\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n 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 this.setStateFromProps();\n }\n }\n\n private setStateFromProps() {\n const { propertyRecord } = this.props;\n let checkboxValue = false;\n let isDisabled = false;\n\n // istanbul ignore else\n if (\n propertyRecord &&\n propertyRecord.value.valueFormat === PropertyValueFormat.Primitive\n ) {\n const primitiveValue = propertyRecord.value.value;\n checkboxValue = primitiveValue as boolean;\n }\n\n // istanbul ignore else\n if (propertyRecord && propertyRecord.isDisabled)\n isDisabled = propertyRecord.isDisabled;\n\n // istanbul ignore else\n if (this._isMounted) this.setState({ checkboxValue, isDisabled });\n }\n\n /** @internal */\n public override render() {\n const className = classnames(\n \"components-cell-editor\",\n \"components-boolean-editor\",\n this.props.className\n );\n const checked = this.state.checkboxValue;\n const isDisabled = !!this.state.isDisabled;\n\n return (\n <Checkbox\n ref={this._inputElement}\n onBlur={this.props.onBlur}\n className={className}\n style={this.props.style}\n checked={checked}\n onChange={this._updateCheckboxValue}\n setFocus={this.props.setFocus}\n disabled={isDisabled}\n data-testid=\"components-checkbox-editor\"\n ></Checkbox>\n );\n }\n}\n\n/** Boolean Property Editor registered for the \"bool\" and \"boolean\" type names.\n * It uses the [[BooleanEditor]] React component.\n * @public\n */\nexport class BooleanPropertyEditor extends PropertyEditorBase {\n // istanbul ignore next\n public override get containerHandlesBlur(): boolean {\n return false;\n }\n\n public get reactNode(): React.ReactNode {\n return <BooleanEditor />;\n }\n}\n\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Bool,\n BooleanPropertyEditor\n);\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Boolean,\n BooleanPropertyEditor\n);\n"]}
1
+ {"version":3,"file":"BooleanEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/BooleanEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,sBAAsB,CAAC;AAC9B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EACL,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AAQjC;;GAEG;AACH,MAAM,OAAO,aACX,SAAQ,KAAK,CAAC,aAAsD;IADtE;;QAIU,eAAU,GAAG,KAAK,CAAC;QACnB,kBAAa,GAAG,KAAK,CAAC,SAAS,EAAoB,CAAC;QAE5D,gBAAgB;QACS,UAAK,GAAiC;YAC7D,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,KAAK;SAClB,CAAC;QA8BM,yBAAoB,GAAG,CAAC,CAAsC,EAAE,EAAE;YACxE,uBAAuB;YACvB,IAAI,IAAI,CAAC,UAA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,oBAAC,QAAQ,IACP,GAAG,EAAE,IAAI,CAAC,aAAa,EACvB,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EACzB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,IAAI,CAAC,oBAAoB,EACnC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAC9B,QAAQ,EAAE,UAAU,iBACR,4BAA4B,GAC9B,CACb,CAAC;IACJ,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,qBAAsB,SAAQ,kBAAkB;IAC3D,uBAAuB;IACvB,IAAoB,oBAAoB;QACtC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAW,SAAS;QAClB,OAAO,oBAAC,aAAa,OAAG,CAAC;IAC3B,CAAC;CACF;AAED,qBAAqB,CAAC,cAAc,CAClC,iBAAiB,CAAC,IAAI,EACtB,qBAAqB,CACtB,CAAC;AACF,qBAAqB,CAAC,cAAc,CAClC,iBAAiB,CAAC,OAAO,EACzB,qBAAqB,CACtB,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 \"./BooleanEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { PropertyValue } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat, StandardTypeNames } from \"@itwin/appui-abstract\";\nimport { Checkbox } from \"@itwin/itwinui-react\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport {\n PropertyEditorBase,\n PropertyEditorManager,\n} from \"./PropertyEditorManager\";\n\n/** @internal */\ninterface BooleanEditorState {\n checkboxValue: boolean;\n isDisabled?: boolean;\n}\n\n/** BooleanEditor React component that is a property editor with checkbox input\n * @public\n */\nexport class BooleanEditor\n extends React.PureComponent<PropertyEditorProps, BooleanEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _inputElement = React.createRef<HTMLInputElement>();\n\n /** @internal */\n public override readonly state: Readonly<BooleanEditorState> = {\n checkboxValue: false,\n isDisabled: false,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n return this.getPropertyValueSync();\n }\n\n private getPropertyValueSync(): 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.checkboxValue,\n displayValue: \"\",\n };\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 _updateCheckboxValue = (e: React.ChangeEvent<HTMLInputElement>) => {\n // istanbul ignore else\n if (this._isMounted) {\n const checkboxValue = !!e.target.checked;\n\n this.setState(\n {\n checkboxValue,\n },\n () => {\n // istanbul ignore else\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = this.getPropertyValueSync();\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 }\n };\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n 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 this.setStateFromProps();\n }\n }\n\n private setStateFromProps() {\n const { propertyRecord } = this.props;\n let checkboxValue = false;\n let isDisabled = false;\n\n // istanbul ignore else\n if (\n propertyRecord &&\n propertyRecord.value.valueFormat === PropertyValueFormat.Primitive\n ) {\n const primitiveValue = propertyRecord.value.value;\n checkboxValue = primitiveValue as boolean;\n }\n\n // istanbul ignore else\n if (propertyRecord && propertyRecord.isDisabled)\n isDisabled = propertyRecord.isDisabled;\n\n // istanbul ignore else\n if (this._isMounted) this.setState({ checkboxValue, isDisabled });\n }\n\n /** @internal */\n public override render() {\n const className = classnames(\n \"components-cell-editor\",\n \"components-boolean-editor\",\n this.props.className\n );\n const checked = this.state.checkboxValue;\n const isDisabled = !!this.state.isDisabled;\n\n return (\n <Checkbox\n ref={this._inputElement}\n onBlur={this.props.onBlur}\n className={className}\n style={this.props.style}\n checked={checked}\n onChange={this._updateCheckboxValue}\n autoFocus={this.props.setFocus} // eslint-disable-line jsx-a11y/no-autofocus\n disabled={isDisabled}\n data-testid=\"components-checkbox-editor\"\n ></Checkbox>\n );\n }\n}\n\n/** Boolean Property Editor registered for the \"bool\" and \"boolean\" type names.\n * It uses the [[BooleanEditor]] React component.\n * @public\n */\nexport class BooleanPropertyEditor extends PropertyEditorBase {\n // istanbul ignore next\n public override get containerHandlesBlur(): boolean {\n return false;\n }\n\n public get reactNode(): React.ReactNode {\n return <BooleanEditor />;\n }\n}\n\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Bool,\n BooleanPropertyEditor\n);\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Boolean,\n BooleanPropertyEditor\n);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"CustomNumberEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/editors/CustomNumberEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,2BAA2B,CAAC;AAEnC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAOV,aAAa,EACd,MAAM,uBAAuB,CAAC;AAc/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EACL,kBAAkB,EAEnB,MAAM,yBAAyB,CAAC;AAEjC,g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AGF,OAAO,CAAC,QAAQ,CAEd;IAEF,gBAAgB;IACA,MAAM,IAAI,KAAK,CAAC,SAAS;CAwD1C;AAED;;;GAGG;AACH,qBAAa,0BAA2B,SAAQ,kBAAkB;IAChE,IAAW,SAAS,IAAI,KAAK,CAAC,SAAS,CAEtC;IACD,IAAoB,sBAAsB,IAAI,OAAO,CAEpD;CACF"}
@@ -32,12 +32,11 @@ export class CustomNumberEditor extends React.PureComponent {
32
32
  this._applyUpdatedValue(e.target.value);
33
33
  };
34
34
  this._onKeyPress = (e) => {
35
- var _a;
36
35
  // istanbul ignore else
37
- if (e.key === Key.Escape) {
38
- const initialDisplayValue = (_a = (this._lastValidValue &&
39
- this._lastValidValue.displayValue)) !== null && _a !== void 0 ? _a :
40
- /* istanbul ignore next */ this._getInitialDisplayValue();
36
+ if (e.key === Key.Escape.valueOf()) {
37
+ const initialDisplayValue = (this._lastValidValue &&
38
+ this._lastValidValue.displayValue) ??
39
+ /* istanbul ignore next */ this._getInitialDisplayValue();
41
40
  if (initialDisplayValue !== this.state.inputValue) {
42
41
  e.preventDefault();
43
42
  e.stopPropagation();
@@ -50,7 +49,7 @@ export class CustomNumberEditor extends React.PureComponent {
50
49
  }
51
50
  }
52
51
  // istanbul ignore else
53
- if (e.key !== Key.Enter) {
52
+ if (e.key !== Key.Enter.valueOf()) {
54
53
  UiAdmin.messagePresenter.closeInputFieldMessage();
55
54
  }
56
55
  };
@@ -187,7 +186,8 @@ export class CustomNumberEditor extends React.PureComponent {
187
186
  if (record.property &&
188
187
  record.property.editor &&
189
188
  record.property.editor.params) {
190
- this._formatParams = record.property.editor.params.find((param) => param.type === PropertyEditorParamTypes.CustomFormattedNumber);
189
+ this._formatParams = record.property.editor.params.find((param) => param.type ===
190
+ PropertyEditorParamTypes.CustomFormattedNumber.valueOf());
191
191
  }
192
192
  if (!this._formatParams) {
193
193
  Logger.logError(UiComponents.loggerCategory(this), `CustomFormattedNumberParams must be defined for property ${record.property.name}`);
@@ -206,7 +206,7 @@ export class CustomNumberEditor extends React.PureComponent {
206
206
  if (record.property &&
207
207
  record.property.editor &&
208
208
  record.property.editor.params) {
209
- const editorSizeParams = record.property.editor.params.find((param) => param.type === PropertyEditorParamTypes.InputEditorSize);
209
+ const editorSizeParams = record.property.editor.params.find((param) => param.type === PropertyEditorParamTypes.InputEditorSize.valueOf());
210
210
  // istanbul ignore else
211
211
  if (editorSizeParams) {
212
212
  // istanbul ignore else
@@ -216,7 +216,7 @@ export class CustomNumberEditor extends React.PureComponent {
216
216
  if (editorSizeParams.maxLength)
217
217
  maxLength = editorSizeParams.maxLength;
218
218
  }
219
- const iconParams = record.property.editor.params.find((param) => param.type === PropertyEditorParamTypes.Icon);
219
+ const iconParams = record.property.editor.params.find((param) => param.type === PropertyEditorParamTypes.Icon.valueOf());
220
220
  if (iconParams) {
221
221
  iconSpec = iconParams.definition.iconSpec;
222
222
  }
@@ -231,10 +231,9 @@ export class CustomNumberEditor extends React.PureComponent {
231
231
  });
232
232
  }
233
233
  _resetToLastValidDisplayValue() {
234
- var _a;
235
- const initialDisplayValue = (_a = (this._lastValidValue &&
236
- this._lastValidValue.displayValue)) !== null && _a !== void 0 ? _a :
237
- /* istanbul ignore next */ this._getInitialDisplayValue();
234
+ const initialDisplayValue = (this._lastValidValue &&
235
+ this._lastValidValue.displayValue) ??
236
+ /* istanbul ignore next */ this._getInitialDisplayValue();
238
237
  this.setState({ inputValue: initialDisplayValue });
239
238
  }
240
239
  /** @internal */
@@ -259,7 +258,7 @@ export class CustomNumberEditor extends React.PureComponent {
259
258
  onChange: this._updateInputValue,
260
259
  onBlur: this.props.onBlur,
261
260
  onFocus: this._onFocus,
262
- setFocus: this.shouldSetFocus(),
261
+ autoFocus: this.shouldSetFocus(),
263
262
  onKeyDown: this._onKeyPress,
264
263
  };
265
264
  let reactNode;