@itwin/components-react 4.0.0-dev.13 → 4.0.0-dev.15

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 (459) hide show
  1. package/CHANGELOG.md +129 -1
  2. package/README.md +2 -2
  3. package/lib/cjs/components-react/UiComponents.js.map +1 -1
  4. package/lib/cjs/components-react/_target.scss +9 -9
  5. package/lib/cjs/components-react/common/DateUtils.js.map +1 -1
  6. package/lib/cjs/components-react/common/DelayedSpinner.js.map +1 -1
  7. package/lib/cjs/components-react/common/HighlightedText.js.map +1 -1
  8. package/lib/cjs/components-react/common/HighlightingComponentProps.js.map +1 -1
  9. package/lib/cjs/components-react/common/IImageLoader.js.map +1 -1
  10. package/lib/cjs/components-react/common/ImageRenderer.js.map +1 -1
  11. package/lib/cjs/components-react/common/Links.js.map +1 -1
  12. package/lib/cjs/components-react/common/PageOptions.js.map +1 -1
  13. package/lib/cjs/components-react/common/SubscriptionScheduler.js.map +1 -1
  14. package/lib/cjs/components-react/common/UseAsyncValue.js.map +1 -1
  15. package/lib/cjs/components-react/common/UseContextWithMandatoryProvider.js.map +1 -1
  16. package/lib/cjs/components-react/common/UseDebouncedAsyncValue.d.ts +1 -0
  17. package/lib/cjs/components-react/common/UseDebouncedAsyncValue.d.ts.map +1 -1
  18. package/lib/cjs/components-react/common/UseDebouncedAsyncValue.js +12 -1
  19. package/lib/cjs/components-react/common/UseDebouncedAsyncValue.js.map +1 -1
  20. package/lib/cjs/components-react/common/UseRerender.js.map +1 -1
  21. package/lib/cjs/components-react/common/countMatchesInString.js.map +1 -1
  22. package/lib/cjs/components-react/common/selection/SelectionHandler.js.map +1 -1
  23. package/lib/cjs/components-react/common/selection/SelectionModes.js.map +1 -1
  24. package/lib/cjs/components-react/converters/BooleanTypeConverter.js.map +1 -1
  25. package/lib/cjs/components-react/converters/CompositeTypeConverter.js.map +1 -1
  26. package/lib/cjs/components-react/converters/DateTimeTypeConverter.js.map +1 -1
  27. package/lib/cjs/components-react/converters/EnumTypeConverter.js.map +1 -1
  28. package/lib/cjs/components-react/converters/HexadecimalTypeConverter.js.map +1 -1
  29. package/lib/cjs/components-react/converters/NavigationPropertyTypeConverter.js.map +1 -1
  30. package/lib/cjs/components-react/converters/NumericTypeConverter.js.map +1 -1
  31. package/lib/cjs/components-react/converters/PointTypeConverter.js.map +1 -1
  32. package/lib/cjs/components-react/converters/StringTypeConverter.js.map +1 -1
  33. package/lib/cjs/components-react/converters/TypeConverter.js.map +1 -1
  34. package/lib/cjs/components-react/converters/TypeConverterManager.js.map +1 -1
  35. package/lib/cjs/components-react/converters/valuetypes/ConvertedTypes.js.map +1 -1
  36. package/lib/cjs/components-react/datepicker/DateField.js.map +1 -1
  37. package/lib/cjs/components-react/datepicker/DateField.scss +22 -22
  38. package/lib/cjs/components-react/datepicker/DatePicker.js.map +1 -1
  39. package/lib/cjs/components-react/datepicker/DatePicker.scss +176 -176
  40. package/lib/cjs/components-react/datepicker/DatePickerPopupButton.js.map +1 -1
  41. package/lib/cjs/components-react/datepicker/DatePickerPopupButton.scss +57 -57
  42. package/lib/cjs/components-react/datepicker/IntlFormatter.js.map +1 -1
  43. package/lib/cjs/components-react/datepicker/TimeField.js.map +1 -1
  44. package/lib/cjs/components-react/datepicker/TimeField.scss +76 -76
  45. package/lib/cjs/components-react/editors/BooleanEditor.js.map +1 -1
  46. package/lib/cjs/components-react/editors/BooleanEditor.scss +22 -22
  47. package/lib/cjs/components-react/editors/CustomNumberEditor.js.map +1 -1
  48. package/lib/cjs/components-react/editors/CustomNumberEditor.scss +20 -20
  49. package/lib/cjs/components-react/editors/DateTimeEditor.js.map +1 -1
  50. package/lib/cjs/components-react/editors/DateTimeEditor.scss +9 -9
  51. package/lib/cjs/components-react/editors/EditorContainer.js.map +1 -1
  52. package/lib/cjs/components-react/editors/EditorContainer.scss +6 -6
  53. package/lib/cjs/components-react/editors/EnumButtonGroupEditor.js.map +1 -1
  54. package/lib/cjs/components-react/editors/EnumButtonGroupEditor.scss +141 -141
  55. package/lib/cjs/components-react/editors/EnumEditor.js.map +1 -1
  56. package/lib/cjs/components-react/editors/EnumEditor.scss +22 -22
  57. package/lib/cjs/components-react/editors/IconEditor.js.map +1 -1
  58. package/lib/cjs/components-react/editors/IconEditor.scss +16 -16
  59. package/lib/cjs/components-react/editors/ImageCheckBoxEditor.js.map +1 -1
  60. package/lib/cjs/components-react/editors/ImageCheckBoxEditor.scss +24 -24
  61. package/lib/cjs/components-react/editors/NumericInputEditor.js.map +1 -1
  62. package/lib/cjs/components-react/editors/NumericInputEditor.scss +16 -16
  63. package/lib/cjs/components-react/editors/PopupButton.js.map +1 -1
  64. package/lib/cjs/components-react/editors/PopupButton.scss +116 -116
  65. package/lib/cjs/components-react/editors/PropertyEditorManager.js.map +1 -1
  66. package/lib/cjs/components-react/editors/SliderEditor.js.map +1 -1
  67. package/lib/cjs/components-react/editors/SliderEditor.scss +13 -13
  68. package/lib/cjs/components-react/editors/TextEditor.js.map +1 -1
  69. package/lib/cjs/components-react/editors/TextEditor.scss +20 -20
  70. package/lib/cjs/components-react/editors/TextareaEditor.js.map +1 -1
  71. package/lib/cjs/components-react/editors/TextareaEditor.scss +14 -14
  72. package/lib/cjs/components-react/editors/ToggleEditor.js.map +1 -1
  73. package/lib/cjs/components-react/editors/ToggleEditor.scss +23 -23
  74. package/lib/cjs/components-react/editors/variables.scss +7 -7
  75. package/lib/cjs/components-react/favorite/FavoritePropertiesRenderer.js.map +1 -1
  76. package/lib/cjs/components-react/favorite/FavoritePropertyList.js.map +1 -1
  77. package/lib/cjs/components-react/filter-builder/FilterBuilder.js.map +1 -1
  78. package/lib/cjs/components-react/filter-builder/FilterBuilderContext.js.map +1 -1
  79. package/lib/cjs/components-react/filter-builder/FilterBuilderRule.js.map +1 -1
  80. package/lib/cjs/components-react/filter-builder/FilterBuilderRule.scss +38 -38
  81. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.js.map +1 -1
  82. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.scss +68 -68
  83. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
  84. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -1
  85. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
  86. package/lib/cjs/components-react/filter-builder/FilterBuilderState.js.map +1 -1
  87. package/lib/cjs/components-react/filter-builder/Operators.js.map +1 -1
  88. package/lib/cjs/components-react/filter-builder/Types.js.map +1 -1
  89. package/lib/cjs/components-react/filtering/FilteringInput.js.map +1 -1
  90. package/lib/cjs/components-react/filtering/FilteringInput.scss +58 -58
  91. package/lib/cjs/components-react/filtering/ResultSelector.js.map +1 -1
  92. package/lib/cjs/components-react/filtering/ResultSelector.scss +68 -68
  93. package/lib/cjs/components-react/iconpicker/IconPickerButton.js.map +1 -1
  94. package/lib/cjs/components-react/iconpicker/IconPickerButton.scss +75 -75
  95. package/lib/cjs/components-react/inputs/ParsedInput.js.map +1 -1
  96. package/lib/cjs/components-react/inputs/ParsedInput.scss +23 -23
  97. package/lib/cjs/components-react/properties/ItemStyle.js.map +1 -1
  98. package/lib/cjs/components-react/properties/LinkHandler.js.map +1 -1
  99. package/lib/cjs/components-react/properties/ValueRendererManager.js.map +1 -1
  100. package/lib/cjs/components-react/properties/renderers/ActionButtonList.js.map +1 -1
  101. package/lib/cjs/components-react/properties/renderers/ActionButtonList.scss +25 -25
  102. package/lib/cjs/components-react/properties/renderers/ActionButtonRenderer.js.map +1 -1
  103. package/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer.js.map +1 -1
  104. package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.js.map +1 -1
  105. package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.scss +17 -17
  106. package/lib/cjs/components-react/properties/renderers/PrimitivePropertyRenderer.js.map +1 -1
  107. package/lib/cjs/components-react/properties/renderers/PropertyGridColumns.js.map +1 -1
  108. package/lib/cjs/components-react/properties/renderers/PropertyRenderer.js.map +1 -1
  109. package/lib/cjs/components-react/properties/renderers/PropertyView.js.map +1 -1
  110. package/lib/cjs/components-react/properties/renderers/PropertyView.scss +104 -104
  111. package/lib/cjs/components-react/properties/renderers/label/NonPrimitivePropertyLabelRenderer.js.map +1 -1
  112. package/lib/cjs/components-react/properties/renderers/label/PrimitivePropertyLabelRenderer.js.map +1 -1
  113. package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.js.map +1 -1
  114. package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.scss +88 -88
  115. package/lib/cjs/components-react/properties/renderers/value/ArrayPropertyValueRenderer.js.map +1 -1
  116. package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.js.map +1 -1
  117. package/lib/cjs/components-react/properties/renderers/value/MergedPropertyValueRenderer.js.map +1 -1
  118. package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js.map +1 -1
  119. package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js.map +1 -1
  120. package/lib/cjs/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js.map +1 -1
  121. package/lib/cjs/components-react/properties/renderers/value/StructPropertyValueRenderer.js.map +1 -1
  122. package/lib/cjs/components-react/properties/renderers/value/UrlPropertyValueRenderer.js.map +1 -1
  123. package/lib/cjs/components-react/properties/renderers/value/WithContextStyle.js.map +1 -1
  124. package/lib/cjs/components-react/properties/renderers/value/table/ArrayValueRenderer.js.map +1 -1
  125. package/lib/cjs/components-react/properties/renderers/value/table/NonPrimitiveValueRenderer.js.map +1 -1
  126. package/lib/cjs/components-react/properties/renderers/value/table/StructValueRenderer.js.map +1 -1
  127. package/lib/cjs/components-react/propertygrid/PropertyCategoryRendererManager.js.map +1 -1
  128. package/lib/cjs/components-react/propertygrid/PropertyDataProvider.js.map +1 -1
  129. package/lib/cjs/components-react/propertygrid/SimplePropertyDataProvider.js.map +1 -1
  130. package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map +1 -1
  131. package/lib/cjs/components-react/propertygrid/component/FlatItemNestedBorderWrapper.js.map +1 -1
  132. package/lib/cjs/components-react/propertygrid/component/PropertyCategoryBlock.js.map +1 -1
  133. package/lib/cjs/components-react/propertygrid/component/PropertyGrid.js.map +1 -1
  134. package/lib/cjs/components-react/propertygrid/component/PropertyGrid.scss +73 -73
  135. package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
  136. package/lib/cjs/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.js.map +1 -1
  137. package/lib/cjs/components-react/propertygrid/component/PropertyList.js.map +1 -1
  138. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
  139. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.scss +101 -101
  140. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js.map +1 -1
  141. package/lib/cjs/components-react/propertygrid/dataproviders/FilteringDataProvider.js.map +1 -1
  142. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js.map +1 -1
  143. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js.map +1 -1
  144. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/LabelPropertyDataFilterer.js.map +1 -1
  145. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/PropertyCategoryLabelFilterer.js.map +1 -1
  146. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/PropertyDataFiltererBase.js.map +1 -1
  147. package/lib/cjs/components-react/propertygrid/internal/PropertyGridEventHandler.js.map +1 -1
  148. package/lib/cjs/components-react/propertygrid/internal/PropertyGridHooks.d.ts +2 -0
  149. package/lib/cjs/components-react/propertygrid/internal/PropertyGridHooks.d.ts.map +1 -1
  150. package/lib/cjs/components-react/propertygrid/internal/PropertyGridHooks.js +2 -0
  151. package/lib/cjs/components-react/propertygrid/internal/PropertyGridHooks.js.map +1 -1
  152. package/lib/cjs/components-react/propertygrid/internal/PropertyGridModel.js.map +1 -1
  153. package/lib/cjs/components-react/propertygrid/internal/PropertyGridModelChangeEvent.js.map +1 -1
  154. package/lib/cjs/components-react/propertygrid/internal/PropertyGridModelSource.js.map +1 -1
  155. package/lib/cjs/components-react/propertygrid/internal/flat-items/FlatGridItem.js.map +1 -1
  156. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCategorizedArrayProperty.js.map +1 -1
  157. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCategorizedPrimitiveProperty.js.map +1 -1
  158. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCategorizedStructProperty.js.map +1 -1
  159. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js.map +1 -1
  160. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
  161. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridCategory.js.map +1 -1
  162. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js.map +1 -1
  163. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js.map +1 -1
  164. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
  165. package/lib/cjs/components-react/selectable-content/SelectableContent.js.map +1 -1
  166. package/lib/cjs/components-react/selectable-content/SelectableContent.scss +20 -20
  167. package/lib/cjs/components-react/table/TableDataProvider.js.map +1 -1
  168. package/lib/cjs/components-react/toolbar/Item.js.map +1 -1
  169. package/lib/cjs/components-react/toolbar/Item.scss +91 -91
  170. package/lib/cjs/components-react/toolbar/ItemWrapper.js.map +1 -1
  171. package/lib/cjs/components-react/toolbar/ItemWrapper.scss +10 -10
  172. package/lib/cjs/components-react/toolbar/Items.js.map +1 -1
  173. package/lib/cjs/components-react/toolbar/Items.scss +96 -96
  174. package/lib/cjs/components-react/toolbar/Overflow.js.map +1 -1
  175. package/lib/cjs/components-react/toolbar/Overflow.scss +57 -57
  176. package/lib/cjs/components-react/toolbar/OverflowPanel.js.map +1 -1
  177. package/lib/cjs/components-react/toolbar/OverflowPanel.scss +37 -37
  178. package/lib/cjs/components-react/toolbar/PopupItem.js.map +1 -1
  179. package/lib/cjs/components-react/toolbar/PopupItem.scss +88 -88
  180. package/lib/cjs/components-react/toolbar/PopupItemWithDrag.js.map +1 -1
  181. package/lib/cjs/components-react/toolbar/PopupItemsPanel.js.map +1 -1
  182. package/lib/cjs/components-react/toolbar/Toolbar.js.map +1 -1
  183. package/lib/cjs/components-react/toolbar/Toolbar.scss +18 -18
  184. package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.js.map +1 -1
  185. package/lib/cjs/components-react/toolbar/_variables.scss +34 -34
  186. package/lib/cjs/components-react/toolbar/groupPanel/BackArrow.js.map +1 -1
  187. package/lib/cjs/components-react/toolbar/groupPanel/BackArrow.scss +44 -44
  188. package/lib/cjs/components-react/toolbar/groupPanel/Column.js.map +1 -1
  189. package/lib/cjs/components-react/toolbar/groupPanel/Column.scss +9 -9
  190. package/lib/cjs/components-react/toolbar/groupPanel/Columns.js.map +1 -1
  191. package/lib/cjs/components-react/toolbar/groupPanel/Columns.scss +10 -10
  192. package/lib/cjs/components-react/toolbar/groupPanel/Panel.js.map +1 -1
  193. package/lib/cjs/components-react/toolbar/groupPanel/Panel.scss +15 -15
  194. package/lib/cjs/components-react/toolbar/groupPanel/Title.js.map +1 -1
  195. package/lib/cjs/components-react/toolbar/groupPanel/Title.scss +33 -33
  196. package/lib/cjs/components-react/toolbar/groupPanel/_variables.scss +16 -16
  197. package/lib/cjs/components-react/toolbar/groupPanel/tool/Expander.js.map +1 -1
  198. package/lib/cjs/components-react/toolbar/groupPanel/tool/Expander.scss +29 -29
  199. package/lib/cjs/components-react/toolbar/groupPanel/tool/Tool.js.map +1 -1
  200. package/lib/cjs/components-react/toolbar/groupPanel/tool/Tool.scss +117 -117
  201. package/lib/cjs/components-react/toolbar/groupPanel/tool/_variables.scss +12 -12
  202. package/lib/cjs/components-react/toolbar/useDragInteraction.js.map +1 -1
  203. package/lib/cjs/components-react/toolbar/utilities/Direction.js.map +1 -1
  204. package/lib/cjs/components-react/tree/HighlightingEngine.js.map +1 -1
  205. package/lib/cjs/components-react/tree/HighlightingEngine.scss +7 -7
  206. package/lib/cjs/components-react/tree/ImageLoader.js.map +1 -1
  207. package/lib/cjs/components-react/tree/SimpleTreeDataProvider.js.map +1 -1
  208. package/lib/cjs/components-react/tree/TreeComponentTestId.js.map +1 -1
  209. package/lib/cjs/components-react/tree/TreeDataProvider.js.map +1 -1
  210. package/lib/cjs/components-react/tree/controlled/Observable.js.map +1 -1
  211. package/lib/cjs/components-react/tree/controlled/TreeActions.js.map +1 -1
  212. package/lib/cjs/components-react/tree/controlled/TreeEventDispatcher.js.map +1 -1
  213. package/lib/cjs/components-react/tree/controlled/TreeEventHandler.js.map +1 -1
  214. package/lib/cjs/components-react/tree/controlled/TreeEvents.js.map +1 -1
  215. package/lib/cjs/components-react/tree/controlled/TreeHooks.js.map +1 -1
  216. package/lib/cjs/components-react/tree/controlled/TreeModel.js.map +1 -1
  217. package/lib/cjs/components-react/tree/controlled/TreeModelSource.js.map +1 -1
  218. package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
  219. package/lib/cjs/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
  220. package/lib/cjs/components-react/tree/controlled/component/ControlledTree.scss +102 -102
  221. package/lib/cjs/components-react/tree/controlled/component/NodeContent.js.map +1 -1
  222. package/lib/cjs/components-react/tree/controlled/component/NodeContent.scss +27 -27
  223. package/lib/cjs/components-react/tree/controlled/component/TreeNodeEditor.js.map +1 -1
  224. package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.js.map +1 -1
  225. package/lib/cjs/components-react/tree/controlled/component/TreeRenderer.js.map +1 -1
  226. package/lib/cjs/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
  227. package/lib/cjs/components-react/tree/controlled/internal/TreeModelMutator.js.map +1 -1
  228. package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
  229. package/lib/cjs/components-react.js.map +1 -1
  230. package/lib/esm/components-react/UiComponents.js.map +1 -1
  231. package/lib/esm/components-react/_target.scss +9 -9
  232. package/lib/esm/components-react/common/DateUtils.js.map +1 -1
  233. package/lib/esm/components-react/common/DelayedSpinner.js.map +1 -1
  234. package/lib/esm/components-react/common/HighlightedText.js.map +1 -1
  235. package/lib/esm/components-react/common/HighlightingComponentProps.js.map +1 -1
  236. package/lib/esm/components-react/common/IImageLoader.js.map +1 -1
  237. package/lib/esm/components-react/common/ImageRenderer.js.map +1 -1
  238. package/lib/esm/components-react/common/Links.js.map +1 -1
  239. package/lib/esm/components-react/common/PageOptions.js.map +1 -1
  240. package/lib/esm/components-react/common/SubscriptionScheduler.js.map +1 -1
  241. package/lib/esm/components-react/common/UseAsyncValue.js.map +1 -1
  242. package/lib/esm/components-react/common/UseContextWithMandatoryProvider.js.map +1 -1
  243. package/lib/esm/components-react/common/UseDebouncedAsyncValue.d.ts +1 -0
  244. package/lib/esm/components-react/common/UseDebouncedAsyncValue.d.ts.map +1 -1
  245. package/lib/esm/components-react/common/UseDebouncedAsyncValue.js +12 -1
  246. package/lib/esm/components-react/common/UseDebouncedAsyncValue.js.map +1 -1
  247. package/lib/esm/components-react/common/UseRerender.js.map +1 -1
  248. package/lib/esm/components-react/common/countMatchesInString.js.map +1 -1
  249. package/lib/esm/components-react/common/selection/SelectionHandler.js.map +1 -1
  250. package/lib/esm/components-react/common/selection/SelectionModes.js.map +1 -1
  251. package/lib/esm/components-react/converters/BooleanTypeConverter.js.map +1 -1
  252. package/lib/esm/components-react/converters/CompositeTypeConverter.js.map +1 -1
  253. package/lib/esm/components-react/converters/DateTimeTypeConverter.js.map +1 -1
  254. package/lib/esm/components-react/converters/EnumTypeConverter.js.map +1 -1
  255. package/lib/esm/components-react/converters/HexadecimalTypeConverter.js.map +1 -1
  256. package/lib/esm/components-react/converters/NavigationPropertyTypeConverter.js.map +1 -1
  257. package/lib/esm/components-react/converters/NumericTypeConverter.js.map +1 -1
  258. package/lib/esm/components-react/converters/PointTypeConverter.js.map +1 -1
  259. package/lib/esm/components-react/converters/StringTypeConverter.js.map +1 -1
  260. package/lib/esm/components-react/converters/TypeConverter.js.map +1 -1
  261. package/lib/esm/components-react/converters/TypeConverterManager.js.map +1 -1
  262. package/lib/esm/components-react/converters/valuetypes/ConvertedTypes.js.map +1 -1
  263. package/lib/esm/components-react/datepicker/DateField.js.map +1 -1
  264. package/lib/esm/components-react/datepicker/DateField.scss +22 -22
  265. package/lib/esm/components-react/datepicker/DatePicker.js.map +1 -1
  266. package/lib/esm/components-react/datepicker/DatePicker.scss +176 -176
  267. package/lib/esm/components-react/datepicker/DatePickerPopupButton.js.map +1 -1
  268. package/lib/esm/components-react/datepicker/DatePickerPopupButton.scss +57 -57
  269. package/lib/esm/components-react/datepicker/IntlFormatter.js.map +1 -1
  270. package/lib/esm/components-react/datepicker/TimeField.js.map +1 -1
  271. package/lib/esm/components-react/datepicker/TimeField.scss +76 -76
  272. package/lib/esm/components-react/editors/BooleanEditor.js.map +1 -1
  273. package/lib/esm/components-react/editors/BooleanEditor.scss +22 -22
  274. package/lib/esm/components-react/editors/CustomNumberEditor.js.map +1 -1
  275. package/lib/esm/components-react/editors/CustomNumberEditor.scss +20 -20
  276. package/lib/esm/components-react/editors/DateTimeEditor.js.map +1 -1
  277. package/lib/esm/components-react/editors/DateTimeEditor.scss +9 -9
  278. package/lib/esm/components-react/editors/EditorContainer.js.map +1 -1
  279. package/lib/esm/components-react/editors/EditorContainer.scss +6 -6
  280. package/lib/esm/components-react/editors/EnumButtonGroupEditor.js.map +1 -1
  281. package/lib/esm/components-react/editors/EnumButtonGroupEditor.scss +141 -141
  282. package/lib/esm/components-react/editors/EnumEditor.js.map +1 -1
  283. package/lib/esm/components-react/editors/EnumEditor.scss +22 -22
  284. package/lib/esm/components-react/editors/IconEditor.js.map +1 -1
  285. package/lib/esm/components-react/editors/IconEditor.scss +16 -16
  286. package/lib/esm/components-react/editors/ImageCheckBoxEditor.js.map +1 -1
  287. package/lib/esm/components-react/editors/ImageCheckBoxEditor.scss +24 -24
  288. package/lib/esm/components-react/editors/NumericInputEditor.js.map +1 -1
  289. package/lib/esm/components-react/editors/NumericInputEditor.scss +16 -16
  290. package/lib/esm/components-react/editors/PopupButton.js.map +1 -1
  291. package/lib/esm/components-react/editors/PopupButton.scss +116 -116
  292. package/lib/esm/components-react/editors/PropertyEditorManager.js.map +1 -1
  293. package/lib/esm/components-react/editors/SliderEditor.js.map +1 -1
  294. package/lib/esm/components-react/editors/SliderEditor.scss +13 -13
  295. package/lib/esm/components-react/editors/TextEditor.js.map +1 -1
  296. package/lib/esm/components-react/editors/TextEditor.scss +20 -20
  297. package/lib/esm/components-react/editors/TextareaEditor.js.map +1 -1
  298. package/lib/esm/components-react/editors/TextareaEditor.scss +14 -14
  299. package/lib/esm/components-react/editors/ToggleEditor.js.map +1 -1
  300. package/lib/esm/components-react/editors/ToggleEditor.scss +23 -23
  301. package/lib/esm/components-react/editors/variables.scss +7 -7
  302. package/lib/esm/components-react/favorite/FavoritePropertiesRenderer.js.map +1 -1
  303. package/lib/esm/components-react/favorite/FavoritePropertyList.js.map +1 -1
  304. package/lib/esm/components-react/filter-builder/FilterBuilder.js.map +1 -1
  305. package/lib/esm/components-react/filter-builder/FilterBuilderContext.js.map +1 -1
  306. package/lib/esm/components-react/filter-builder/FilterBuilderRule.js.map +1 -1
  307. package/lib/esm/components-react/filter-builder/FilterBuilderRule.scss +38 -38
  308. package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.js.map +1 -1
  309. package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.scss +68 -68
  310. package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
  311. package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -1
  312. package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
  313. package/lib/esm/components-react/filter-builder/FilterBuilderState.js.map +1 -1
  314. package/lib/esm/components-react/filter-builder/Operators.js.map +1 -1
  315. package/lib/esm/components-react/filter-builder/Types.js.map +1 -1
  316. package/lib/esm/components-react/filtering/FilteringInput.js.map +1 -1
  317. package/lib/esm/components-react/filtering/FilteringInput.scss +58 -58
  318. package/lib/esm/components-react/filtering/ResultSelector.js.map +1 -1
  319. package/lib/esm/components-react/filtering/ResultSelector.scss +68 -68
  320. package/lib/esm/components-react/iconpicker/IconPickerButton.js.map +1 -1
  321. package/lib/esm/components-react/iconpicker/IconPickerButton.scss +75 -75
  322. package/lib/esm/components-react/inputs/ParsedInput.js.map +1 -1
  323. package/lib/esm/components-react/inputs/ParsedInput.scss +23 -23
  324. package/lib/esm/components-react/properties/ItemStyle.js.map +1 -1
  325. package/lib/esm/components-react/properties/LinkHandler.js.map +1 -1
  326. package/lib/esm/components-react/properties/ValueRendererManager.js.map +1 -1
  327. package/lib/esm/components-react/properties/renderers/ActionButtonList.js.map +1 -1
  328. package/lib/esm/components-react/properties/renderers/ActionButtonList.scss +25 -25
  329. package/lib/esm/components-react/properties/renderers/ActionButtonRenderer.js.map +1 -1
  330. package/lib/esm/components-react/properties/renderers/CommonPropertyRenderer.js.map +1 -1
  331. package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.js.map +1 -1
  332. package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.scss +17 -17
  333. package/lib/esm/components-react/properties/renderers/PrimitivePropertyRenderer.js.map +1 -1
  334. package/lib/esm/components-react/properties/renderers/PropertyGridColumns.js.map +1 -1
  335. package/lib/esm/components-react/properties/renderers/PropertyRenderer.js.map +1 -1
  336. package/lib/esm/components-react/properties/renderers/PropertyView.js.map +1 -1
  337. package/lib/esm/components-react/properties/renderers/PropertyView.scss +104 -104
  338. package/lib/esm/components-react/properties/renderers/label/NonPrimitivePropertyLabelRenderer.js.map +1 -1
  339. package/lib/esm/components-react/properties/renderers/label/PrimitivePropertyLabelRenderer.js.map +1 -1
  340. package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.js.map +1 -1
  341. package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.scss +88 -88
  342. package/lib/esm/components-react/properties/renderers/value/ArrayPropertyValueRenderer.js.map +1 -1
  343. package/lib/esm/components-react/properties/renderers/value/DoublePropertyValueRenderer.js.map +1 -1
  344. package/lib/esm/components-react/properties/renderers/value/MergedPropertyValueRenderer.js.map +1 -1
  345. package/lib/esm/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js.map +1 -1
  346. package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js.map +1 -1
  347. package/lib/esm/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js.map +1 -1
  348. package/lib/esm/components-react/properties/renderers/value/StructPropertyValueRenderer.js.map +1 -1
  349. package/lib/esm/components-react/properties/renderers/value/UrlPropertyValueRenderer.js.map +1 -1
  350. package/lib/esm/components-react/properties/renderers/value/WithContextStyle.js.map +1 -1
  351. package/lib/esm/components-react/properties/renderers/value/table/ArrayValueRenderer.js.map +1 -1
  352. package/lib/esm/components-react/properties/renderers/value/table/NonPrimitiveValueRenderer.js.map +1 -1
  353. package/lib/esm/components-react/properties/renderers/value/table/StructValueRenderer.js.map +1 -1
  354. package/lib/esm/components-react/propertygrid/PropertyCategoryRendererManager.js.map +1 -1
  355. package/lib/esm/components-react/propertygrid/PropertyDataProvider.js.map +1 -1
  356. package/lib/esm/components-react/propertygrid/SimplePropertyDataProvider.js.map +1 -1
  357. package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map +1 -1
  358. package/lib/esm/components-react/propertygrid/component/FlatItemNestedBorderWrapper.js.map +1 -1
  359. package/lib/esm/components-react/propertygrid/component/PropertyCategoryBlock.js.map +1 -1
  360. package/lib/esm/components-react/propertygrid/component/PropertyGrid.js.map +1 -1
  361. package/lib/esm/components-react/propertygrid/component/PropertyGrid.scss +73 -73
  362. package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
  363. package/lib/esm/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.js.map +1 -1
  364. package/lib/esm/components-react/propertygrid/component/PropertyList.js.map +1 -1
  365. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
  366. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.scss +101 -101
  367. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js.map +1 -1
  368. package/lib/esm/components-react/propertygrid/dataproviders/FilteringDataProvider.js.map +1 -1
  369. package/lib/esm/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js.map +1 -1
  370. package/lib/esm/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js.map +1 -1
  371. package/lib/esm/components-react/propertygrid/dataproviders/filterers/LabelPropertyDataFilterer.js.map +1 -1
  372. package/lib/esm/components-react/propertygrid/dataproviders/filterers/PropertyCategoryLabelFilterer.js.map +1 -1
  373. package/lib/esm/components-react/propertygrid/dataproviders/filterers/PropertyDataFiltererBase.js.map +1 -1
  374. package/lib/esm/components-react/propertygrid/internal/PropertyGridEventHandler.js.map +1 -1
  375. package/lib/esm/components-react/propertygrid/internal/PropertyGridHooks.d.ts +2 -0
  376. package/lib/esm/components-react/propertygrid/internal/PropertyGridHooks.d.ts.map +1 -1
  377. package/lib/esm/components-react/propertygrid/internal/PropertyGridHooks.js +2 -0
  378. package/lib/esm/components-react/propertygrid/internal/PropertyGridHooks.js.map +1 -1
  379. package/lib/esm/components-react/propertygrid/internal/PropertyGridModel.js.map +1 -1
  380. package/lib/esm/components-react/propertygrid/internal/PropertyGridModelChangeEvent.js.map +1 -1
  381. package/lib/esm/components-react/propertygrid/internal/PropertyGridModelSource.js.map +1 -1
  382. package/lib/esm/components-react/propertygrid/internal/flat-items/FlatGridItem.js.map +1 -1
  383. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCategorizedArrayProperty.js.map +1 -1
  384. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCategorizedPrimitiveProperty.js.map +1 -1
  385. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCategorizedStructProperty.js.map +1 -1
  386. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js.map +1 -1
  387. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
  388. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.js.map +1 -1
  389. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js.map +1 -1
  390. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js.map +1 -1
  391. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
  392. package/lib/esm/components-react/selectable-content/SelectableContent.js.map +1 -1
  393. package/lib/esm/components-react/selectable-content/SelectableContent.scss +20 -20
  394. package/lib/esm/components-react/table/TableDataProvider.js.map +1 -1
  395. package/lib/esm/components-react/toolbar/Item.js.map +1 -1
  396. package/lib/esm/components-react/toolbar/Item.scss +91 -91
  397. package/lib/esm/components-react/toolbar/ItemWrapper.js.map +1 -1
  398. package/lib/esm/components-react/toolbar/ItemWrapper.scss +10 -10
  399. package/lib/esm/components-react/toolbar/Items.js.map +1 -1
  400. package/lib/esm/components-react/toolbar/Items.scss +96 -96
  401. package/lib/esm/components-react/toolbar/Overflow.js.map +1 -1
  402. package/lib/esm/components-react/toolbar/Overflow.scss +57 -57
  403. package/lib/esm/components-react/toolbar/OverflowPanel.js.map +1 -1
  404. package/lib/esm/components-react/toolbar/OverflowPanel.scss +37 -37
  405. package/lib/esm/components-react/toolbar/PopupItem.js.map +1 -1
  406. package/lib/esm/components-react/toolbar/PopupItem.scss +88 -88
  407. package/lib/esm/components-react/toolbar/PopupItemWithDrag.js.map +1 -1
  408. package/lib/esm/components-react/toolbar/PopupItemsPanel.js.map +1 -1
  409. package/lib/esm/components-react/toolbar/Toolbar.js.map +1 -1
  410. package/lib/esm/components-react/toolbar/Toolbar.scss +18 -18
  411. package/lib/esm/components-react/toolbar/ToolbarWithOverflow.js.map +1 -1
  412. package/lib/esm/components-react/toolbar/_variables.scss +34 -34
  413. package/lib/esm/components-react/toolbar/groupPanel/BackArrow.js.map +1 -1
  414. package/lib/esm/components-react/toolbar/groupPanel/BackArrow.scss +44 -44
  415. package/lib/esm/components-react/toolbar/groupPanel/Column.js.map +1 -1
  416. package/lib/esm/components-react/toolbar/groupPanel/Column.scss +9 -9
  417. package/lib/esm/components-react/toolbar/groupPanel/Columns.js.map +1 -1
  418. package/lib/esm/components-react/toolbar/groupPanel/Columns.scss +10 -10
  419. package/lib/esm/components-react/toolbar/groupPanel/Panel.js.map +1 -1
  420. package/lib/esm/components-react/toolbar/groupPanel/Panel.scss +15 -15
  421. package/lib/esm/components-react/toolbar/groupPanel/Title.js.map +1 -1
  422. package/lib/esm/components-react/toolbar/groupPanel/Title.scss +33 -33
  423. package/lib/esm/components-react/toolbar/groupPanel/_variables.scss +16 -16
  424. package/lib/esm/components-react/toolbar/groupPanel/tool/Expander.js.map +1 -1
  425. package/lib/esm/components-react/toolbar/groupPanel/tool/Expander.scss +29 -29
  426. package/lib/esm/components-react/toolbar/groupPanel/tool/Tool.js.map +1 -1
  427. package/lib/esm/components-react/toolbar/groupPanel/tool/Tool.scss +117 -117
  428. package/lib/esm/components-react/toolbar/groupPanel/tool/_variables.scss +12 -12
  429. package/lib/esm/components-react/toolbar/useDragInteraction.js.map +1 -1
  430. package/lib/esm/components-react/toolbar/utilities/Direction.js.map +1 -1
  431. package/lib/esm/components-react/tree/HighlightingEngine.js.map +1 -1
  432. package/lib/esm/components-react/tree/HighlightingEngine.scss +7 -7
  433. package/lib/esm/components-react/tree/ImageLoader.js.map +1 -1
  434. package/lib/esm/components-react/tree/SimpleTreeDataProvider.js.map +1 -1
  435. package/lib/esm/components-react/tree/TreeComponentTestId.js.map +1 -1
  436. package/lib/esm/components-react/tree/TreeDataProvider.js.map +1 -1
  437. package/lib/esm/components-react/tree/controlled/Observable.js.map +1 -1
  438. package/lib/esm/components-react/tree/controlled/TreeActions.js.map +1 -1
  439. package/lib/esm/components-react/tree/controlled/TreeEventDispatcher.js.map +1 -1
  440. package/lib/esm/components-react/tree/controlled/TreeEventHandler.js.map +1 -1
  441. package/lib/esm/components-react/tree/controlled/TreeEvents.js.map +1 -1
  442. package/lib/esm/components-react/tree/controlled/TreeHooks.js.map +1 -1
  443. package/lib/esm/components-react/tree/controlled/TreeModel.js.map +1 -1
  444. package/lib/esm/components-react/tree/controlled/TreeModelSource.js.map +1 -1
  445. package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
  446. package/lib/esm/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
  447. package/lib/esm/components-react/tree/controlled/component/ControlledTree.scss +102 -102
  448. package/lib/esm/components-react/tree/controlled/component/NodeContent.js.map +1 -1
  449. package/lib/esm/components-react/tree/controlled/component/NodeContent.scss +27 -27
  450. package/lib/esm/components-react/tree/controlled/component/TreeNodeEditor.js.map +1 -1
  451. package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.js.map +1 -1
  452. package/lib/esm/components-react/tree/controlled/component/TreeRenderer.js.map +1 -1
  453. package/lib/esm/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
  454. package/lib/esm/components-react/tree/controlled/internal/TreeModelMutator.js.map +1 -1
  455. package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
  456. package/lib/esm/components-react.js.map +1 -1
  457. package/lib/public/locales/en/UiComponents.json +139 -139
  458. package/package.json +16 -14
  459. package/ThirdPartyNotices.md +0 -31
