@itwin/components-react 4.10.0-dev.1 → 4.11.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 (379) hide show
  1. package/CHANGELOG.md +22 -1
  2. package/lib/cjs/components-react/UiComponents.d.ts +1 -1
  3. package/lib/cjs/components-react/UiComponents.js +2 -4
  4. package/lib/cjs/components-react/UiComponents.js.map +1 -1
  5. package/lib/cjs/components-react/common/DelayedSpinner.js +3 -2
  6. package/lib/cjs/components-react/common/DelayedSpinner.js.map +1 -1
  7. package/lib/cjs/components-react/common/UseDebouncedAsyncValue.js +2 -1
  8. package/lib/cjs/components-react/common/UseDebouncedAsyncValue.js.map +1 -1
  9. package/lib/cjs/components-react/converters/DateTimeTypeConverter.js +1 -1
  10. package/lib/cjs/components-react/converters/DateTimeTypeConverter.js.map +1 -1
  11. package/lib/cjs/components-react/converters/NumericTypeConverter.js +4 -2
  12. package/lib/cjs/components-react/converters/NumericTypeConverter.js.map +1 -1
  13. package/lib/cjs/components-react/converters/PointTypeConverter.d.ts.map +1 -1
  14. package/lib/cjs/components-react/converters/PointTypeConverter.js +2 -0
  15. package/lib/cjs/components-react/converters/PointTypeConverter.js.map +1 -1
  16. package/lib/cjs/components-react/converters/TypeConverter.d.ts.map +1 -1
  17. package/lib/cjs/components-react/converters/TypeConverter.js +3 -1
  18. package/lib/cjs/components-react/converters/TypeConverter.js.map +1 -1
  19. package/lib/cjs/components-react/datepicker/DatePicker.d.ts +2 -0
  20. package/lib/cjs/components-react/datepicker/DatePicker.d.ts.map +1 -1
  21. package/lib/cjs/components-react/datepicker/DatePicker.js +48 -45
  22. package/lib/cjs/components-react/datepicker/DatePicker.js.map +1 -1
  23. package/lib/cjs/components-react/datepicker/DatePickerPopupButton.d.ts +5 -2
  24. package/lib/cjs/components-react/datepicker/DatePickerPopupButton.d.ts.map +1 -1
  25. package/lib/cjs/components-react/datepicker/DatePickerPopupButton.js +8 -7
  26. package/lib/cjs/components-react/datepicker/DatePickerPopupButton.js.map +1 -1
  27. package/lib/cjs/components-react/datepicker/IntlFormatter.d.ts +1 -0
  28. package/lib/cjs/components-react/datepicker/IntlFormatter.d.ts.map +1 -1
  29. package/lib/cjs/components-react/datepicker/IntlFormatter.js +1 -0
  30. package/lib/cjs/components-react/datepicker/IntlFormatter.js.map +1 -1
  31. package/lib/cjs/components-react/datepicker/TimeField.d.ts.map +1 -1
  32. package/lib/cjs/components-react/datepicker/TimeField.js +49 -48
  33. package/lib/cjs/components-react/datepicker/TimeField.js.map +1 -1
  34. package/lib/cjs/components-react/editors/CustomNumberEditor.d.ts.map +1 -1
  35. package/lib/cjs/components-react/editors/CustomNumberEditor.js +14 -11
  36. package/lib/cjs/components-react/editors/CustomNumberEditor.js.map +1 -1
  37. package/lib/cjs/components-react/editors/DateTimeEditor.js +5 -3
  38. package/lib/cjs/components-react/editors/DateTimeEditor.js.map +1 -1
  39. package/lib/cjs/components-react/editors/EditorContainer.js +3 -3
  40. package/lib/cjs/components-react/editors/EditorContainer.js.map +1 -1
  41. package/lib/cjs/components-react/editors/EnumButtonGroupEditor.js +1 -1
  42. package/lib/cjs/components-react/editors/EnumButtonGroupEditor.js.map +1 -1
  43. package/lib/cjs/components-react/editors/EnumEditor.d.ts +0 -1
  44. package/lib/cjs/components-react/editors/EnumEditor.d.ts.map +1 -1
  45. package/lib/cjs/components-react/editors/EnumEditor.js +2 -3
  46. package/lib/cjs/components-react/editors/EnumEditor.js.map +1 -1
  47. package/lib/cjs/components-react/editors/IconEditor.d.ts.map +1 -1
  48. package/lib/cjs/components-react/editors/IconEditor.js +1 -1
  49. package/lib/cjs/components-react/editors/IconEditor.js.map +1 -1
  50. package/lib/cjs/components-react/editors/ImageCheckBoxEditor.js +1 -1
  51. package/lib/cjs/components-react/editors/ImageCheckBoxEditor.js.map +1 -1
  52. package/lib/cjs/components-react/editors/NumericInputEditor.js +2 -2
  53. package/lib/cjs/components-react/editors/NumericInputEditor.js.map +1 -1
  54. package/lib/cjs/components-react/editors/PopupButton.d.ts.map +1 -1
  55. package/lib/cjs/components-react/editors/PopupButton.js +10 -7
  56. package/lib/cjs/components-react/editors/PopupButton.js.map +1 -1
  57. package/lib/cjs/components-react/editors/SliderEditor.js +1 -1
  58. package/lib/cjs/components-react/editors/SliderEditor.js.map +1 -1
  59. package/lib/cjs/components-react/editors/TextEditor.d.ts +0 -1
  60. package/lib/cjs/components-react/editors/TextEditor.d.ts.map +1 -1
  61. package/lib/cjs/components-react/editors/TextEditor.js +7 -6
  62. package/lib/cjs/components-react/editors/TextEditor.js.map +1 -1
  63. package/lib/cjs/components-react/editors/TextareaEditor.d.ts +0 -1
  64. package/lib/cjs/components-react/editors/TextareaEditor.d.ts.map +1 -1
  65. package/lib/cjs/components-react/editors/TextareaEditor.js +3 -4
  66. package/lib/cjs/components-react/editors/TextareaEditor.js.map +1 -1
  67. package/lib/cjs/components-react/favorite/FavoritePropertyList.js +3 -3
  68. package/lib/cjs/components-react/favorite/FavoritePropertyList.js.map +1 -1
  69. package/lib/cjs/components-react/filter-builder/FilterBuilderLogicalOperator.d.ts.map +1 -1
  70. package/lib/cjs/components-react/filter-builder/FilterBuilderLogicalOperator.js +4 -3
  71. package/lib/cjs/components-react/filter-builder/FilterBuilderLogicalOperator.js.map +1 -1
  72. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js +2 -1
  73. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
  74. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.d.ts.map +1 -1
  75. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js +6 -5
  76. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -1
  77. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js +4 -3
  78. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
  79. package/lib/cjs/components-react/filter-builder/FilterBuilderState.js +3 -3
  80. package/lib/cjs/components-react/filter-builder/FilterBuilderState.js.map +1 -1
  81. package/lib/cjs/components-react/filter-builder/FilterBuilderToolbar.d.ts.map +1 -1
  82. package/lib/cjs/components-react/filter-builder/FilterBuilderToolbar.js +4 -3
  83. package/lib/cjs/components-react/filter-builder/FilterBuilderToolbar.js.map +1 -1
  84. package/lib/cjs/components-react/filter-builder/Operators.js +13 -13
  85. package/lib/cjs/components-react/filter-builder/Operators.js.map +1 -1
  86. package/lib/cjs/components-react/filtering/FilteringInput.d.ts +0 -3
  87. package/lib/cjs/components-react/filtering/FilteringInput.d.ts.map +1 -1
  88. package/lib/cjs/components-react/filtering/FilteringInput.js +6 -8
  89. package/lib/cjs/components-react/filtering/FilteringInput.js.map +1 -1
  90. package/lib/cjs/components-react/filtering/ResultSelector.d.ts +0 -1
  91. package/lib/cjs/components-react/filtering/ResultSelector.d.ts.map +1 -1
  92. package/lib/cjs/components-react/filtering/ResultSelector.js +2 -3
  93. package/lib/cjs/components-react/filtering/ResultSelector.js.map +1 -1
  94. package/lib/cjs/components-react/inputs/ParsedInput.js +2 -2
  95. package/lib/cjs/components-react/inputs/ParsedInput.js.map +1 -1
  96. package/lib/cjs/components-react/properties/ValueRendererManager.d.ts +3 -0
  97. package/lib/cjs/components-react/properties/ValueRendererManager.d.ts.map +1 -1
  98. package/lib/cjs/components-react/properties/ValueRendererManager.js +12 -1
  99. package/lib/cjs/components-react/properties/ValueRendererManager.js.map +1 -1
  100. package/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer.js +4 -3
  101. package/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer.js.map +1 -1
  102. package/lib/cjs/components-react/properties/renderers/CustomizablePropertyRenderer.d.ts +25 -0
  103. package/lib/cjs/components-react/properties/renderers/CustomizablePropertyRenderer.d.ts.map +1 -0
  104. package/lib/cjs/components-react/properties/renderers/CustomizablePropertyRenderer.js +62 -0
  105. package/lib/cjs/components-react/properties/renderers/CustomizablePropertyRenderer.js.map +1 -0
  106. package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.js +1 -1
  107. package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.js.map +1 -1
  108. package/lib/cjs/components-react/properties/renderers/PrimitivePropertyRenderer.d.ts +3 -4
  109. package/lib/cjs/components-react/properties/renderers/PrimitivePropertyRenderer.d.ts.map +1 -1
  110. package/lib/cjs/components-react/properties/renderers/PrimitivePropertyRenderer.js +6 -44
  111. package/lib/cjs/components-react/properties/renderers/PrimitivePropertyRenderer.js.map +1 -1
  112. package/lib/cjs/components-react/properties/renderers/PropertyView.d.ts +1 -1
  113. package/lib/cjs/components-react/properties/renderers/PropertyView.d.ts.map +1 -1
  114. package/lib/cjs/components-react/properties/renderers/PropertyView.js +2 -3
  115. package/lib/cjs/components-react/properties/renderers/PropertyView.js.map +1 -1
  116. package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.js +4 -4
  117. package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.js.map +1 -1
  118. package/lib/cjs/components-react/properties/renderers/value/Common.js +2 -1
  119. package/lib/cjs/components-react/properties/renderers/value/Common.js.map +1 -1
  120. package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.js +1 -1
  121. package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.js.map +1 -1
  122. package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.d.ts.map +1 -1
  123. package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js +8 -11
  124. package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js.map +1 -1
  125. package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js +1 -1
  126. package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js.map +1 -1
  127. package/lib/cjs/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js +6 -3
  128. package/lib/cjs/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js.map +1 -1
  129. package/lib/cjs/components-react/propertygrid/PropertyCategoryRendererManager.js +2 -1
  130. package/lib/cjs/components-react/propertygrid/PropertyCategoryRendererManager.js.map +1 -1
  131. package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js +2 -1
  132. package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map +1 -1
  133. package/lib/cjs/components-react/propertygrid/component/PropertyCategoryBlock.js +2 -1
  134. package/lib/cjs/components-react/propertygrid/component/PropertyCategoryBlock.js.map +1 -1
  135. package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js +2 -2
  136. package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
  137. package/lib/cjs/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.d.ts.map +1 -1
  138. package/lib/cjs/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.js +1 -3
  139. package/lib/cjs/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.js.map +1 -1
  140. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts +1 -3
  141. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts.map +1 -1
  142. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js +90 -80
  143. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
  144. package/lib/cjs/components-react/propertygrid/dataproviders/FilteringDataProvider.js +13 -11
  145. package/lib/cjs/components-react/propertygrid/dataproviders/FilteringDataProvider.js.map +1 -1
  146. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js +2 -2
  147. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js.map +1 -1
  148. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js +2 -1
  149. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js.map +1 -1
  150. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js +2 -1
  151. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js.map +1 -1
  152. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js +2 -2
  153. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
  154. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridCategory.js +3 -2
  155. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridCategory.js.map +1 -1
  156. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js +1 -1
  157. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js.map +1 -1
  158. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js +1 -1
  159. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js.map +1 -1
  160. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.d.ts +1 -1
  161. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.d.ts.map +1 -1
  162. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js +22 -12
  163. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
  164. package/lib/cjs/components-react/selectable-content/SelectableContent.js +3 -2
  165. package/lib/cjs/components-react/selectable-content/SelectableContent.js.map +1 -1
  166. package/lib/cjs/components-react/toolbar/InternalToolbarComponent.d.ts.map +1 -1
  167. package/lib/cjs/components-react/toolbar/InternalToolbarComponent.js +15 -14
  168. package/lib/cjs/components-react/toolbar/InternalToolbarComponent.js.map +1 -1
  169. package/lib/cjs/components-react/toolbar/useConditionalSynchedItems.js +6 -5
  170. package/lib/cjs/components-react/toolbar/useConditionalSynchedItems.js.map +1 -1
  171. package/lib/cjs/components-react/tree/controlled/TreeModel.js +8 -7
  172. package/lib/cjs/components-react/tree/controlled/TreeModel.js.map +1 -1
  173. package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js +8 -6
  174. package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
  175. package/lib/cjs/components-react/tree/controlled/component/ControlledTree.d.ts.map +1 -1
  176. package/lib/cjs/components-react/tree/controlled/component/ControlledTree.js +3 -2
  177. package/lib/cjs/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
  178. package/lib/cjs/components-react/tree/controlled/internal/SparseTree.js +2 -1
  179. package/lib/cjs/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
  180. package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.js +5 -3
  181. package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
  182. package/lib/cjs/components-react/useTranslation.d.ts +10 -0
  183. package/lib/cjs/components-react/useTranslation.d.ts.map +1 -0
  184. package/lib/cjs/components-react/useTranslation.js +20 -0
  185. package/lib/cjs/components-react/useTranslation.js.map +1 -0
  186. package/lib/cjs/components-react.d.ts +1 -0
  187. package/lib/cjs/components-react.d.ts.map +1 -1
  188. package/lib/cjs/components-react.js +1 -0
  189. package/lib/cjs/components-react.js.map +1 -1
  190. package/lib/esm/components-react/UiComponents.d.ts +1 -1
  191. package/lib/esm/components-react/UiComponents.js +2 -4
  192. package/lib/esm/components-react/UiComponents.js.map +1 -1
  193. package/lib/esm/components-react/common/DelayedSpinner.js +3 -2
  194. package/lib/esm/components-react/common/DelayedSpinner.js.map +1 -1
  195. package/lib/esm/components-react/common/UseDebouncedAsyncValue.js +2 -1
  196. package/lib/esm/components-react/common/UseDebouncedAsyncValue.js.map +1 -1
  197. package/lib/esm/components-react/converters/DateTimeTypeConverter.js +1 -1
  198. package/lib/esm/components-react/converters/DateTimeTypeConverter.js.map +1 -1
  199. package/lib/esm/components-react/converters/NumericTypeConverter.js +4 -2
  200. package/lib/esm/components-react/converters/NumericTypeConverter.js.map +1 -1
  201. package/lib/esm/components-react/converters/PointTypeConverter.d.ts.map +1 -1
  202. package/lib/esm/components-react/converters/PointTypeConverter.js +2 -0
  203. package/lib/esm/components-react/converters/PointTypeConverter.js.map +1 -1
  204. package/lib/esm/components-react/converters/TypeConverter.d.ts.map +1 -1
  205. package/lib/esm/components-react/converters/TypeConverter.js +3 -1
  206. package/lib/esm/components-react/converters/TypeConverter.js.map +1 -1
  207. package/lib/esm/components-react/datepicker/DatePicker.d.ts +2 -0
  208. package/lib/esm/components-react/datepicker/DatePicker.d.ts.map +1 -1
  209. package/lib/esm/components-react/datepicker/DatePicker.js +48 -45
  210. package/lib/esm/components-react/datepicker/DatePicker.js.map +1 -1
  211. package/lib/esm/components-react/datepicker/DatePickerPopupButton.d.ts +5 -2
  212. package/lib/esm/components-react/datepicker/DatePickerPopupButton.d.ts.map +1 -1
  213. package/lib/esm/components-react/datepicker/DatePickerPopupButton.js +8 -7
  214. package/lib/esm/components-react/datepicker/DatePickerPopupButton.js.map +1 -1
  215. package/lib/esm/components-react/datepicker/IntlFormatter.d.ts +1 -0
  216. package/lib/esm/components-react/datepicker/IntlFormatter.d.ts.map +1 -1
  217. package/lib/esm/components-react/datepicker/IntlFormatter.js +1 -0
  218. package/lib/esm/components-react/datepicker/IntlFormatter.js.map +1 -1
  219. package/lib/esm/components-react/datepicker/TimeField.d.ts.map +1 -1
  220. package/lib/esm/components-react/datepicker/TimeField.js +49 -48
  221. package/lib/esm/components-react/datepicker/TimeField.js.map +1 -1
  222. package/lib/esm/components-react/editors/CustomNumberEditor.d.ts.map +1 -1
  223. package/lib/esm/components-react/editors/CustomNumberEditor.js +14 -11
  224. package/lib/esm/components-react/editors/CustomNumberEditor.js.map +1 -1
  225. package/lib/esm/components-react/editors/DateTimeEditor.js +5 -3
  226. package/lib/esm/components-react/editors/DateTimeEditor.js.map +1 -1
  227. package/lib/esm/components-react/editors/EditorContainer.js +3 -3
  228. package/lib/esm/components-react/editors/EditorContainer.js.map +1 -1
  229. package/lib/esm/components-react/editors/EnumButtonGroupEditor.js +1 -1
  230. package/lib/esm/components-react/editors/EnumButtonGroupEditor.js.map +1 -1
  231. package/lib/esm/components-react/editors/EnumEditor.d.ts +0 -1
  232. package/lib/esm/components-react/editors/EnumEditor.d.ts.map +1 -1
  233. package/lib/esm/components-react/editors/EnumEditor.js +2 -3
  234. package/lib/esm/components-react/editors/EnumEditor.js.map +1 -1
  235. package/lib/esm/components-react/editors/IconEditor.d.ts.map +1 -1
  236. package/lib/esm/components-react/editors/IconEditor.js +1 -1
  237. package/lib/esm/components-react/editors/IconEditor.js.map +1 -1
  238. package/lib/esm/components-react/editors/ImageCheckBoxEditor.js +1 -1
  239. package/lib/esm/components-react/editors/ImageCheckBoxEditor.js.map +1 -1
  240. package/lib/esm/components-react/editors/NumericInputEditor.js +2 -2
  241. package/lib/esm/components-react/editors/NumericInputEditor.js.map +1 -1
  242. package/lib/esm/components-react/editors/PopupButton.d.ts.map +1 -1
  243. package/lib/esm/components-react/editors/PopupButton.js +11 -8
  244. package/lib/esm/components-react/editors/PopupButton.js.map +1 -1
  245. package/lib/esm/components-react/editors/SliderEditor.js +1 -1
  246. package/lib/esm/components-react/editors/SliderEditor.js.map +1 -1
  247. package/lib/esm/components-react/editors/TextEditor.d.ts +0 -1
  248. package/lib/esm/components-react/editors/TextEditor.d.ts.map +1 -1
  249. package/lib/esm/components-react/editors/TextEditor.js +7 -6
  250. package/lib/esm/components-react/editors/TextEditor.js.map +1 -1
  251. package/lib/esm/components-react/editors/TextareaEditor.d.ts +0 -1
  252. package/lib/esm/components-react/editors/TextareaEditor.d.ts.map +1 -1
  253. package/lib/esm/components-react/editors/TextareaEditor.js +3 -4
  254. package/lib/esm/components-react/editors/TextareaEditor.js.map +1 -1
  255. package/lib/esm/components-react/favorite/FavoritePropertyList.js +3 -3
  256. package/lib/esm/components-react/favorite/FavoritePropertyList.js.map +1 -1
  257. package/lib/esm/components-react/filter-builder/FilterBuilderLogicalOperator.d.ts.map +1 -1
  258. package/lib/esm/components-react/filter-builder/FilterBuilderLogicalOperator.js +4 -3
  259. package/lib/esm/components-react/filter-builder/FilterBuilderLogicalOperator.js.map +1 -1
  260. package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js +2 -1
  261. package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
  262. package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.d.ts.map +1 -1
  263. package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js +6 -5
  264. package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -1
  265. package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js +4 -3
  266. package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
  267. package/lib/esm/components-react/filter-builder/FilterBuilderState.js +3 -3
  268. package/lib/esm/components-react/filter-builder/FilterBuilderState.js.map +1 -1
  269. package/lib/esm/components-react/filter-builder/FilterBuilderToolbar.d.ts.map +1 -1
  270. package/lib/esm/components-react/filter-builder/FilterBuilderToolbar.js +4 -3
  271. package/lib/esm/components-react/filter-builder/FilterBuilderToolbar.js.map +1 -1
  272. package/lib/esm/components-react/filter-builder/Operators.js +13 -13
  273. package/lib/esm/components-react/filter-builder/Operators.js.map +1 -1
  274. package/lib/esm/components-react/filtering/FilteringInput.d.ts +0 -3
  275. package/lib/esm/components-react/filtering/FilteringInput.d.ts.map +1 -1
  276. package/lib/esm/components-react/filtering/FilteringInput.js +7 -9
  277. package/lib/esm/components-react/filtering/FilteringInput.js.map +1 -1
  278. package/lib/esm/components-react/filtering/ResultSelector.d.ts +0 -1
  279. package/lib/esm/components-react/filtering/ResultSelector.d.ts.map +1 -1
  280. package/lib/esm/components-react/filtering/ResultSelector.js +2 -3
  281. package/lib/esm/components-react/filtering/ResultSelector.js.map +1 -1
  282. package/lib/esm/components-react/inputs/ParsedInput.js +2 -2
  283. package/lib/esm/components-react/inputs/ParsedInput.js.map +1 -1
  284. package/lib/esm/components-react/properties/ValueRendererManager.d.ts +3 -0
  285. package/lib/esm/components-react/properties/ValueRendererManager.d.ts.map +1 -1
  286. package/lib/esm/components-react/properties/ValueRendererManager.js +12 -1
  287. package/lib/esm/components-react/properties/ValueRendererManager.js.map +1 -1
  288. package/lib/esm/components-react/properties/renderers/CommonPropertyRenderer.js +4 -3
  289. package/lib/esm/components-react/properties/renderers/CommonPropertyRenderer.js.map +1 -1
  290. package/lib/esm/components-react/properties/renderers/CustomizablePropertyRenderer.d.ts +25 -0
  291. package/lib/esm/components-react/properties/renderers/CustomizablePropertyRenderer.d.ts.map +1 -0
  292. package/lib/esm/components-react/properties/renderers/CustomizablePropertyRenderer.js +35 -0
  293. package/lib/esm/components-react/properties/renderers/CustomizablePropertyRenderer.js.map +1 -0
  294. package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.js +1 -1
  295. package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.js.map +1 -1
  296. package/lib/esm/components-react/properties/renderers/PrimitivePropertyRenderer.d.ts +3 -4
  297. package/lib/esm/components-react/properties/renderers/PrimitivePropertyRenderer.d.ts.map +1 -1
  298. package/lib/esm/components-react/properties/renderers/PrimitivePropertyRenderer.js +3 -21
  299. package/lib/esm/components-react/properties/renderers/PrimitivePropertyRenderer.js.map +1 -1
  300. package/lib/esm/components-react/properties/renderers/PropertyView.d.ts +1 -1
  301. package/lib/esm/components-react/properties/renderers/PropertyView.d.ts.map +1 -1
  302. package/lib/esm/components-react/properties/renderers/PropertyView.js +2 -3
  303. package/lib/esm/components-react/properties/renderers/PropertyView.js.map +1 -1
  304. package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.js +4 -4
  305. package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.js.map +1 -1
  306. package/lib/esm/components-react/properties/renderers/value/Common.js +2 -1
  307. package/lib/esm/components-react/properties/renderers/value/Common.js.map +1 -1
  308. package/lib/esm/components-react/properties/renderers/value/DoublePropertyValueRenderer.js +1 -1
  309. package/lib/esm/components-react/properties/renderers/value/DoublePropertyValueRenderer.js.map +1 -1
  310. package/lib/esm/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.d.ts.map +1 -1
  311. package/lib/esm/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js +8 -11
  312. package/lib/esm/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js.map +1 -1
  313. package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js +1 -1
  314. package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js.map +1 -1
  315. package/lib/esm/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js +6 -3
  316. package/lib/esm/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js.map +1 -1
  317. package/lib/esm/components-react/propertygrid/PropertyCategoryRendererManager.js +2 -1
  318. package/lib/esm/components-react/propertygrid/PropertyCategoryRendererManager.js.map +1 -1
  319. package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js +2 -1
  320. package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map +1 -1
  321. package/lib/esm/components-react/propertygrid/component/PropertyCategoryBlock.js +2 -1
  322. package/lib/esm/components-react/propertygrid/component/PropertyCategoryBlock.js.map +1 -1
  323. package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js +2 -2
  324. package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
  325. package/lib/esm/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.d.ts.map +1 -1
  326. package/lib/esm/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.js +1 -3
  327. package/lib/esm/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.js.map +1 -1
  328. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts +1 -3
  329. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts.map +1 -1
  330. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js +90 -80
  331. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
  332. package/lib/esm/components-react/propertygrid/dataproviders/FilteringDataProvider.js +13 -11
  333. package/lib/esm/components-react/propertygrid/dataproviders/FilteringDataProvider.js.map +1 -1
  334. package/lib/esm/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js +2 -2
  335. package/lib/esm/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js.map +1 -1
  336. package/lib/esm/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js +2 -1
  337. package/lib/esm/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js.map +1 -1
  338. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js +2 -1
  339. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js.map +1 -1
  340. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js +2 -2
  341. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
  342. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.js +3 -2
  343. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.js.map +1 -1
  344. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js +1 -1
  345. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js.map +1 -1
  346. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js +1 -1
  347. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js.map +1 -1
  348. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.d.ts +1 -1
  349. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.d.ts.map +1 -1
  350. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js +22 -12
  351. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
  352. package/lib/esm/components-react/selectable-content/SelectableContent.js +3 -2
  353. package/lib/esm/components-react/selectable-content/SelectableContent.js.map +1 -1
  354. package/lib/esm/components-react/toolbar/InternalToolbarComponent.d.ts.map +1 -1
  355. package/lib/esm/components-react/toolbar/InternalToolbarComponent.js +15 -14
  356. package/lib/esm/components-react/toolbar/InternalToolbarComponent.js.map +1 -1
  357. package/lib/esm/components-react/toolbar/useConditionalSynchedItems.js +6 -5
  358. package/lib/esm/components-react/toolbar/useConditionalSynchedItems.js.map +1 -1
  359. package/lib/esm/components-react/tree/controlled/TreeModel.js +8 -7
  360. package/lib/esm/components-react/tree/controlled/TreeModel.js.map +1 -1
  361. package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js +8 -6
  362. package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
  363. package/lib/esm/components-react/tree/controlled/component/ControlledTree.d.ts.map +1 -1
  364. package/lib/esm/components-react/tree/controlled/component/ControlledTree.js +3 -2
  365. package/lib/esm/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
  366. package/lib/esm/components-react/tree/controlled/internal/SparseTree.js +2 -1
  367. package/lib/esm/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
  368. package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.js +5 -3
  369. package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
  370. package/lib/esm/components-react/useTranslation.d.ts +10 -0
  371. package/lib/esm/components-react/useTranslation.d.ts.map +1 -0
  372. package/lib/esm/components-react/useTranslation.js +16 -0
  373. package/lib/esm/components-react/useTranslation.js.map +1 -0
  374. package/lib/esm/components-react.d.ts +1 -0
  375. package/lib/esm/components-react.d.ts.map +1 -1
  376. package/lib/esm/components-react.js +1 -0
  377. package/lib/esm/components-react.js.map +1 -1
  378. package/lib/public/locales/en/UiComponents.json +7 -1
  379. package/package.json +11 -11
@@ -37,10 +37,10 @@ exports.DatePicker = void 0;
37
37
  const React = __importStar(require("react"));
38
38
  const classnames_1 = __importDefault(require("classnames"));
39
39
  const ts_key_enum_1 = require("ts-key-enum");
40
- const UiComponents_1 = require("../UiComponents");
41
40
  const core_react_1 = require("@itwin/core-react");
42
41
  const itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
43
42
  require("./DatePicker.scss");
43
+ const useTranslation_1 = require("../useTranslation");
44
44
  function isSameDay(a, b) {
45
45
  return (a &&
46
46
  b &&
@@ -50,42 +50,45 @@ function isSameDay(a, b) {
50
50
  }
51
51
  /** DatePicker component. Show a month selector and a day calendar to select a specific date.
52
52
  * @alpha
53
+ * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.
53
54
  */
55
+ // eslint-disable-next-line deprecation/deprecation
54
56
  function DatePicker(props) {
55
- const previousMonthLabel = React.useRef(UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:datepicker.previousMonth"));
56
- const nextMonthLabel = React.useRef(UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:datepicker.nextMonth"));
57
- const monthsLong = React.useRef([
58
- UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:month.long.january"),
59
- UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:month.long.february"),
60
- UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:month.long.march"),
61
- UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:month.long.april"),
62
- UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:month.long.may"),
63
- UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:month.long.june"),
64
- UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:month.long.july"),
65
- UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:month.long.august"),
66
- UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:month.long.september"),
67
- UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:month.long.october"),
68
- UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:month.long.november"),
69
- UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:month.long.december"),
70
- ]);
71
- const daysLong = React.useRef([
72
- UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:days.long.sunday"),
73
- UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:days.long.monday"),
74
- UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:days.long.tuesday"),
75
- UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:days.long.wednesday"),
76
- UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:days.long.thursday"),
77
- UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:days.long.friday"),
78
- UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:days.long.saturday"),
79
- ]);
80
- const daysShort = React.useRef([
81
- UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:days.short.sunday"),
82
- UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:days.short.monday"),
83
- UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:days.short.tuesday"),
84
- UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:days.short.wednesday"),
85
- UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:days.short.thursday"),
86
- UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:days.short.friday"),
87
- UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:days.short.saturday"),
88
- ]);
57
+ const { translate } = (0, useTranslation_1.useTranslation)();
58
+ const previousMonthLabel = translate("datepicker.previousMonth");
59
+ const nextMonthLabel = translate("datepicker.nextMonth");
60
+ const monthsLong = [
61
+ translate("month.long.january"),
62
+ translate("month.long.february"),
63
+ translate("month.long.march"),
64
+ translate("month.long.april"),
65
+ translate("month.long.may"),
66
+ translate("month.long.june"),
67
+ translate("month.long.july"),
68
+ translate("month.long.august"),
69
+ translate("month.long.september"),
70
+ translate("month.long.october"),
71
+ translate("month.long.november"),
72
+ translate("month.long.december"),
73
+ ];
74
+ const daysLong = [
75
+ translate("days.long.sunday"),
76
+ translate("days.long.monday"),
77
+ translate("days.long.tuesday"),
78
+ translate("days.long.wednesday"),
79
+ translate("days.long.thursday"),
80
+ translate("days.long.friday"),
81
+ translate("days.long.saturday"),
82
+ ];
83
+ const daysShort = [
84
+ translate("days.short.sunday"),
85
+ translate("days.short.monday"),
86
+ translate("days.short.tuesday"),
87
+ translate("days.short.wednesday"),
88
+ translate("days.short.thursday"),
89
+ translate("days.short.friday"),
90
+ translate("days.short.saturday"),
91
+ ];
89
92
  const [selectedDay, setSelectedDay] = React.useState(new Date(props.selected.getTime()));
90
93
  const [displayedMonthIndex, setDisplayedMonthIndex] = React.useState(selectedDay.getMonth());
91
94
  const [displayedYear, setDisplayedYear] = React.useState(selectedDay.getFullYear());
@@ -148,7 +151,7 @@ function DatePicker(props) {
148
151
  props.onDateChange && props.onDateChange(day);
149
152
  }, [props]);
150
153
  const handleCalendarKeyDown = React.useCallback((event) => {
151
- if (event.key === ts_key_enum_1.Key.ArrowDown) {
154
+ if (event.key === ts_key_enum_1.Key.ArrowDown.valueOf()) {
152
155
  const focusedDayIndex = days.findIndex((day) => isSameDay(day, focusedDay));
153
156
  if (focusedDayIndex + 7 > 41)
154
157
  setFocusedDay(days[focusedDayIndex % 7]);
@@ -156,7 +159,7 @@ function DatePicker(props) {
156
159
  setFocusedDay(days[focusedDayIndex + 7]);
157
160
  event.preventDefault();
158
161
  }
159
- if (event.key === ts_key_enum_1.Key.ArrowUp) {
162
+ if (event.key === ts_key_enum_1.Key.ArrowUp.valueOf()) {
160
163
  const focusedDayIndex = days.findIndex((day) => isSameDay(day, focusedDay));
161
164
  if (focusedDayIndex - 7 < 0)
162
165
  setFocusedDay(days[(focusedDayIndex % 7) + 35]);
@@ -164,21 +167,21 @@ function DatePicker(props) {
164
167
  setFocusedDay(days[focusedDayIndex - 7]);
165
168
  event.preventDefault();
166
169
  }
167
- if (event.key === ts_key_enum_1.Key.ArrowLeft) {
170
+ if (event.key === ts_key_enum_1.Key.ArrowLeft.valueOf()) {
168
171
  const focusedDayIndex = days.findIndex((day) => isSameDay(day, focusedDay));
169
172
  // istanbul ignore else
170
173
  if (focusedDayIndex - 1 >= 0)
171
174
  setFocusedDay(days[focusedDayIndex - 1]);
172
175
  event.preventDefault();
173
176
  }
174
- if (event.key === ts_key_enum_1.Key.ArrowRight) {
177
+ if (event.key === ts_key_enum_1.Key.ArrowRight.valueOf()) {
175
178
  const focusedDayIndex = days.findIndex((day) => isSameDay(day, focusedDay));
176
179
  // istanbul ignore else
177
180
  if (focusedDayIndex + 1 <= 41)
178
181
  setFocusedDay(days[focusedDayIndex + 1]);
179
182
  event.preventDefault();
180
183
  }
181
- if (event.key === ts_key_enum_1.Key.Enter || event.key === " ") {
184
+ if (event.key === ts_key_enum_1.Key.Enter.valueOf() || event.key === " ") {
182
185
  handleOnDayChange(focusedDay)(); // NB: immediately call returned handler function
183
186
  event.preventDefault();
184
187
  }
@@ -188,16 +191,16 @@ function DatePicker(props) {
188
191
  const calendarClass = (0, classnames_1.default)("components-date-picker-calendar-month", props.showFocusOutline && "showFocusOutline");
189
192
  return (React.createElement("div", { className: "components-date-picker-calendar" },
190
193
  React.createElement("div", { className: "components-date-picker-calendar-header-months" },
191
- React.createElement("button", { className: previousButtonClass, title: previousMonthLabel.current, onClick: handleMoveToPreviousMonth },
194
+ React.createElement("button", { className: previousButtonClass, title: previousMonthLabel, onClick: handleMoveToPreviousMonth },
192
195
  React.createElement(core_react_1.Icon, { iconSpec: React.createElement(itwinui_icons_react_1.SvgChevronLeft, null) })),
193
196
  React.createElement("span", { className: "components-month-year" },
194
- monthsLong.current[displayedMonthIndex],
197
+ monthsLong[displayedMonthIndex],
195
198
  " ",
196
199
  displayedYear),
197
- React.createElement("button", { className: nextButtonClass, title: nextMonthLabel.current, onClick: handleMoveToNextMonth },
200
+ React.createElement("button", { className: nextButtonClass, title: nextMonthLabel, onClick: handleMoveToNextMonth },
198
201
  React.createElement(core_react_1.Icon, { iconSpec: React.createElement(itwinui_icons_react_1.SvgChevronRight, null) }))),
199
- React.createElement("div", { className: "components-date-picker-calendar-header-weekdays" }, [0, 1, 2, 3, 4, 5, 6].map((dayOfWeek) => (React.createElement("div", { key: `day-${dayOfWeek}`, className: "components-date-picker-calendar-header-day-short", title: daysLong.current[dayOfWeek] },
200
- React.createElement("span", null, daysShort.current[dayOfWeek]))))),
202
+ React.createElement("div", { className: "components-date-picker-calendar-header-weekdays" }, [0, 1, 2, 3, 4, 5, 6].map((dayOfWeek) => (React.createElement("div", { key: `day-${dayOfWeek}`, className: "components-date-picker-calendar-header-day-short", title: daysLong[dayOfWeek] },
203
+ React.createElement("span", null, daysShort[dayOfWeek]))))),
201
204
  React.createElement("ul", { tabIndex: 0, onKeyDown: handleCalendarKeyDown, "data-testid": "components-date-picker-calendar-list", className: calendarClass, role: "listbox" }, weeks.map((weekdays, weekIndex) => (React.createElement(React.Fragment, { key: `week-${weekIndex}` }, weekdays.map((day, dayIndex) => {
202
205
  const isActive = selectedDay && day && isSameDay(selectedDay, day);
203
206
  const isFocused = focusedDay &&
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker.js","sourceRoot":"","sources":["../../../../src/components-react/datepicker/DatePicker.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,4DAAoC;AACpC,6CAAkC;AAClC,kDAA+C;AAC/C,kDAAyC;AACzC,oEAA6E;AAC7E,6BAA2B;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,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rB,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;AA5TD,gCA4TC","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,6CAA+B;AAC/B,4DAAoC;AACpC,6CAAkC;AAClC,kDAAyC;AACzC,oEAA6E;AAC7E,6BAA2B;AAC3B,sDAAmD;AAEnD,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;AAgBD;;;GAGG;AACH,mDAAmD;AACnD,SAAgB,UAAU,CAAC,KAAsB;IAC/C,MAAM,EAAE,SAAS,EAAE,GAAG,IAAA,+BAAc,GAAE,CAAC;IACvC,MAAM,kBAAkB,GAAG,SAAS,CAAC,0BAA0B,CAAC,CAAC;IACjE,MAAM,cAAc,GAAG,SAAS,CAAC,sBAAsB,CAAC,CAAC;IACzD,MAAM,UAAU,GAAG;QACjB,SAAS,CAAC,oBAAoB,CAAC;QAC/B,SAAS,CAAC,qBAAqB,CAAC;QAChC,SAAS,CAAC,kBAAkB,CAAC;QAC7B,SAAS,CAAC,kBAAkB,CAAC;QAC7B,SAAS,CAAC,gBAAgB,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Aa,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;AAnQD,gCAmQC","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 { Icon } from \"@itwin/core-react\";\nimport { SvgChevronLeft, SvgChevronRight } from \"@itwin/itwinui-icons-react\";\nimport \"./DatePicker.scss\";\nimport { useTranslation } from \"../useTranslation\";\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 * @deprecated in 4.11.x. Props of deprecated component {@link DatePicker}.\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 * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.\n */\n// eslint-disable-next-line deprecation/deprecation\nexport function DatePicker(props: DatePickerProps) {\n const { translate } = useTranslation();\n const previousMonthLabel = translate(\"datepicker.previousMonth\");\n const nextMonthLabel = translate(\"datepicker.nextMonth\");\n const monthsLong = [\n translate(\"month.long.january\"),\n translate(\"month.long.february\"),\n translate(\"month.long.march\"),\n translate(\"month.long.april\"),\n translate(\"month.long.may\"),\n translate(\"month.long.june\"),\n translate(\"month.long.july\"),\n translate(\"month.long.august\"),\n translate(\"month.long.september\"),\n translate(\"month.long.october\"),\n translate(\"month.long.november\"),\n translate(\"month.long.december\"),\n ];\n\n const daysLong = [\n translate(\"days.long.sunday\"),\n translate(\"days.long.monday\"),\n translate(\"days.long.tuesday\"),\n translate(\"days.long.wednesday\"),\n translate(\"days.long.thursday\"),\n translate(\"days.long.friday\"),\n translate(\"days.long.saturday\"),\n ];\n\n const daysShort = [\n translate(\"days.short.sunday\"),\n translate(\"days.short.monday\"),\n translate(\"days.short.tuesday\"),\n translate(\"days.short.wednesday\"),\n translate(\"days.short.thursday\"),\n translate(\"days.short.friday\"),\n translate(\"days.short.saturday\"),\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}\n onClick={handleMoveToPreviousMonth}\n >\n <Icon iconSpec={<SvgChevronLeft />} />\n </button>\n <span className=\"components-month-year\">\n {monthsLong[displayedMonthIndex]} {displayedYear}\n </span>\n <button\n className={nextButtonClass}\n title={nextMonthLabel}\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[dayOfWeek]}\n >\n <span>{daysShort[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"]}
@@ -6,7 +6,9 @@ import type { DateFormatter, TimeDisplay } from "@itwin/appui-abstract";
6
6
  import type { CommonProps } from "@itwin/core-react";
7
7
  import "./DatePickerPopupButton.scss";
8
8
  /** Props used by [[DatePickerPopupButton]] component.
9
- * @alpha */
9
+ * @alpha
10
+ * @deprecated in 4.11.x. Props of deprecated component {@link DatePickerPopupButton}.
11
+ */
10
12
  export interface DatePickerPopupButtonProps extends CommonProps {
11
13
  /** Date to be shown as the selected date. */
12
14
  selected: Date;
@@ -25,6 +27,7 @@ export interface DatePickerPopupButtonProps extends CommonProps {
25
27
  }
26
28
  /** Component that displays a button used to pick a date and optionally a time.
27
29
  * @alpha
28
- * */
30
+ * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.
31
+ */
29
32
  export declare function DatePickerPopupButton({ displayEditField, timeDisplay, selected, onDateChange, dateFormatter, buttonToolTip, fieldStyle, fieldClassName, style, }: DatePickerPopupButtonProps): React.JSX.Element;
30
33
  //# sourceMappingURL=DatePickerPopupButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DatePickerPopupButton.d.ts","sourceRoot":"","sources":["../../../../src/components-react/datepicker/DatePickerPopupButton.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAExE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAQrD,OAAO,8BAA8B,CAAC;AAEtC;YACY;AACZ,MAAM,WAAW,0BAA2B,SAAQ,WAAW;IAC7D,6CAA6C;IAC7C,QAAQ,EAAE,IAAI,CAAC;IACf,4EAA4E;IAC5E,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,yCAAyC;IACzC,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,IAAI,CAAC;IACnC,uBAAuB;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IAGvB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,8CAA8C;IAC9C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,yCAAyC;IACzC,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAClC;AAED;;KAEK;AACL,wBAAgB,qBAAqB,CAAC,EACpC,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,aAAa,EACb,UAAU,EACV,cAAc,EACd,KAAK,GACN,EAAE,0BAA0B,qBAoI5B"}
1
+ {"version":3,"file":"DatePickerPopupButton.d.ts","sourceRoot":"","sources":["../../../../src/components-react/datepicker/DatePickerPopupButton.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAExE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAOrD,OAAO,8BAA8B,CAAC;AAGtC;;;GAGG;AACH,MAAM,WAAW,0BAA2B,SAAQ,WAAW;IAC7D,6CAA6C;IAC7C,QAAQ,EAAE,IAAI,CAAC;IACf,4EAA4E;IAC5E,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,yCAAyC;IACzC,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,IAAI,CAAC;IACnC,uBAAuB;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IAGvB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,8CAA8C;IAC9C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,yCAAyC;IACzC,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAClC;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,aAAa,EACb,UAAU,EACV,cAAc,EACd,KAAK,GACN,EACD,0BAA0B,qBA8HzB"}
@@ -35,20 +35,20 @@ const React = __importStar(require("react"));
35
35
  const appui_abstract_1 = require("@itwin/appui-abstract");
36
36
  const core_react_1 = require("@itwin/core-react");
37
37
  const itwinui_react_1 = require("@itwin/itwinui-react");
38
- const UiComponents_1 = require("../UiComponents");
39
38
  const DatePicker_1 = require("./DatePicker");
40
39
  const DateField_1 = require("./DateField");
41
40
  const TimeField_1 = require("./TimeField");
42
41
  require("./DatePickerPopupButton.scss");
42
+ const useTranslation_1 = require("../useTranslation");
43
43
  /** Component that displays a button used to pick a date and optionally a time.
44
44
  * @alpha
45
- * */
45
+ * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.
46
+ */
46
47
  function DatePickerPopupButton({ displayEditField, timeDisplay, selected, onDateChange, dateFormatter, buttonToolTip, fieldStyle, fieldClassName, style, }) {
48
+ const { translate } = (0, useTranslation_1.useTranslation)();
47
49
  const [workingDate, setWorkingDate] = React.useState(new Date(selected.getTime()));
48
50
  const [isSettingsOpen, setIsSettingsOpen] = React.useState(false);
49
- const timeLabelRef = React.useRef(UiComponents_1.UiComponents.translate("datepicker.time"));
50
- const toolTipLabelRef = React.useRef(UiComponents_1.UiComponents.translate("datepicker.selectDate"));
51
- const toolTipLabel = React.useMemo(() => (buttonToolTip ? buttonToolTip : toolTipLabelRef.current), [buttonToolTip]);
51
+ const toolTipLabel = buttonToolTip !== null && buttonToolTip !== void 0 ? buttonToolTip : translate("datepicker.selectDate");
52
52
  // See if props have changed since component mounted
53
53
  React.useEffect(() => {
54
54
  const newWorkingDate = new Date(selected.getTime());
@@ -97,9 +97,10 @@ function DatePickerPopupButton({ displayEditField, timeDisplay, selected, onDate
97
97
  React.createElement("path", { d: "M13,13H9V10h4ZM16,3V15a1,1,0,0,1-1,1H1a1,1,0,0,1-1-1V3A1,1,0,0,1,1,2H3V0H4V2h8V0h1V2h2A1,1,0,0,1,16,3ZM15,6H1v9H15Z" })))),
98
98
  React.createElement(core_react_1.Popup, { isOpen: isSettingsOpen, position: appui_abstract_1.RelativePosition.BottomLeft, onClose: handleCloseSetting, target: buttonRef.current, closeOnEnter: false, moveFocus: showFocusOutline, closeOnNestedPopupOutsideClick: true },
99
99
  React.createElement("div", { className: "components-date-picker-calendar-popup-panel", "data-testid": "components-date-picker-calendar-popup-panel" },
100
- React.createElement(DatePicker_1.DatePicker, { selected: workingDate, onDateChange: handleOnDateChanged, showFocusOutline: showFocusOutline }),
100
+ React.createElement(DatePicker_1.DatePicker // eslint-disable-line deprecation/deprecation
101
+ , { selected: workingDate, onDateChange: handleOnDateChanged, showFocusOutline: showFocusOutline }),
101
102
  timeDisplay && (React.createElement("div", { className: "time-container" },
102
- React.createElement(itwinui_react_1.Text, { variant: "body", className: "time-label" }, timeLabelRef.current),
103
+ React.createElement(itwinui_react_1.Text, { variant: "body", className: "time-label" }, translate("datepicker.time")),
103
104
  React.createElement(TimeField_1.TimeField, { time: timeSpec, timeDisplay: timeDisplay, onTimeChange: handleOnTimeChanged }))))),
104
105
  !!displayEditField && (React.createElement(DateField_1.DateField, { style: fieldStyle, className: fieldClassName, initialDate: workingDate, timeDisplay: timeDisplay, dateFormatter: dateFormatter, onDateChange: handleOnDateChanged }))));
105
106
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DatePickerPopupButton.js","sourceRoot":"","sources":["../../../../src/components-react/datepicker/DatePickerPopupButton.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,0DAAyD;AAEzD,kDAA0C;AAC1C,wDAA4C;AAC5C,kDAA+C;AAC/C,6CAA0C;AAC1C,2CAAwC;AAExC,2CAAwC;AACxC,wCAAsC;AAwBtC;;KAEK;AACL,SAAgB,qBAAqB,CAAC,EACpC,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,aAAa,EACb,UAAU,EACV,cAAc,EACd,KAAK,GACsB;IAC3B,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAClD,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAC7B,CAAC;IACF,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClE,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,2BAAY,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAAC;IA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Ed,6BAAK,SAAS,EAAC,mBAAmB;gBAChC,6BAAK,KAAK,EAAC,4BAA4B,EAAC,OAAO,EAAC,WAAW;oBACzD,8BAAM,CAAC,EAAC,qHAAqH,GAAG,CAC5H,CACF,CACC;QACT,oBAAC,kBAAK,IACJ,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,iCAAgB,CAAC,UAAU,EACrC,OAAO,EAAE,kBAAkB,EAC3B,MAAM,EAAE,SAAS,CAAC,OAAO,EACzB,YAAY,EAAE,KAAK,EACnB,SAAS,EAAE,gBAAgB,EAC3B,8BAA8B;YAE9B,6BACE,SAAS,EAAC,6CAA6C,iBAC3C,6CAA6C;gBAEzD,oBAAC,uBAAU,IACT,QAAQ,EAAE,WAAW,EACrB,YAAY,EAAE,mBAAmB,EACjC,gBAAgB,EAAE,gBAAgB,GAClC;gBACD,WAAW,IAAI,CACd,6BAAK,SAAS,EAAC,gBAAgB;oBAC7B,oBAAC,oBAAI,IAAC,OAAO,EAAC,MAAM,EAAC,SAAS,EAAC,YAAY,IACxC,YAAY,CAAC,OAAO,CAChB;oBACP,oBAAC,qBAAS,IACR,IAAI,EAAE,QAAQ,EACd,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,mBAAmB,GACjC,CACE,CACP,CACG,CACA;QACP,CAAC,CAAC,gBAAgB,IAAI,CACrB,oBAAC,qBAAS,IACR,KAAK,EAAE,UAAU,EACjB,SAAS,EAAE,cAAc,EACzB,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,mBAAmB,GACjC,CACH,CACA,CACJ,CAAC;AACJ,CAAC;AA9ID,sDA8IC","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 type { DateFormatter, TimeDisplay } from \"@itwin/appui-abstract\";\nimport { RelativePosition } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { Popup } from \"@itwin/core-react\";\nimport { Text } from \"@itwin/itwinui-react\";\nimport { UiComponents } from \"../UiComponents\";\nimport { DatePicker } from \"./DatePicker\";\nimport { DateField } from \"./DateField\";\nimport type { TimeSpec } from \"./TimeField\";\nimport { TimeField } from \"./TimeField\";\nimport \"./DatePickerPopupButton.scss\";\n\n/** Props used by [[DatePickerPopupButton]] component.\n * @alpha */\nexport interface DatePickerPopupButtonProps extends CommonProps {\n /** Date to be shown as the selected date. */\n selected: Date;\n /** If true show the date (and optionally time) edit field next to button */\n displayEditField?: boolean;\n // If defined show time in popup and also display time if input field is shown\n timeDisplay?: TimeDisplay;\n /** Function called when Date changes. */\n onDateChange?: (day: Date) => void;\n /** Optional tooltip */\n buttonToolTip?: string;\n /* Custom date formatter. WARNING: if used values will only be shown in specified format and will not be based on locale.\n * If used the existence of a parseDate function will determine if the edit field allows editing. */\n dateFormatter?: DateFormatter;\n /** User defined class name for edit field. */\n fieldClassName?: string;\n /** User defined style for edit field. */\n fieldStyle?: React.CSSProperties;\n}\n\n/** Component that displays a button used to pick a date and optionally a time.\n * @alpha\n * */\nexport function DatePickerPopupButton({\n displayEditField,\n timeDisplay,\n selected,\n onDateChange,\n dateFormatter,\n buttonToolTip,\n fieldStyle,\n fieldClassName,\n style,\n}: DatePickerPopupButtonProps) {\n const [workingDate, setWorkingDate] = React.useState(\n new Date(selected.getTime())\n );\n const [isSettingsOpen, setIsSettingsOpen] = React.useState(false);\n const timeLabelRef = React.useRef(UiComponents.translate(\"datepicker.time\"));\n const toolTipLabelRef = React.useRef(\n UiComponents.translate(\"datepicker.selectDate\")\n );\n const toolTipLabel = React.useMemo(\n () => (buttonToolTip ? buttonToolTip : toolTipLabelRef.current),\n [buttonToolTip]\n );\n\n // See if props have changed since component mounted\n React.useEffect(() => {\n const newWorkingDate = new Date(selected.getTime());\n setWorkingDate(newWorkingDate);\n }, [selected]);\n\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n const togglePopupDisplay = React.useCallback(\n (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n event.preventDefault();\n setShowFocusOutline(false);\n setIsSettingsOpen((prev) => !prev);\n },\n [setIsSettingsOpen]\n );\n\n const handleCloseSetting = React.useCallback(() => {\n setIsSettingsOpen(false);\n }, [setIsSettingsOpen]);\n\n const handleOnDateChanged = (day: Date) => {\n // combine current time into selected Date\n const newWorkingDate = new Date(day.getTime());\n newWorkingDate.setHours(\n workingDate.getHours(),\n workingDate.getMinutes(),\n workingDate.getSeconds()\n );\n onDateChange && onDateChange(newWorkingDate);\n !timeDisplay && setIsSettingsOpen(false);\n };\n\n const handleOnTimeChanged = (time: TimeSpec) => {\n // Combine new time into selected Date\n const newWorkingDate = new Date(workingDate.getTime());\n newWorkingDate.setHours(time.hours, time.minutes, time.seconds);\n setWorkingDate(newWorkingDate);\n onDateChange && onDateChange(newWorkingDate);\n };\n\n const [showFocusOutline, setShowFocusOutline] = React.useState(false);\n const handlePopupKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLButtonElement>) => {\n // istanbul ignore else\n if (event.key === \" \") {\n setShowFocusOutline(true);\n setIsSettingsOpen(true);\n }\n },\n []\n );\n\n const timeSpec: TimeSpec = {\n hours: workingDate.getHours(),\n minutes: workingDate.getMinutes(),\n seconds: workingDate.getSeconds(),\n };\n return (\n <>\n <button\n title={toolTipLabel}\n style={style}\n className=\"components-date-picker-calendar-popup-button\"\n onKeyDown={handlePopupKeyDown}\n data-testid=\"components-date-picker-calendar-popup-button\"\n onPointerDown={togglePopupDisplay}\n ref={buttonRef}\n >\n <div className=\"datepicker-button\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path d=\"M13,13H9V10h4ZM16,3V15a1,1,0,0,1-1,1H1a1,1,0,0,1-1-1V3A1,1,0,0,1,1,2H3V0H4V2h8V0h1V2h2A1,1,0,0,1,16,3ZM15,6H1v9H15Z\" />\n </svg>\n </div>\n </button>\n <Popup\n isOpen={isSettingsOpen}\n position={RelativePosition.BottomLeft}\n onClose={handleCloseSetting}\n target={buttonRef.current}\n closeOnEnter={false}\n moveFocus={showFocusOutline}\n closeOnNestedPopupOutsideClick\n >\n <div\n className=\"components-date-picker-calendar-popup-panel\"\n data-testid=\"components-date-picker-calendar-popup-panel\"\n >\n <DatePicker\n selected={workingDate}\n onDateChange={handleOnDateChanged}\n showFocusOutline={showFocusOutline}\n />\n {timeDisplay && (\n <div className=\"time-container\">\n <Text variant=\"body\" className=\"time-label\">\n {timeLabelRef.current}\n </Text>\n <TimeField\n time={timeSpec}\n timeDisplay={timeDisplay}\n onTimeChange={handleOnTimeChanged}\n />\n </div>\n )}\n </div>\n </Popup>\n {!!displayEditField && (\n <DateField\n style={fieldStyle}\n className={fieldClassName}\n initialDate={workingDate}\n timeDisplay={timeDisplay}\n dateFormatter={dateFormatter}\n onDateChange={handleOnDateChanged}\n />\n )}\n </>\n );\n}\n"]}
1
+ {"version":3,"file":"DatePickerPopupButton.js","sourceRoot":"","sources":["../../../../src/components-react/datepicker/DatePickerPopupButton.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,0DAAyD;AAEzD,kDAA0C;AAC1C,wDAA4C;AAC5C,6CAA0C;AAC1C,2CAAwC;AAExC,2CAAwC;AACxC,wCAAsC;AACtC,sDAAmD;AA0BnD;;;GAGG;AACH,SAAgB,qBAAqB,CAAC,EACpC,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,aAAa,EACb,UAAU,EACV,cAAc,EACd,KAAK,GAEmB;IACxB,MAAM,EAAE,SAAS,EAAE,GAAG,IAAA,+BAAc,GAAE,CAAC;IACvC,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KA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AK,SAAS,EAAC,mBAAmB;gBAChC,6BAAK,KAAK,EAAC,4BAA4B,EAAC,OAAO,EAAC,WAAW;oBACzD,8BAAM,CAAC,EAAC,qHAAqH,GAAG,CAC5H,CACF,CACC;QACT,oBAAC,kBAAK,IACJ,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,iCAAgB,CAAC,UAAU,EACrC,OAAO,EAAE,kBAAkB,EAC3B,MAAM,EAAE,SAAS,CAAC,OAAO,EACzB,YAAY,EAAE,KAAK,EACnB,SAAS,EAAE,gBAAgB,EAC3B,8BAA8B;YAE9B,6BACE,SAAS,EAAC,6CAA6C,iBAC3C,6CAA6C;gBAEzD,oBAAC,uBAAU,CAAC,8CAA8C;oBACxD,QAAQ,EAAE,WAAW,EACrB,YAAY,EAAE,mBAAmB,EACjC,gBAAgB,EAAE,gBAAgB,GAClC;gBACD,WAAW,IAAI,CACd,6BAAK,SAAS,EAAC,gBAAgB;oBAC7B,oBAAC,oBAAI,IAAC,OAAO,EAAC,MAAM,EAAC,SAAS,EAAC,YAAY,IACxC,SAAS,CAAC,iBAAiB,CAAC,CACxB;oBACP,oBAAC,qBAAS,IACR,IAAI,EAAE,QAAQ,EACd,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,mBAAmB,GACjC,CACE,CACP,CACG,CACA;QACP,CAAC,CAAC,gBAAgB,IAAI,CACrB,oBAAC,qBAAS,IACR,KAAK,EAAE,UAAU,EACjB,SAAS,EAAE,cAAc,EACzB,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,mBAAmB,GACjC,CACH,CACA,CACJ,CAAC;AACJ,CAAC;AAzID,sDAyIC","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 type { DateFormatter, TimeDisplay } from \"@itwin/appui-abstract\";\nimport { RelativePosition } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { Popup } from \"@itwin/core-react\";\nimport { Text } from \"@itwin/itwinui-react\";\nimport { DatePicker } from \"./DatePicker\";\nimport { DateField } from \"./DateField\";\nimport type { TimeSpec } from \"./TimeField\";\nimport { TimeField } from \"./TimeField\";\nimport \"./DatePickerPopupButton.scss\";\nimport { useTranslation } from \"../useTranslation\";\n\n/** Props used by [[DatePickerPopupButton]] component.\n * @alpha\n * @deprecated in 4.11.x. Props of deprecated component {@link DatePickerPopupButton}.\n */\nexport interface DatePickerPopupButtonProps extends CommonProps {\n /** Date to be shown as the selected date. */\n selected: Date;\n /** If true show the date (and optionally time) edit field next to button */\n displayEditField?: boolean;\n // If defined show time in popup and also display time if input field is shown\n timeDisplay?: TimeDisplay;\n /** Function called when Date changes. */\n onDateChange?: (day: Date) => void;\n /** Optional tooltip */\n buttonToolTip?: string;\n /* Custom date formatter. WARNING: if used values will only be shown in specified format and will not be based on locale.\n * If used the existence of a parseDate function will determine if the edit field allows editing. */\n dateFormatter?: DateFormatter;\n /** User defined class name for edit field. */\n fieldClassName?: string;\n /** User defined style for edit field. */\n fieldStyle?: React.CSSProperties;\n}\n\n/** Component that displays a button used to pick a date and optionally a time.\n * @alpha\n * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.\n */\nexport function DatePickerPopupButton({\n displayEditField,\n timeDisplay,\n selected,\n onDateChange,\n dateFormatter,\n buttonToolTip,\n fieldStyle,\n fieldClassName,\n style,\n}: // eslint-disable-next-line deprecation/deprecation\nDatePickerPopupButtonProps) {\n const { translate } = useTranslation();\n const [workingDate, setWorkingDate] = React.useState(\n new Date(selected.getTime())\n );\n const [isSettingsOpen, setIsSettingsOpen] = React.useState(false);\n const toolTipLabel = buttonToolTip ?? translate(\"datepicker.selectDate\");\n\n // See if props have changed since component mounted\n React.useEffect(() => {\n const newWorkingDate = new Date(selected.getTime());\n setWorkingDate(newWorkingDate);\n }, [selected]);\n\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n const togglePopupDisplay = React.useCallback(\n (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n event.preventDefault();\n setShowFocusOutline(false);\n setIsSettingsOpen((prev) => !prev);\n },\n [setIsSettingsOpen]\n );\n\n const handleCloseSetting = React.useCallback(() => {\n setIsSettingsOpen(false);\n }, [setIsSettingsOpen]);\n\n const handleOnDateChanged = (day: Date) => {\n // combine current time into selected Date\n const newWorkingDate = new Date(day.getTime());\n newWorkingDate.setHours(\n workingDate.getHours(),\n workingDate.getMinutes(),\n workingDate.getSeconds()\n );\n onDateChange && onDateChange(newWorkingDate);\n !timeDisplay && setIsSettingsOpen(false);\n };\n\n const handleOnTimeChanged = (time: TimeSpec) => {\n // Combine new time into selected Date\n const newWorkingDate = new Date(workingDate.getTime());\n newWorkingDate.setHours(time.hours, time.minutes, time.seconds);\n setWorkingDate(newWorkingDate);\n onDateChange && onDateChange(newWorkingDate);\n };\n\n const [showFocusOutline, setShowFocusOutline] = React.useState(false);\n const handlePopupKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLButtonElement>) => {\n // istanbul ignore else\n if (event.key === \" \") {\n setShowFocusOutline(true);\n setIsSettingsOpen(true);\n }\n },\n []\n );\n\n const timeSpec: TimeSpec = {\n hours: workingDate.getHours(),\n minutes: workingDate.getMinutes(),\n seconds: workingDate.getSeconds(),\n };\n return (\n <>\n <button\n title={toolTipLabel}\n style={style}\n className=\"components-date-picker-calendar-popup-button\"\n onKeyDown={handlePopupKeyDown}\n data-testid=\"components-date-picker-calendar-popup-button\"\n onPointerDown={togglePopupDisplay}\n ref={buttonRef}\n >\n <div className=\"datepicker-button\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path d=\"M13,13H9V10h4ZM16,3V15a1,1,0,0,1-1,1H1a1,1,0,0,1-1-1V3A1,1,0,0,1,1,2H3V0H4V2h8V0h1V2h2A1,1,0,0,1,16,3ZM15,6H1v9H15Z\" />\n </svg>\n </div>\n </button>\n <Popup\n isOpen={isSettingsOpen}\n position={RelativePosition.BottomLeft}\n onClose={handleCloseSetting}\n target={buttonRef.current}\n closeOnEnter={false}\n moveFocus={showFocusOutline}\n closeOnNestedPopupOutsideClick\n >\n <div\n className=\"components-date-picker-calendar-popup-panel\"\n data-testid=\"components-date-picker-calendar-popup-panel\"\n >\n <DatePicker // eslint-disable-line deprecation/deprecation\n selected={workingDate}\n onDateChange={handleOnDateChanged}\n showFocusOutline={showFocusOutline}\n />\n {timeDisplay && (\n <div className=\"time-container\">\n <Text variant=\"body\" className=\"time-label\">\n {translate(\"datepicker.time\")}\n </Text>\n <TimeField\n time={timeSpec}\n timeDisplay={timeDisplay}\n onTimeChange={handleOnTimeChanged}\n />\n </div>\n )}\n </div>\n </Popup>\n {!!displayEditField && (\n <DateField\n style={fieldStyle}\n className={fieldClassName}\n initialDate={workingDate}\n timeDisplay={timeDisplay}\n dateFormatter={dateFormatter}\n onDateChange={handleOnDateChanged}\n />\n )}\n </>\n );\n}\n"]}
@@ -9,6 +9,7 @@ import type { DateFormatter } from "@itwin/appui-abstract";
9
9
  * support parsing, so when used by [[DatePickerPopup]] the edit field will be readonly. If
10
10
  * a parseData function is implemented then the edit field will be editable.
11
11
  * @alpha
12
+ * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.
12
13
  */
13
14
  export declare class IntlFormatter implements DateFormatter {
14
15
  private _intlFormatter?;
@@ -1 +1 @@
1
- {"version":3,"file":"IntlFormatter.d.ts","sourceRoot":"","sources":["../../../../src/components-react/datepicker/IntlFormatter.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;;;;;;GAOG;AACH,qBAAa,aAAc,YAAW,aAAa;IACrC,OAAO,CAAC,cAAc,CAAC;gBAAf,cAAc,CAAC,iCAAqB;IAExD,IAAW,SAAS,IAAI,IAAI,CAAC,cAAc,CAgB1C;IAEM,WAAW,CAAC,GAAG,EAAE,IAAI;CAO7B"}
1
+ {"version":3,"file":"IntlFormatter.d.ts","sourceRoot":"","sources":["../../../../src/components-react/datepicker/IntlFormatter.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;;;;;;;GAQG;AACH,qBAAa,aAAc,YAAW,aAAa;IACrC,OAAO,CAAC,cAAc,CAAC;gBAAf,cAAc,CAAC,iCAAqB;IAExD,IAAW,SAAS,IAAI,IAAI,CAAC,cAAc,CAgB1C;IAEM,WAAW,CAAC,GAAG,EAAE,IAAI;CAO7B"}
@@ -15,6 +15,7 @@ exports.IntlFormatter = void 0;
15
15
  * support parsing, so when used by [[DatePickerPopup]] the edit field will be readonly. If
16
16
  * a parseData function is implemented then the edit field will be editable.
17
17
  * @alpha
18
+ * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.
18
19
  */
19
20
  class IntlFormatter {
20
21
  constructor(_intlFormatter) {
@@ -1 +1 @@
1
- {"version":3,"file":"IntlFormatter.js","sourceRoot":"","sources":["../../../../src/components-react/datepicker/IntlFormatter.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAIH;;;;;;;GAOG;AACH,MAAa,aAAa;IACxB,YAAoB,cAAoC;QAApC,mBAAc,GAAd,cAAc,CAAsB;IAAG,CAAC;IAE5D,IAAW,SAAS;QAClB,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;YACxB,+DAA+D;YAC/D,IAAI,CAAC,cAAc,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE;gBACvD,OAAO,EAAE,OAAO,CAAC,+BAA+B;gBAChD,IAAI,EAAE,SAAS,CAAC,0BAA0B;gBAC1C,KAAK,EAAE,SAAS,CAAC,qDAAqD;gBACtE,GAAG,EAAE,SAAS,CAAC,0BAA0B;gBACzC,IAAI,EAAE,SAAS,CAAC,0BAA0B;gBAC1C,MAAM,EAAE,IAAI;gBACZ,MAAM,EAAE,SAAS,CAAC,0BAA0B;gBAC5C,MAAM,EAAE,SAAS,CAAC,0BAA0B,CAAC,qBAAqB;gBAClE,4BAA4B;aAC7B,CAAC,CAAC;SACJ;QACD,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAEM,WAAW,CAAC,GAAS;QAC1B,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACpC,CAAC;CAKF;AA5BD,sCA4BC","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 type { DateFormatter } from \"@itwin/appui-abstract\";\n\n/**\n * A basic class that allows user to provide an Intl.DateTimeFormat\n * that can be used to format the date and time display. If no format is\n * specified a default format will be used. This default implementation does not\n * support parsing, so when used by [[DatePickerPopup]] the edit field will be readonly. If\n * a parseData function is implemented then the edit field will be editable.\n * @alpha\n */\nexport class IntlFormatter implements DateFormatter {\n constructor(private _intlFormatter?: Intl.DateTimeFormat) {}\n\n public get formatter(): Intl.DateTimeFormat {\n if (!this._intlFormatter) {\n // https://tc39.es/ecma402/#sec-intl-datetimeformat-constructor\n this._intlFormatter = new Intl.DateTimeFormat(undefined, {\n weekday: \"short\" /* \"narrow\", \"short\", \"long\" */,\n year: \"numeric\" /* \"2-digit\", \"numeric\" */,\n month: \"2-digit\" /* \"2-digit\", \"numeric\", \"narrow\", \"short\", \"long\" */,\n day: \"2-digit\" /* \"2-digit\", \"numeric\" */,\n hour: \"numeric\" /* \"2-digit\", \"numeric\" */,\n hour12: true,\n minute: \"numeric\" /* \"2-digit\", \"numeric\" */,\n second: \"numeric\" /* \"2-digit\", \"numeric\" */ /* \"short\", \"long\" */,\n /* timeZoneName:\t\"short\", */\n });\n }\n return this._intlFormatter;\n }\n\n public formateDate(day: Date) {\n return this.formatter.format(day);\n }\n\n // The default implementation does not currently support parsing. If a derived class supports parsing then the\n // parseDate function must be implemented.\n // parseDate(dateString: string): Date|undefined {}\n}\n"]}
1
+ {"version":3,"file":"IntlFormatter.js","sourceRoot":"","sources":["../../../../src/components-react/datepicker/IntlFormatter.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAIH;;;;;;;;GAQG;AACH,MAAa,aAAa;IACxB,YAAoB,cAAoC;QAApC,mBAAc,GAAd,cAAc,CAAsB;IAAG,CAAC;IAE5D,IAAW,SAAS;QAClB,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;YACxB,+DAA+D;YAC/D,IAAI,CAAC,cAAc,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE;gBACvD,OAAO,EAAE,OAAO,CAAC,+BAA+B;gBAChD,IAAI,EAAE,SAAS,CAAC,0BAA0B;gBAC1C,KAAK,EAAE,SAAS,CAAC,qDAAqD;gBACtE,GAAG,EAAE,SAAS,CAAC,0BAA0B;gBACzC,IAAI,EAAE,SAAS,CAAC,0BAA0B;gBAC1C,MAAM,EAAE,IAAI;gBACZ,MAAM,EAAE,SAAS,CAAC,0BAA0B;gBAC5C,MAAM,EAAE,SAAS,CAAC,0BAA0B,CAAC,qBAAqB;gBAClE,4BAA4B;aAC7B,CAAC,CAAC;SACJ;QACD,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAEM,WAAW,CAAC,GAAS;QAC1B,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACpC,CAAC;CAKF;AA5BD,sCA4BC","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 type { DateFormatter } from \"@itwin/appui-abstract\";\n\n/**\n * A basic class that allows user to provide an Intl.DateTimeFormat\n * that can be used to format the date and time display. If no format is\n * specified a default format will be used. This default implementation does not\n * support parsing, so when used by [[DatePickerPopup]] the edit field will be readonly. If\n * a parseData function is implemented then the edit field will be editable.\n * @alpha\n * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.\n */\nexport class IntlFormatter implements DateFormatter {\n constructor(private _intlFormatter?: Intl.DateTimeFormat) {}\n\n public get formatter(): Intl.DateTimeFormat {\n if (!this._intlFormatter) {\n // https://tc39.es/ecma402/#sec-intl-datetimeformat-constructor\n this._intlFormatter = new Intl.DateTimeFormat(undefined, {\n weekday: \"short\" /* \"narrow\", \"short\", \"long\" */,\n year: \"numeric\" /* \"2-digit\", \"numeric\" */,\n month: \"2-digit\" /* \"2-digit\", \"numeric\", \"narrow\", \"short\", \"long\" */,\n day: \"2-digit\" /* \"2-digit\", \"numeric\" */,\n hour: \"numeric\" /* \"2-digit\", \"numeric\" */,\n hour12: true,\n minute: \"numeric\" /* \"2-digit\", \"numeric\" */,\n second: \"numeric\" /* \"2-digit\", \"numeric\" */ /* \"short\", \"long\" */,\n /* timeZoneName:\t\"short\", */\n });\n }\n return this._intlFormatter;\n }\n\n public formateDate(day: Date) {\n return this.formatter.format(day);\n }\n\n // The default implementation does not currently support parsing. If a derived class supports parsing then the\n // parseDate function must be implemented.\n // parseDate(dateString: string): Date|undefined {}\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;AAI/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,C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