@@ -1 +1 @@
1
- {"version":3,"file":"DateField.js","sourceRoot":"","sources":["../../../../src/components-react/datepicker/DateField.tsx"],"names":[],"mappings":";AAAA;;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BAA2B,CAAC,CAAC;IAC9G,OAAO,oBAAC,qBAAK,mBAAa,uBAAuB,EAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EACpI,QAAQ,EAAE,iBAAiB,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,IAAI,CAAC,aAAa,IAAI,CAAC,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,EAAC,OAAO,GAAG,CAAC;AACzI,CAAC;AAjED,8BAiEC","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 \"./DateField.scss\";\nimport * as React from \"react\";\nimport classnames from \"classnames\";\nimport { AlternateDateFormats, DateFormatter, TimeDisplay } from \"@itwin/appui-abstract\";\nimport { CommonProps } from \"@itwin/core-react\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport { Logger } from \"@itwin/core-bentley\";\n\n/** Props for [[DateField]] Component.\n * @internal\n */\nexport interface DateFieldProps extends CommonProps {\n /** Defines initial date and time for component. */\n initialDate: Date;\n /** Function to call when the date or time is changed. */\n onDateChange?: (day: Date) => void;\n /** Optional value to define if edit field allows editing. If a DateFormatter is provided\n * it must provide a parseData function or the field will be read only no matter the setting of this value. */\n readOnly?: boolean;\n /** Optional date formatter that produces an explicit date display */\n dateFormatter?: DateFormatter;\n /** This property has two purposes, the first is specify that the display of time is desired and the second is to define the format of the time display. */\n timeDisplay?: TimeDisplay;\n}\n\n/** Function to format a Date object that is used in control, type editor, and type converter\n * to produce a consistent formatted Date string.\n * @internal\n */\nexport function formatInputDate(inputDate: Date, timeDisplay?: TimeDisplay, customFormatter?: DateFormatter, alternateDateFormat?: AlternateDateFormats): string | undefined {\n if (customFormatter) {\n return customFormatter.formateDate(inputDate);\n }\n\n if (alternateDateFormat) {\n switch (alternateDateFormat) {\n case AlternateDateFormats.IsoDateTime:\n return inputDate.toISOString();\n case AlternateDateFormats.IsoShort:\n return inputDate.toISOString().slice(0, 10);\n case AlternateDateFormats.UtcDateTime:\n return inputDate.toUTCString().slice(5);\n case AlternateDateFormats.UtcShort:\n return inputDate.toUTCString().slice(5, 16);\n case AlternateDateFormats.UtcDateTimeWithDay:\n return inputDate.toUTCString();\n case AlternateDateFormats.UtcShortWithDay:\n return inputDate.toUTCString().slice(0, 16);\n }\n } else {\n const dateString = inputDate.toLocaleDateString(undefined, { day: \"2-digit\", month: \"2-digit\", year: \"numeric\" });\n let timeString: string = \"\";\n\n if (timeDisplay) {\n switch (timeDisplay) {\n case TimeDisplay.H12MC:\n timeString = inputDate.toLocaleTimeString(undefined, { hour12: true, hour: \"2-digit\", minute: \"2-digit\" });\n break;\n case TimeDisplay.H12MSC:\n timeString = (inputDate.toLocaleTimeString(undefined, { hour12: true, hour: \"2-digit\", minute: \"2-digit\", second: \"2-digit\" }));\n break;\n case TimeDisplay.H24M:\n timeString = (inputDate.toLocaleTimeString(undefined, { hour12: false, hour: \"2-digit\", minute: \"2-digit\" }));\n // istanbul ignore next\n if (timeString === \"24:00\")\n timeString = \"00:00\";\n break;\n case TimeDisplay.H24MS:\n timeString = (inputDate.toLocaleTimeString(undefined, { hour12: false, hour: \"2-digit\", minute: \"2-digit\", second: \"2-digit\" }));\n // istanbul ignore next\n if (timeString === \"24:00:00\")\n timeString = \"00:00:00\";\n break;\n }\n }\n return timeString.length ? `${dateString}, ${timeString}` : dateString;\n }\n}\n\n/** Date input component. This component is typically used by the [[DatePickerPopupButton]] to display and edit date and time.\n * @internal\n */\nexport function DateField({ initialDate, onDateChange, readOnly, dateFormatter, timeDisplay, style, className }: DateFieldProps) {\n const initialDateRef = React.useRef(initialDate);\n const [hasBadInput, setHasBadInput] = React.useState(false);\n const [inputValue, setInputValue] = React.useState(formatInputDate(initialDate, timeDisplay, dateFormatter));\n\n // See if new initialDate props have changed since component mounted\n React.useEffect(() => {\n // istanbul ignore else\n if (initialDate.getTime() !== initialDateRef.current.getTime()) {\n initialDateRef.current = initialDate;\n }\n setInputValue(formatInputDate(initialDate, timeDisplay, dateFormatter));\n }, [initialDate, dateFormatter, timeDisplay]);\n\n const handleInputChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\n setInputValue(event.currentTarget.value);\n }, []);\n\n const parseDate = React.useCallback((dateString: string) => {\n try {\n if (dateFormatter && dateFormatter.parseDate)\n return dateFormatter.parseDate(dateString);\n\n const newDateValue = Date.parse(dateString);\n // istanbul ignore else\n if (newDateValue)\n return new Date(newDateValue);\n } catch (_error) /* istanbul ignore next */ {\n Logger.logInfo(\"DateField\", `Encountered error parsing input value '${dateString}' as a date.`);\n return undefined;\n }\n // istanbul ignore next\n return undefined;\n }, [dateFormatter]);\n\n const updateInputDate = React.useCallback((dateString: string) => {\n try {\n const newDateValue = parseDate(dateString);\n if (newDateValue) {\n const newDate = new Date(newDateValue);\n onDateChange && onDateChange(newDate);\n setHasBadInput(false);\n } else {\n setHasBadInput(true);\n }\n } catch (_error) {\n // istanbul ignore next\n setHasBadInput(true);\n }\n }, [onDateChange, parseDate]);\n\n const handleOnBlur = React.useCallback((event: React.FocusEvent<HTMLInputElement>) => {\n updateInputDate(event.target.value);\n }, [updateInputDate]);\n\n function onInputKeyDown(event: React.KeyboardEvent<HTMLInputElement>): void {\n // istanbul ignore else\n if (event.key === \"Enter\") {\n updateInputDate(event.currentTarget.value);\n event.preventDefault();\n }\n }\n const classNames = classnames(className, \"components-date-input\", hasBadInput && \"components-date-has-error\");\n return <Input data-testid=\"components-date-input\" style={style} className={classNames} onKeyDown={onInputKeyDown} onBlur={handleOnBlur}\n onChange={handleInputChange} value={inputValue} disabled={readOnly || (dateFormatter && !(dateFormatter.parseDate))} size=\"small\" />;\n}\n"]}
1
+ {"version":3,"file":"DateField.js","sourceRoot":"","sources":["../../../../src/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C,SAAS,EAAE,uBAAuB,EAAE,WAAW,IAAI,2BAA2B,CAAC,CAAC;IAC9G,OAAO,oBAAC,qBAAK,mBAAa,uBAAuB,EAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EACpI,QAAQ,EAAE,iBAAiB,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,IAAI,CAAC,aAAa,IAAI,CAAC,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,EAAC,OAAO,GAAG,CAAC;AACzI,CAAC;AAjED,8BAiEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Date\r\n */\r\n\r\nimport \"./DateField.scss\";\r\nimport * as React from \"react\";\r\nimport classnames from \"classnames\";\r\nimport { AlternateDateFormats, DateFormatter, TimeDisplay } from \"@itwin/appui-abstract\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { Input } from \"@itwin/itwinui-react\";\r\nimport { Logger } from \"@itwin/core-bentley\";\r\n\r\n/** Props for [[DateField]] Component.\r\n * @internal\r\n */\r\nexport interface DateFieldProps extends CommonProps {\r\n /** Defines initial date and time for component. */\r\n initialDate: Date;\r\n /** Function to call when the date or time is changed. */\r\n onDateChange?: (day: Date) => void;\r\n /** Optional value to define if edit field allows editing. If a DateFormatter is provided\r\n * it must provide a parseData function or the field will be read only no matter the setting of this value. */\r\n readOnly?: boolean;\r\n /** Optional date formatter that produces an explicit date display */\r\n dateFormatter?: DateFormatter;\r\n /** This property has two purposes, the first is specify that the display of time is desired and the second is to define the format of the time display. */\r\n timeDisplay?: TimeDisplay;\r\n}\r\n\r\n/** Function to format a Date object that is used in control, type editor, and type converter\r\n * to produce a consistent formatted Date string.\r\n * @internal\r\n */\r\nexport function formatInputDate(inputDate: Date, timeDisplay?: TimeDisplay, customFormatter?: DateFormatter, alternateDateFormat?: AlternateDateFormats): string | undefined {\r\n if (customFormatter) {\r\n return customFormatter.formateDate(inputDate);\r\n }\r\n\r\n if (alternateDateFormat) {\r\n switch (alternateDateFormat) {\r\n case AlternateDateFormats.IsoDateTime:\r\n return inputDate.toISOString();\r\n case AlternateDateFormats.IsoShort:\r\n return inputDate.toISOString().slice(0, 10);\r\n case AlternateDateFormats.UtcDateTime:\r\n return inputDate.toUTCString().slice(5);\r\n case AlternateDateFormats.UtcShort:\r\n return inputDate.toUTCString().slice(5, 16);\r\n case AlternateDateFormats.UtcDateTimeWithDay:\r\n return inputDate.toUTCString();\r\n case AlternateDateFormats.UtcShortWithDay:\r\n return inputDate.toUTCString().slice(0, 16);\r\n }\r\n } else {\r\n const dateString = inputDate.toLocaleDateString(undefined, { day: \"2-digit\", month: \"2-digit\", year: \"numeric\" });\r\n let timeString: string = \"\";\r\n\r\n if (timeDisplay) {\r\n switch (timeDisplay) {\r\n case TimeDisplay.H12MC:\r\n timeString = inputDate.toLocaleTimeString(undefined, { hour12: true, hour: \"2-digit\", minute: \"2-digit\" });\r\n break;\r\n case TimeDisplay.H12MSC:\r\n timeString = (inputDate.toLocaleTimeString(undefined, { hour12: true, hour: \"2-digit\", minute: \"2-digit\", second: \"2-digit\" }));\r\n break;\r\n case TimeDisplay.H24M:\r\n timeString = (inputDate.toLocaleTimeString(undefined, { hour12: false, hour: \"2-digit\", minute: \"2-digit\" }));\r\n // istanbul ignore next\r\n if (timeString === \"24:00\")\r\n timeString = \"00:00\";\r\n break;\r\n case TimeDisplay.H24MS:\r\n timeString = (inputDate.toLocaleTimeString(undefined, { hour12: false, hour: \"2-digit\", minute: \"2-digit\", second: \"2-digit\" }));\r\n // istanbul ignore next\r\n if (timeString === \"24:00:00\")\r\n timeString = \"00:00:00\";\r\n break;\r\n }\r\n }\r\n return timeString.length ? `${dateString}, ${timeString}` : dateString;\r\n }\r\n}\r\n\r\n/** Date input component. This component is typically used by the [[DatePickerPopupButton]] to display and edit date and time.\r\n * @internal\r\n */\r\nexport function DateField({ initialDate, onDateChange, readOnly, dateFormatter, timeDisplay, style, className }: DateFieldProps) {\r\n const initialDateRef = React.useRef(initialDate);\r\n const [hasBadInput, setHasBadInput] = React.useState(false);\r\n const [inputValue, setInputValue] = React.useState(formatInputDate(initialDate, timeDisplay, dateFormatter));\r\n\r\n // See if new initialDate props have changed since component mounted\r\n React.useEffect(() => {\r\n // istanbul ignore else\r\n if (initialDate.getTime() !== initialDateRef.current.getTime()) {\r\n initialDateRef.current = initialDate;\r\n }\r\n setInputValue(formatInputDate(initialDate, timeDisplay, dateFormatter));\r\n }, [initialDate, dateFormatter, timeDisplay]);\r\n\r\n const handleInputChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\r\n setInputValue(event.currentTarget.value);\r\n }, []);\r\n\r\n const parseDate = React.useCallback((dateString: string) => {\r\n try {\r\n if (dateFormatter && dateFormatter.parseDate)\r\n return dateFormatter.parseDate(dateString);\r\n\r\n const newDateValue = Date.parse(dateString);\r\n // istanbul ignore else\r\n if (newDateValue)\r\n return new Date(newDateValue);\r\n } catch (_error) /* istanbul ignore next */ {\r\n Logger.logInfo(\"DateField\", `Encountered error parsing input value '${dateString}' as a date.`);\r\n return undefined;\r\n }\r\n // istanbul ignore next\r\n return undefined;\r\n }, [dateFormatter]);\r\n\r\n const updateInputDate = React.useCallback((dateString: string) => {\r\n try {\r\n const newDateValue = parseDate(dateString);\r\n if (newDateValue) {\r\n const newDate = new Date(newDateValue);\r\n onDateChange && onDateChange(newDate);\r\n setHasBadInput(false);\r\n } else {\r\n setHasBadInput(true);\r\n }\r\n } catch (_error) {\r\n // istanbul ignore next\r\n setHasBadInput(true);\r\n }\r\n }, [onDateChange, parseDate]);\r\n\r\n const handleOnBlur = React.useCallback((event: React.FocusEvent<HTMLInputElement>) => {\r\n updateInputDate(event.target.value);\r\n }, [updateInputDate]);\r\n\r\n function onInputKeyDown(event: React.KeyboardEvent<HTMLInputElement>): void {\r\n // istanbul ignore else\r\n if (event.key === \"Enter\") {\r\n updateInputDate(event.currentTarget.value);\r\n event.preventDefault();\r\n }\r\n }\r\n const classNames = classnames(className, \"components-date-input\", hasBadInput && \"components-date-has-error\");\r\n return <Input data-testid=\"components-date-input\" style={style} className={classNames} onKeyDown={onInputKeyDown} onBlur={handleOnBlur}\r\n onChange={handleInputChange} value={inputValue} disabled={readOnly || (dateFormatter && !(dateFormatter.parseDate))} size=\"small\" />;\r\n}\r\n"]}
@@ -1,23 +1,23 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- @import "~@itwin/core-react/lib/cjs/core-react/style/themecolors";
6
- @import "~@itwin/core-react/lib/cjs/core-react/inputs/variables";
7
-
8
- .components-date-input {
9
- width: auto;
10
-
11
- &.components-date-has-error {
12
- color: var(--iui-color-text-negative);
13
- }
14
-
15
- &.iui-input {
16
- padding: $uicore-iui-input-padding;
17
- }
18
-
19
- &.iui-input[disabled] {
20
- color: var(--buic-foreground-body);
21
- opacity: 0.65;
22
- }
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ @import "~@itwin/core-react/lib/cjs/core-react/style/themecolors";
6
+ @import "~@itwin/core-react/lib/cjs/core-react/inputs/variables";
7
+
8
+ .components-date-input {
9
+ width: auto;
10
+
11
+ &.components-date-has-error {
12
+ color: var(--iui-color-text-negative);
13
+ }
14
+
15
+ &.iui-input {
16
+ padding: $uicore-iui-input-padding;
17
+ }
18
+
19
+ &.iui-input[disabled] {
20
+ color: var(--buic-foreground-body);
21
+ opacity: 0.65;
22
+ }
23
23
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,EAAE,QAAQ,SAAS,EAAE,IACrC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAS,EAAE,QAAgB,EAAE,EAAE;YAC5C,MAAM,QAAQ,GAAG,WAAW,IAAI,GAAG,IAAI,SAAS,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;YACnE,MAAM,SAAS,GAAG,UAAU,IAAI,GAAG,IAAI,SAAS,CAAC,UAAU,EAAE,GAAG,CAAC,IAAI,KAAK,CAAC,gBAAgB,CAAC;YAC5F,MAAM,cAAc,GAAG,GAAG,CAAC,QAAQ,EAAE,KAAK,mBAAmB,CAAC;YAC9D,MAAM,UAAU,GAAG,IAAA,oBAAU,EAAC,qCAAqC,EAAE,QAAQ,IAAI,UAAU,EAAE,CAAC,cAAc,IAAI,iBAAiB,EAAE,SAAS,IAAI,SAAS,CAAC,CAAC;YAC3J,MAAM,SAAS,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;YAChC,OAAO;YACL,oEAAoE;YACpE,4BAAI,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,aAAa,IAAI,mBAAmB,QAAQ,QAAQ,EAAE,EACvF,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,IAAI,EAAC,QAAQ,mBAAgB,QAAQ,gBAAc,GAAG,CAAC,OAAO,EAAE;gBACjG,kCAAO,SAAS,CAAQ,CACrB,CACN,CAAC;QACJ,CAAC,CAAC,CACa,CAAC,CACnB,CACE,CACD,CACP,CAAC;AACJ,CAAC;AAvLD,gCAuLC","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 { SpecialKey } from \"@itwin/appui-abstract\";\nimport { UiComponents } from \"../UiComponents\";\nimport { Icon } from \"@itwin/core-react\";\nimport { SvgChevronLeft, SvgChevronRight } from \"@itwin/itwinui-icons-react\";\n\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(UiComponents.localization.getLocalizedString(\"UiComponents:datepicker.previousMonth\"));\n const nextMonthLabel = React.useRef(UiComponents.localization.getLocalizedString(\"UiComponents:datepicker.nextMonth\"));\n const monthsLong = React.useRef([\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.january\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.february\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.march\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.april\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.may\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.june\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.july\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.august\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.september\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.october\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.november\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.december\"),\n ]);\n\n const daysLong = React.useRef([\n UiComponents.localization.getLocalizedString(\"UiComponents:days.long.sunday\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:days.long.monday\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:days.long.tuesday\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:days.long.wednesday\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:days.long.thursday\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:days.long.friday\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:days.long.saturday\"),\n ]);\n\n const daysShort = React.useRef([\n UiComponents.localization.getLocalizedString(\"UiComponents:days.short.sunday\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:days.short.monday\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:days.short.tuesday\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:days.short.wednesday\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:days.short.thursday\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:days.short.friday\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:days.short.saturday\"),\n ]);\n\n const [selectedDay, setSelectedDay] = React.useState(new Date(props.selected.getTime()));\n const [displayedMonthIndex, setDisplayedMonthIndex] = React.useState(selectedDay.getMonth());\n const [displayedYear, setDisplayedYear] = React.useState(selectedDay.getFullYear());\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(displayedYear, displayedMonthIndex, 1).getTime();\n let offsetToFirst = new Date(msFirstDayOfMonth).getDay();\n if (0 === offsetToFirst)\n 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(new Date(displayedYear, displayedMonthIndex, adjustedDay));\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((newMonth: number, newYear: number) => {\n setDisplayedMonthIndex(newMonth);\n setDisplayedYear(newYear);\n if (selectedDay.getFullYear() === newYear && selectedDay.getMonth() === newMonth) {\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 }, [focusedDay, selectedDay]);\n\n const handleMoveToPreviousMonth = React.useCallback(() => {\n const newMonth = displayedMonthIndex !== 0 ? displayedMonthIndex - 1 : 11;\n const newYear = 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 = 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((day: Date) => () => {\n setSelectedDay(day);\n setFocusedDay(day);\n props.onDateChange && props.onDateChange(day);\n }, [props]);\n\n const handleCalendarKeyDown = React.useCallback((event: React.KeyboardEvent<HTMLUListElement>) => {\n if (event.key === SpecialKey.ArrowDown) {\n const focusedDayIndex = days.findIndex((day) => isSameDay(day, focusedDay));\n if ((focusedDayIndex + 7) > 41)\n setFocusedDay(days[focusedDayIndex % 7]);\n else\n setFocusedDay(days[focusedDayIndex + 7]);\n event.preventDefault();\n }\n if (event.key === SpecialKey.ArrowUp) {\n const focusedDayIndex = days.findIndex((day) => isSameDay(day, focusedDay));\n if ((focusedDayIndex - 7) < 0)\n setFocusedDay(days[(focusedDayIndex % 7) + 35]);\n else\n setFocusedDay(days[focusedDayIndex - 7]);\n event.preventDefault();\n }\n if (event.key === SpecialKey.ArrowLeft) {\n const focusedDayIndex = days.findIndex((day) => isSameDay(day, focusedDay));\n // istanbul ignore else\n if ((focusedDayIndex - 1) >= 0)\n setFocusedDay(days[focusedDayIndex - 1]);\n event.preventDefault();\n }\n if (event.key === SpecialKey.ArrowRight) {\n const focusedDayIndex = days.findIndex((day) => isSameDay(day, focusedDay));\n // istanbul ignore else\n if ((focusedDayIndex + 1) <= 41)\n setFocusedDay(days[focusedDayIndex + 1]);\n event.preventDefault();\n }\n if (event.key === SpecialKey.Enter || event.key === SpecialKey.Space) {\n handleOnDayChange(focusedDay)(); // NB: immediately call returned handler function\n event.preventDefault();\n }\n }, [days, focusedDay, handleOnDayChange]);\n\n const previousButtonClass = classnames(\"components-previous-month\", props.showFocusOutline && \"showFocusOutline\");\n const nextButtonClass = classnames(\"components-next-month\", props.showFocusOutline && \"showFocusOutline\");\n const calendarClass = classnames(\"components-date-picker-calendar-month\", props.showFocusOutline && \"showFocusOutline\");\n\n return (\n <div className=\"components-date-picker-calendar\">\n <div className=\"components-date-picker-calendar-header-months\">\n <button className={previousButtonClass} title={previousMonthLabel.current} onClick={handleMoveToPreviousMonth}>\n <Icon iconSpec={<SvgChevronLeft />} />\n </button>\n <span className=\"components-month-year\">{monthsLong.current[displayedMonthIndex]} {displayedYear}</span>\n <button className={nextButtonClass} title={nextMonthLabel.current} onClick={handleMoveToNextMonth}>\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 key={`day-${dayOfWeek}`} className=\"components-date-picker-calendar-header-day-short\"\n title={daysLong.current[dayOfWeek]}><span>{daysShort.current[dayOfWeek]}</span></div>)}\n </div>\n <ul tabIndex={0} onKeyDown={handleCalendarKeyDown} data-testid=\"components-date-picker-calendar-list\" className={calendarClass} role=\"listbox\">\n {weeks.map((weekdays, weekIndex) => (\n <React.Fragment key={`week-${weekIndex}`}>\n {weekdays.map((day: Date, dayIndex: number) => {\n const isActive = selectedDay && day && isSameDay(selectedDay, day);\n const isFocused = focusedDay && day && isSameDay(focusedDay, day) && props.showFocusOutline;\n const isCurrentMonth = day.getMonth() === displayedMonthIndex;\n const classNames = classnames(\"components-date-picker-calendar-day\", isActive && \"selected\", !isCurrentMonth && \"notCurrentMonth\", isFocused && \"focused\");\n const dateValue = day.getDate();\n return (\n /* eslint-disable-next-line jsx-a11y/click-events-have-key-events */\n <li className={classNames} key={`${displayedYear}.${displayedMonthIndex}.day.${dayIndex}`}\n onClick={handleOnDayChange(day)} role=\"option\" aria-selected={isActive} data-value={day.getTime()}>\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;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,4DAAoC;AACpC,0DAAmD;AACnD,kDAA+C;AAC/C,kDAAyC;AACzC,oEAA6E;AAE7E,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,EAAE,CAC5B,CAAC;AACJ,CAAC;AAeD;;GAEG;AACH,SAAgB,UAAU,CAAC,KAAsB;IAC/C,MAAM,kBAAkB,GAAG,KAAK,CAAC,MAAM,CAAC,2BAAY,CAAC,YAAY,CAAC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QAAQ,QAAQ,EAAE,EACvF,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,IAAI,EAAC,QAAQ,mBAAgB,QAAQ,gBAAc,GAAG,CAAC,OAAO,EAAE;gBACjG,kCAAO,SAAS,CAAQ,CACrB,CACN,CAAC;QACJ,CAAC,CAAC,CACa,CAAC,CACnB,CACE,CACD,CACP,CAAC;AACJ,CAAC;AAvLD,gCAuLC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Date\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport classnames from \"classnames\";\r\nimport { SpecialKey } from \"@itwin/appui-abstract\";\r\nimport { UiComponents } from \"../UiComponents\";\r\nimport { Icon } from \"@itwin/core-react\";\r\nimport { SvgChevronLeft, SvgChevronRight } from \"@itwin/itwinui-icons-react\";\r\n\r\nimport \"./DatePicker.scss\";\r\n\r\nfunction isSameDay(a: Date, b: Date) {\r\n return (\r\n a &&\r\n b &&\r\n a.getFullYear() === b.getFullYear() &&\r\n a.getMonth() === b.getMonth() &&\r\n a.getDate() === b.getDate()\r\n );\r\n}\r\n\r\n/**\r\n * Props for [[DatePicker]] component.\r\n * @alpha\r\n */\r\nexport interface DatePickerProps {\r\n /** defines both date and time */\r\n selected: Date;\r\n /** function to call when date or time has changed */\r\n onDateChange?: (day: Date) => void;\r\n /** show focus outlines, useful for keyboard navigation */\r\n showFocusOutline?: boolean;\r\n}\r\n\r\n/** DatePicker component. Show a month selector and a day calendar to select a specific date.\r\n * @alpha\r\n */\r\nexport function DatePicker(props: DatePickerProps) {\r\n const previousMonthLabel = React.useRef(UiComponents.localization.getLocalizedString(\"UiComponents:datepicker.previousMonth\"));\r\n const nextMonthLabel = React.useRef(UiComponents.localization.getLocalizedString(\"UiComponents:datepicker.nextMonth\"));\r\n const monthsLong = React.useRef([\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.january\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.february\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.march\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.april\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.may\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.june\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.july\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.august\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.september\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.october\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.november\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.december\"),\r\n ]);\r\n\r\n const daysLong = React.useRef([\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.long.sunday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.long.monday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.long.tuesday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.long.wednesday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.long.thursday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.long.friday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.long.saturday\"),\r\n ]);\r\n\r\n const daysShort = React.useRef([\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.short.sunday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.short.monday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.short.tuesday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.short.wednesday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.short.thursday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.short.friday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.short.saturday\"),\r\n ]);\r\n\r\n const [selectedDay, setSelectedDay] = React.useState(new Date(props.selected.getTime()));\r\n const [displayedMonthIndex, setDisplayedMonthIndex] = React.useState(selectedDay.getMonth());\r\n const [displayedYear, setDisplayedYear] = React.useState(selectedDay.getFullYear());\r\n const [focusedDay, setFocusedDay] = React.useState(selectedDay);\r\n React.useEffect(() => {\r\n const newSelectedDay = new Date(props.selected);\r\n setSelectedDay(new Date(props.selected));\r\n setDisplayedMonthIndex(newSelectedDay.getMonth());\r\n setDisplayedYear(newSelectedDay.getFullYear());\r\n setFocusedDay(newSelectedDay);\r\n }, [props.selected]);\r\n const days = React.useMemo(() => {\r\n const msFirstDayOfMonth = new Date(displayedYear, displayedMonthIndex, 1).getTime();\r\n let offsetToFirst = new Date(msFirstDayOfMonth).getDay();\r\n if (0 === offsetToFirst)\r\n offsetToFirst = 7;\r\n\r\n const daysInMonth: Date[] = [];\r\n // generate 6 weeks of dates\r\n for (let i = 0; i < 42; i++) {\r\n const adjustedDay = 1 + i - offsetToFirst;\r\n daysInMonth.push(new Date(displayedYear, displayedMonthIndex, adjustedDay));\r\n }\r\n return daysInMonth;\r\n }, [displayedMonthIndex, displayedYear]);\r\n\r\n const weeks = React.useMemo(() => {\r\n const weeksInMonth = [];\r\n const weekCount = Math.ceil(days.length / 7);\r\n for (let i = 0; i < weekCount; i++) {\r\n weeksInMonth.push(days.slice(i * 7, (i + 1) * 7));\r\n }\r\n return weeksInMonth;\r\n }, [days]);\r\n\r\n const setMonthAndYear = React.useCallback((newMonth: number, newYear: number) => {\r\n setDisplayedMonthIndex(newMonth);\r\n setDisplayedYear(newYear);\r\n if (selectedDay.getFullYear() === newYear && selectedDay.getMonth() === newMonth) {\r\n setFocusedDay(new Date(selectedDay.getTime()));\r\n } else {\r\n const newFocusDay = new Date(focusedDay.getTime());\r\n newFocusDay.setFullYear(newYear, newMonth, 1);\r\n setFocusedDay(newFocusDay);\r\n }\r\n }, [focusedDay, selectedDay]);\r\n\r\n const handleMoveToPreviousMonth = React.useCallback(() => {\r\n const newMonth = displayedMonthIndex !== 0 ? displayedMonthIndex - 1 : 11;\r\n const newYear = displayedMonthIndex !== 0 ? displayedYear : displayedYear - 1;\r\n setMonthAndYear(newMonth, newYear);\r\n }, [displayedMonthIndex, displayedYear, setMonthAndYear]);\r\n\r\n const handleMoveToNextMonth = React.useCallback(() => {\r\n const newMonth = displayedMonthIndex !== 11 ? displayedMonthIndex + 1 : 0;\r\n const newYear = displayedMonthIndex !== 11 ? displayedYear : displayedYear + 1;\r\n setMonthAndYear(newMonth, newYear);\r\n }, [displayedMonthIndex, displayedYear, setMonthAndYear]);\r\n\r\n // when invoked, it will return another function which can be used for the onClick React listener.\r\n const handleOnDayChange = React.useCallback((day: Date) => () => {\r\n setSelectedDay(day);\r\n setFocusedDay(day);\r\n props.onDateChange && props.onDateChange(day);\r\n }, [props]);\r\n\r\n const handleCalendarKeyDown = React.useCallback((event: React.KeyboardEvent<HTMLUListElement>) => {\r\n if (event.key === SpecialKey.ArrowDown) {\r\n const focusedDayIndex = days.findIndex((day) => isSameDay(day, focusedDay));\r\n if ((focusedDayIndex + 7) > 41)\r\n setFocusedDay(days[focusedDayIndex % 7]);\r\n else\r\n setFocusedDay(days[focusedDayIndex + 7]);\r\n event.preventDefault();\r\n }\r\n if (event.key === SpecialKey.ArrowUp) {\r\n const focusedDayIndex = days.findIndex((day) => isSameDay(day, focusedDay));\r\n if ((focusedDayIndex - 7) < 0)\r\n setFocusedDay(days[(focusedDayIndex % 7) + 35]);\r\n else\r\n setFocusedDay(days[focusedDayIndex - 7]);\r\n event.preventDefault();\r\n }\r\n if (event.key === SpecialKey.ArrowLeft) {\r\n const focusedDayIndex = days.findIndex((day) => isSameDay(day, focusedDay));\r\n // istanbul ignore else\r\n if ((focusedDayIndex - 1) >= 0)\r\n setFocusedDay(days[focusedDayIndex - 1]);\r\n event.preventDefault();\r\n }\r\n if (event.key === SpecialKey.ArrowRight) {\r\n const focusedDayIndex = days.findIndex((day) => isSameDay(day, focusedDay));\r\n // istanbul ignore else\r\n if ((focusedDayIndex + 1) <= 41)\r\n setFocusedDay(days[focusedDayIndex + 1]);\r\n event.preventDefault();\r\n }\r\n if (event.key === SpecialKey.Enter || event.key === SpecialKey.Space) {\r\n handleOnDayChange(focusedDay)(); // NB: immediately call returned handler function\r\n event.preventDefault();\r\n }\r\n }, [days, focusedDay, handleOnDayChange]);\r\n\r\n const previousButtonClass = classnames(\"components-previous-month\", props.showFocusOutline && \"showFocusOutline\");\r\n const nextButtonClass = classnames(\"components-next-month\", props.showFocusOutline && \"showFocusOutline\");\r\n const calendarClass = classnames(\"components-date-picker-calendar-month\", props.showFocusOutline && \"showFocusOutline\");\r\n\r\n return (\r\n <div className=\"components-date-picker-calendar\">\r\n <div className=\"components-date-picker-calendar-header-months\">\r\n <button className={previousButtonClass} title={previousMonthLabel.current} onClick={handleMoveToPreviousMonth}>\r\n <Icon iconSpec={<SvgChevronLeft />} />\r\n </button>\r\n <span className=\"components-month-year\">{monthsLong.current[displayedMonthIndex]} {displayedYear}</span>\r\n <button className={nextButtonClass} title={nextMonthLabel.current} onClick={handleMoveToNextMonth}>\r\n <Icon iconSpec={<SvgChevronRight />} />\r\n </button>\r\n </div>\r\n <div className=\"components-date-picker-calendar-header-weekdays\">\r\n {[0, 1, 2, 3, 4, 5, 6].map((dayOfWeek) =>\r\n <div key={`day-${dayOfWeek}`} className=\"components-date-picker-calendar-header-day-short\"\r\n title={daysLong.current[dayOfWeek]}><span>{daysShort.current[dayOfWeek]}</span></div>)}\r\n </div>\r\n <ul tabIndex={0} onKeyDown={handleCalendarKeyDown} data-testid=\"components-date-picker-calendar-list\" className={calendarClass} role=\"listbox\">\r\n {weeks.map((weekdays, weekIndex) => (\r\n <React.Fragment key={`week-${weekIndex}`}>\r\n {weekdays.map((day: Date, dayIndex: number) => {\r\n const isActive = selectedDay && day && isSameDay(selectedDay, day);\r\n const isFocused = focusedDay && day && isSameDay(focusedDay, day) && props.showFocusOutline;\r\n const isCurrentMonth = day.getMonth() === displayedMonthIndex;\r\n const classNames = classnames(\"components-date-picker-calendar-day\", isActive && \"selected\", !isCurrentMonth && \"notCurrentMonth\", isFocused && \"focused\");\r\n const dateValue = day.getDate();\r\n return (\r\n /* eslint-disable-next-line jsx-a11y/click-events-have-key-events */\r\n <li className={classNames} key={`${displayedYear}.${displayedMonthIndex}.day.${dayIndex}`}\r\n onClick={handleOnDayChange(day)} role=\"option\" aria-selected={isActive} data-value={day.getTime()}>\r\n <span>{dateValue}</span>\r\n </li>\r\n );\r\n })}\r\n </React.Fragment>)\r\n )}\r\n </ul>\r\n </div>\r\n );\r\n}\r\n"]}
@@ -1,176 +1,176 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- @import "~@itwin/core-react/lib/cjs/core-react/style/themecolors";
6
- @import "~@itwin/core-react/lib/cjs/core-react/style/opacity";
7
- @import "~@itwin/core-react/lib/cjs/core-react/icons/variables";
8
-
9
- $date-picker-m: 16px;
10
- $date-picker-icons-color-actionable: rgba(
11
- $buic-foreground-body,
12
- $uicore-opacity-2
13
- );
14
- $date-picker-icons-color-actionable-hover: rgba(
15
- $buic-foreground-body,
16
- $uicore-opacity-1
17
- );
18
- $date-picker-outside-month-color: var(--iui-color-text-disabled);
19
- $outline-size: 2px;
20
-
21
- .components-date-picker-calendar {
22
- border-radius: var(--iui-border-radius-1) var(--iui-border-radius-1) 0 0;
23
- background-color: $buic-background-control;
24
- color: var(--iui-color-text);
25
- font-size: 14px;
26
-
27
- * {
28
- box-sizing: border-box;
29
- }
30
-
31
- .components-date-picker-calendar-header-months {
32
- display: inline-flex;
33
- width: calc(100% - 12px);
34
- align-items: center;
35
- justify-content: space-between;
36
- padding: 6px;
37
-
38
- button.components-previous-month,
39
- button.components-next-month {
40
- background-color: $buic-background-control;
41
- border: none;
42
- cursor: pointer;
43
- padding: 5px;
44
- font-size: var(--iui-font-size-2);
45
- user-select: none;
46
- color: $date-picker-icons-color-actionable;
47
-
48
- &:focus {
49
- outline: 0px;
50
-
51
- &.showFocusOutline {
52
- outline: 0px;
53
- border: 0px solid var(--iui-color-border-foreground);
54
- border-radius: var(--iui-border-radius-1);
55
- border-color: var(--buic-foreground-focus-border);
56
- box-shadow: var(--buic-focus-boxshadow-gradient1) 0px 1px 1px,
57
- var(--buic-focus-boxshadow-gradient2) 0px 0px 0px 2px;
58
- }
59
- }
60
-
61
- &:hover {
62
- color: var(--iui-color-text-accent);
63
- }
64
- }
65
-
66
- .components-next-month {
67
- text-align: right;
68
- }
69
-
70
- .components-month-year {
71
- flex: 2;
72
- font-weight: var(--iui-font-weight-bold);
73
- text-align: center;
74
- }
75
- }
76
-
77
- .components-date-picker-calendar-header-weekdays {
78
- display: grid;
79
- background-color: $buic-background-2;
80
- padding-inline-start: 8px;
81
- padding-inline-end: 8px;
82
- grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
83
- align-items: center;
84
-
85
- .components-date-picker-calendar-header-day-short {
86
- text-align: center;
87
- text-decoration: none;
88
- font-weight: var(--iui-font-weight-bold);
89
- height: 32px;
90
- width: 32px;
91
- display: inline-flex;
92
- align-items: center;
93
- justify-content: center;
94
- }
95
- }
96
-
97
- ul.components-date-picker-calendar-month {
98
- margin: 1px;
99
- padding: 4px 5px;
100
- list-style: none;
101
- display: grid;
102
- grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
103
- text-align: center;
104
- align-items: center;
105
- align-self: center;
106
-
107
- &:focus {
108
- outline: 0px;
109
-
110
- &.showFocusOutline {
111
- border: 0px solid var(--iui-color-border-foreground);
112
- border-radius: var(--iui-border-radius-1);
113
- border-color: var(--buic-foreground-focus-border);
114
- box-shadow: var(--buic-focus-boxshadow-gradient1) 0px 1px 1px,
115
- var(--buic-focus-boxshadow-gradient2) 0px 0px 0px 2px;
116
-
117
- .components-date-picker-calendar-day.focused {
118
- outline: 0px;
119
- border: 1px solid var(--iui-color-border-foreground);
120
- border-radius: var(--iui-border-radius-1);
121
- border-color: var(--buic-foreground-focus-border);
122
- box-shadow: var(--buic-focus-boxshadow-gradient1) 0px 1px 1px,
123
- var(--buic-focus-boxshadow-gradient2) 0px 0px 0px 2px;
124
- z-index: 1;
125
- }
126
- }
127
- }
128
-
129
- .components-date-picker-calendar-day {
130
- box-sizing: border-box;
131
- text-align: center;
132
- white-space: nowrap;
133
- cursor: pointer;
134
- height: 32px;
135
- width: 32px;
136
- display: inline-flex;
137
- align-items: center;
138
- justify-content: center;
139
-
140
- &:focus {
141
- outline: 0px;
142
- }
143
-
144
- &:hover:not(.selected) {
145
- background-color: $buic-row-hover;
146
- border-radius: var(--iui-border-radius-1);
147
- font-weight: var(--iui-font-weight-semibold);
148
- }
149
-
150
- &.selected {
151
- background-color: $buic-background-primary;
152
- color: var(--iui-color-white);
153
- font-weight: var(--iui-font-weight-semibold);
154
- border-radius: var(--iui-border-radius-1);
155
-
156
- &:hover {
157
- background-color: $buic-row-hover;
158
- color: var(--iui-color-text);
159
- }
160
- }
161
-
162
- &.today {
163
- background-color: rgba($buic-foreground-body, $uicore-opacity-6);
164
- font-weight: var(--iui-font-weight-semibold);
165
- border-radius: 50%;
166
- }
167
-
168
- &.notCurrentMonth {
169
- &:not(.selected) {
170
- color: $date-picker-outside-month-color;
171
- font-weight: var(--iui-font-weight-light);
172
- }
173
- }
174
- }
175
- }
176
- }
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ @import "~@itwin/core-react/lib/cjs/core-react/style/themecolors";
6
+ @import "~@itwin/core-react/lib/cjs/core-react/style/opacity";
7
+ @import "~@itwin/core-react/lib/cjs/core-react/icons/variables";
8
+
9
+ $date-picker-m: 16px;
10
+ $date-picker-icons-color-actionable: rgba(
11
+ $buic-foreground-body,
12
+ $uicore-opacity-2
13
+ );
14
+ $date-picker-icons-color-actionable-hover: rgba(
15
+ $buic-foreground-body,
16
+ $uicore-opacity-1
17
+ );
18
+ $date-picker-outside-month-color: var(--iui-color-text-disabled);
19
+ $outline-size: 2px;
20
+
21
+ .components-date-picker-calendar {
22
+ border-radius: var(--iui-border-radius-1) var(--iui-border-radius-1) 0 0;
23
+ background-color: $buic-background-control;
24
+ color: var(--iui-color-text);
25
+ font-size: 14px;
26
+
27
+ * {
28
+ box-sizing: border-box;
29
+ }
30
+
31
+ .components-date-picker-calendar-header-months {
32
+ display: inline-flex;
33
+ width: calc(100% - 12px);
34
+ align-items: center;
35
+ justify-content: space-between;
36
+ padding: 6px;
37
+
38
+ button.components-previous-month,
39
+ button.components-next-month {
40
+ background-color: $buic-background-control;
41
+ border: none;
42
+ cursor: pointer;
43
+ padding: 5px;
44
+ font-size: var(--iui-font-size-2);
45
+ user-select: none;
46
+ color: $date-picker-icons-color-actionable;
47
+
48
+ &:focus {
49
+ outline: 0px;
50
+
51
+ &.showFocusOutline {
52
+ outline: 0px;
53
+ border: 0px solid var(--iui-color-border-foreground);
54
+ border-radius: var(--iui-border-radius-1);
55
+ border-color: var(--buic-foreground-focus-border);
56
+ box-shadow: var(--buic-focus-boxshadow-gradient1) 0px 1px 1px,
57
+ var(--buic-focus-boxshadow-gradient2) 0px 0px 0px 2px;
58
+ }
59
+ }
60
+
61
+ &:hover {
62
+ color: var(--iui-color-text-accent);
63
+ }
64
+ }
65
+
66
+ .components-next-month {
67
+ text-align: right;
68
+ }
69
+
70
+ .components-month-year {
71
+ flex: 2;
72
+ font-weight: var(--iui-font-weight-bold);
73
+ text-align: center;
74
+ }
75
+ }
76
+
77
+ .components-date-picker-calendar-header-weekdays {
78
+ display: grid;
79
+ background-color: $buic-background-2;
80
+ padding-inline-start: 8px;
81
+ padding-inline-end: 8px;
82
+ grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
83
+ align-items: center;
84
+
85
+ .components-date-picker-calendar-header-day-short {
86
+ text-align: center;
87
+ text-decoration: none;
88
+ font-weight: var(--iui-font-weight-bold);
89
+ height: 32px;
90
+ width: 32px;
91
+ display: inline-flex;
92
+ align-items: center;
93
+ justify-content: center;
94
+ }
95
+ }
96
+
97
+ ul.components-date-picker-calendar-month {
98
+ margin: 1px;
99
+ padding: 4px 5px;
100
+ list-style: none;
101
+ display: grid;
102
+ grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
103
+ text-align: center;
104
+ align-items: center;
105
+ align-self: center;
106
+
107
+ &:focus {
108
+ outline: 0px;
109
+
110
+ &.showFocusOutline {
111
+ border: 0px solid var(--iui-color-border-foreground);
112
+ border-radius: var(--iui-border-radius-1);
113
+ border-color: var(--buic-foreground-focus-border);
114
+ box-shadow: var(--buic-focus-boxshadow-gradient1) 0px 1px 1px,
115
+ var(--buic-focus-boxshadow-gradient2) 0px 0px 0px 2px;
116
+
117
+ .components-date-picker-calendar-day.focused {
118
+ outline: 0px;
119
+ border: 1px solid var(--iui-color-border-foreground);
120
+ border-radius: var(--iui-border-radius-1);
121
+ border-color: var(--buic-foreground-focus-border);
122
+ box-shadow: var(--buic-focus-boxshadow-gradient1) 0px 1px 1px,
123
+ var(--buic-focus-boxshadow-gradient2) 0px 0px 0px 2px;
124
+ z-index: 1;
125
+ }
126
+ }
127
+ }
128
+
129
+ .components-date-picker-calendar-day {
130
+ box-sizing: border-box;
131
+ text-align: center;
132
+ white-space: nowrap;
133
+ cursor: pointer;
134
+ height: 32px;
135
+ width: 32px;
136
+ display: inline-flex;
137
+ align-items: center;
138
+ justify-content: center;
139
+
140
+ &:focus {
141
+ outline: 0px;
142
+ }
143
+
144
+ &:hover:not(.selected) {
145
+ background-color: $buic-row-hover;
146
+ border-radius: var(--iui-border-radius-1);
147
+ font-weight: var(--iui-font-weight-semibold);
148
+ }
149
+
150
+ &.selected {
151
+ background-color: $buic-background-primary;
152
+ color: var(--iui-color-white);
153
+ font-weight: var(--iui-font-weight-semibold);
154
+ border-radius: var(--iui-border-radius-1);
155
+
156
+ &:hover {
157
+ background-color: $buic-row-hover;
158
+ color: var(--iui-color-text);
159
+ }
160
+ }
161
+
162
+ &.today {
163
+ background-color: rgba($buic-foreground-body, $uicore-opacity-6);
164
+ font-weight: var(--iui-font-weight-semibold);
165
+ border-radius: 50%;
166
+ }
167
+
168
+ &.notCurrentMonth {
169
+ &:not(.selected) {
170
+ color: $date-picker-outside-month-color;
171
+ font-weight: var(--iui-font-weight-light);
172
+ }
173
+ }
174
+ }
175
+ }
176
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"DatePickerPopupButton.js","sourceRoot":"","sources":["../../../../src/components-react/datepicker/DatePickerPopupButton.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,0DAAiG;AACjG,kDAAuD;AACvD,wDAA4C;AAC5C,kDAA+C;AAC/C,6CAA0C;AAC1C,2CAAwC;AACxC,2CAAkD;AAClD,wCAAsC;AAwBtC;;KAEK;AACL,SAAgB,qBAAqB,CAAC,EAAE,gBAAgB,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,aAAa,EAC1G,aAAa,EAAE,UAAU,EAAE,cAAc,EAAE,KAAK,EAA8B;IAC9E,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IACnF,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;IAC7E,MAAM,eAAe,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K,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,6BAAK,SAAS,EAAC,6CAA6C,iBAAa,6CAA6C;gBACpH,oBAAC,uBAAU,IAAC,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,gBAAgB,GAAI;gBAC3G,WAAW;oBACV,6BAAK,SAAS,EAAC,gBAAgB;wBAC7B,oBAAC,oBAAI,IAAC,OAAO,EAAC,MAAM,EAAC,SAAS,EAAC,YAAY,IAAE,YAAY,CAAC,OAAO,CAAQ;wBACzE,oBAAC,qBAAS,IAAC,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,mBAAmB,GAAI,CACtF,CAEJ,CACC;QACR,CAAC,CAAC,gBAAgB,IAAI,oBAAC,qBAAS,IAAC,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,mBAAmB,GAAI,CACtM,CACJ,CAAC;AACJ,CAAC;AAnFD,sDAmFC","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 { DateFormatter, RelativePosition, SpecialKey, TimeDisplay } from \"@itwin/appui-abstract\";\nimport { CommonProps, Popup } from \"@itwin/core-react\";\nimport { Text } from \"@itwin/itwinui-react\";\nimport { UiComponents } from \"../UiComponents\";\nimport { DatePicker } from \"./DatePicker\";\nimport { DateField } from \"./DateField\";\nimport { TimeField, TimeSpec } 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({ displayEditField, timeDisplay, selected, onDateChange, dateFormatter,\n buttonToolTip, fieldStyle, fieldClassName, style }: DatePickerPopupButtonProps) {\n const [workingDate, setWorkingDate] = React.useState(new Date(selected.getTime()));\n const [isSettingsOpen, setIsSettingsOpen] = React.useState(false);\n const timeLabelRef = React.useRef(UiComponents.translate(\"datepicker.time\"));\n const toolTipLabelRef = React.useRef(UiComponents.translate(\"datepicker.selectDate\"));\n const toolTipLabel = React.useMemo(() => buttonToolTip ? buttonToolTip : toolTipLabelRef.current, [buttonToolTip]);\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((event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n event.preventDefault();\n setShowFocusOutline(false);\n setIsSettingsOpen((prev) => !prev);\n }, [setIsSettingsOpen]);\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(workingDate.getHours(), workingDate.getMinutes(), workingDate.getSeconds());\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((event: React.KeyboardEvent<HTMLButtonElement>) => {\n // istanbul ignore else\n if (event.key === SpecialKey.Space) {\n setShowFocusOutline(true);\n setIsSettingsOpen(true);\n }\n }, []);\n\n const timeSpec: TimeSpec = { hours: workingDate.getHours(), minutes: workingDate.getMinutes(), seconds: workingDate.getSeconds() };\n return (\n <>\n <button title={toolTipLabel} style={style} className=\"components-date-picker-calendar-popup-button\" onKeyDown={handlePopupKeyDown}\n data-testid=\"components-date-picker-calendar-popup-button\" onPointerDown={togglePopupDisplay} ref={buttonRef}>\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 className=\"components-date-picker-calendar-popup-panel\" data-testid=\"components-date-picker-calendar-popup-panel\">\n <DatePicker selected={workingDate} onDateChange={handleOnDateChanged} showFocusOutline={showFocusOutline} />\n {timeDisplay &&\n <div className=\"time-container\">\n <Text variant=\"body\" className=\"time-label\">{timeLabelRef.current}</Text>\n <TimeField time={timeSpec} timeDisplay={timeDisplay} onTimeChange={handleOnTimeChanged} />\n </div>\n }\n </div>\n </Popup >\n {!!displayEditField && <DateField style={fieldStyle} className={fieldClassName} initialDate={workingDate} timeDisplay={timeDisplay} dateFormatter={dateFormatter} onDateChange={handleOnDateChanged} />}\n </>\n );\n}\n"]}
1
+ {"version":3,"file":"DatePickerPopupButton.js","sourceRoot":"","sources":["../../../../src/components-react/datepicker/DatePickerPopupButton.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,0DAAiG;AACjG,kDAAuD;AACvD,wDAA4C;AAC5C,kDAA+C;AAC/C,6CAA0C;AAC1C,2CAAwC;AACxC,2CAAkD;AAClD,wCAAsC;AAwBtC;;KAEK;AACL,SAAgB,qBAAqB,CAAC,EAAE,gBAAgB,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,aAAa,EAC1G,aAAa,EAAE,UAAU,EAAE,cAAc,EAAE,KAAK,EAA8B;IAC9E,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IACnF,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,C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EAAE,SAAS;YAC5G,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,6BAAK,SAAS,EAAC,6CAA6C,iBAAa,6CAA6C;gBACpH,oBAAC,uBAAU,IAAC,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,gBAAgB,GAAI;gBAC3G,WAAW;oBACV,6BAAK,SAAS,EAAC,gBAAgB;wBAC7B,oBAAC,oBAAI,IAAC,OAAO,EAAC,MAAM,EAAC,SAAS,EAAC,YAAY,IAAE,YAAY,CAAC,OAAO,CAAQ;wBACzE,oBAAC,qBAAS,IAAC,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,mBAAmB,GAAI,CACtF,CAEJ,CACC;QACR,CAAC,CAAC,gBAAgB,IAAI,oBAAC,qBAAS,IAAC,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,mBAAmB,GAAI,CACtM,CACJ,CAAC;AACJ,CAAC;AAnFD,sDAmFC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Date\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { DateFormatter, RelativePosition, SpecialKey, TimeDisplay } from \"@itwin/appui-abstract\";\r\nimport { CommonProps, Popup } from \"@itwin/core-react\";\r\nimport { Text } from \"@itwin/itwinui-react\";\r\nimport { UiComponents } from \"../UiComponents\";\r\nimport { DatePicker } from \"./DatePicker\";\r\nimport { DateField } from \"./DateField\";\r\nimport { TimeField, TimeSpec } from \"./TimeField\";\r\nimport \"./DatePickerPopupButton.scss\";\r\n\r\n/** Props used by [[DatePickerPopupButton]] component.\r\n * @alpha */\r\nexport interface DatePickerPopupButtonProps extends CommonProps {\r\n /** Date to be shown as the selected date. */\r\n selected: Date;\r\n /** If true show the date (and optionally time) edit field next to button */\r\n displayEditField?: boolean;\r\n // If defined show time in popup and also display time if input field is shown\r\n timeDisplay?: TimeDisplay;\r\n /** Function called when Date changes. */\r\n onDateChange?: (day: Date) => void;\r\n /** Optional tooltip */\r\n buttonToolTip?: string;\r\n /* Custom date formatter. WARNING: if used values will only be shown in specified format and will not be based on locale.\r\n * If used the existence of a parseDate function will determine if the edit field allows editing. */\r\n dateFormatter?: DateFormatter;\r\n /** User defined class name for edit field. */\r\n fieldClassName?: string;\r\n /** User defined style for edit field. */\r\n fieldStyle?: React.CSSProperties;\r\n}\r\n\r\n/** Component that displays a button used to pick a date and optionally a time.\r\n * @alpha\r\n * */\r\nexport function DatePickerPopupButton({ displayEditField, timeDisplay, selected, onDateChange, dateFormatter,\r\n buttonToolTip, fieldStyle, fieldClassName, style }: DatePickerPopupButtonProps) {\r\n const [workingDate, setWorkingDate] = React.useState(new Date(selected.getTime()));\r\n const [isSettingsOpen, setIsSettingsOpen] = React.useState(false);\r\n const timeLabelRef = React.useRef(UiComponents.translate(\"datepicker.time\"));\r\n const toolTipLabelRef = React.useRef(UiComponents.translate(\"datepicker.selectDate\"));\r\n const toolTipLabel = React.useMemo(() => buttonToolTip ? buttonToolTip : toolTipLabelRef.current, [buttonToolTip]);\r\n\r\n // See if props have changed since component mounted\r\n React.useEffect(() => {\r\n const newWorkingDate = new Date(selected.getTime());\r\n setWorkingDate(newWorkingDate);\r\n }, [selected]);\r\n\r\n const buttonRef = React.useRef<HTMLButtonElement>(null);\r\n const togglePopupDisplay = React.useCallback((event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\r\n event.preventDefault();\r\n setShowFocusOutline(false);\r\n setIsSettingsOpen((prev) => !prev);\r\n }, [setIsSettingsOpen]);\r\n\r\n const handleCloseSetting = React.useCallback(() => {\r\n setIsSettingsOpen(false);\r\n }, [setIsSettingsOpen]);\r\n\r\n const handleOnDateChanged = (day: Date) => {\r\n // combine current time into selected Date\r\n const newWorkingDate = new Date(day.getTime());\r\n newWorkingDate.setHours(workingDate.getHours(), workingDate.getMinutes(), workingDate.getSeconds());\r\n onDateChange && onDateChange(newWorkingDate);\r\n !timeDisplay && setIsSettingsOpen(false);\r\n };\r\n\r\n const handleOnTimeChanged = (time: TimeSpec) => {\r\n // Combine new time into selected Date\r\n const newWorkingDate = new Date(workingDate.getTime());\r\n newWorkingDate.setHours(time.hours, time.minutes, time.seconds);\r\n setWorkingDate(newWorkingDate);\r\n onDateChange && onDateChange(newWorkingDate);\r\n };\r\n\r\n const [showFocusOutline, setShowFocusOutline] = React.useState(false);\r\n const handlePopupKeyDown = React.useCallback((event: React.KeyboardEvent<HTMLButtonElement>) => {\r\n // istanbul ignore else\r\n if (event.key === SpecialKey.Space) {\r\n setShowFocusOutline(true);\r\n setIsSettingsOpen(true);\r\n }\r\n }, []);\r\n\r\n const timeSpec: TimeSpec = { hours: workingDate.getHours(), minutes: workingDate.getMinutes(), seconds: workingDate.getSeconds() };\r\n return (\r\n <>\r\n <button title={toolTipLabel} style={style} className=\"components-date-picker-calendar-popup-button\" onKeyDown={handlePopupKeyDown}\r\n data-testid=\"components-date-picker-calendar-popup-button\" onPointerDown={togglePopupDisplay} ref={buttonRef}>\r\n <div className=\"datepicker-button\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\r\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\" />\r\n </svg>\r\n </div>\r\n </button>\r\n <Popup\r\n isOpen={isSettingsOpen}\r\n position={RelativePosition.BottomLeft}\r\n onClose={handleCloseSetting}\r\n target={buttonRef.current}\r\n closeOnEnter={false}\r\n moveFocus={showFocusOutline}\r\n closeOnNestedPopupOutsideClick\r\n >\r\n <div className=\"components-date-picker-calendar-popup-panel\" data-testid=\"components-date-picker-calendar-popup-panel\">\r\n <DatePicker selected={workingDate} onDateChange={handleOnDateChanged} showFocusOutline={showFocusOutline} />\r\n {timeDisplay &&\r\n <div className=\"time-container\">\r\n <Text variant=\"body\" className=\"time-label\">{timeLabelRef.current}</Text>\r\n <TimeField time={timeSpec} timeDisplay={timeDisplay} onTimeChange={handleOnTimeChanged} />\r\n </div>\r\n }\r\n </div>\r\n </Popup >\r\n {!!displayEditField && <DateField style={fieldStyle} className={fieldClassName} initialDate={workingDate} timeDisplay={timeDisplay} dateFormatter={dateFormatter} onDateChange={handleOnDateChanged} />}\r\n </>\r\n );\r\n}\r\n"]}