@mailstep/design-system 0.8.27 → 0.8.28-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (532) hide show
  1. package/package.json +4 -4
  2. package/ui/Blocks/CommonGrid/CommonGrid.js +104 -152
  3. package/ui/Blocks/CommonGrid/CommonGridContainer.js +187 -368
  4. package/ui/Blocks/CommonGrid/HoC/withProps.js +9 -37
  5. package/ui/Blocks/CommonGrid/HoC/withReduxActions.js +29 -46
  6. package/ui/Blocks/CommonGrid/components/ActionHead/ActionHead.js +105 -196
  7. package/ui/Blocks/CommonGrid/components/ActionHead/components/ActionDropdownMenu.js +37 -49
  8. package/ui/Blocks/CommonGrid/components/ActionHead/components/ActionDropdownSelect.js +76 -162
  9. package/ui/Blocks/CommonGrid/components/ActionHead/index.js +3 -1
  10. package/ui/Blocks/CommonGrid/components/ButtonMore/ButtonMore.js +43 -124
  11. package/ui/Blocks/CommonGrid/components/ButtonMore/index.js +3 -1
  12. package/ui/Blocks/CommonGrid/components/ColumnFilterCell.js +50 -112
  13. package/ui/Blocks/CommonGrid/components/ColumnTitle/ColumnTitle.js +130 -251
  14. package/ui/Blocks/CommonGrid/components/ColumnTitle/index.js +3 -1
  15. package/ui/Blocks/CommonGrid/components/ColumnTitle.js +36 -104
  16. package/ui/Blocks/CommonGrid/components/ControlButtons/ControlButtons.js +156 -252
  17. package/ui/Blocks/CommonGrid/components/ControlButtons/index.js +3 -1
  18. package/ui/Blocks/CommonGrid/components/ControlButtons/styles.js +40 -53
  19. package/ui/Blocks/CommonGrid/components/DataCell.js +34 -97
  20. package/ui/Blocks/CommonGrid/components/DataRow.js +60 -74
  21. package/ui/Blocks/CommonGrid/components/DropdownButton/DropdownButton.js +67 -154
  22. package/ui/Blocks/CommonGrid/components/DropdownButton/index.js +3 -1
  23. package/ui/Blocks/CommonGrid/components/ExtraControlButtons/ExtraControlButtons.js +57 -149
  24. package/ui/Blocks/CommonGrid/components/ExtraControlButtons/index.js +3 -1
  25. package/ui/Blocks/CommonGrid/components/FilterDropdown.js +30 -48
  26. package/ui/Blocks/CommonGrid/components/FilterRow.js +28 -36
  27. package/ui/Blocks/CommonGrid/components/Filters/ActionsFilter/ActionsFilter.js +32 -83
  28. package/ui/Blocks/CommonGrid/components/Filters/ActionsFilter/index.js +3 -1
  29. package/ui/Blocks/CommonGrid/components/Filters/BooleanSelect/BooleanSelect.js +34 -90
  30. package/ui/Blocks/CommonGrid/components/Filters/BooleanSelect/index.js +4 -2
  31. package/ui/Blocks/CommonGrid/components/Filters/DatePickerRange/DatePickerRange.js +149 -373
  32. package/ui/Blocks/CommonGrid/components/Filters/DatePickerRange/index.js +3 -1
  33. package/ui/Blocks/CommonGrid/components/Filters/DatePickerRange/utils/getCleanValues.js +7 -12
  34. package/ui/Blocks/CommonGrid/components/Filters/DatePickerRange/utils/pickerRangeToString.js +13 -25
  35. package/ui/Blocks/CommonGrid/components/Filters/DatePickerRange/utils/sameDate.js +3 -3
  36. package/ui/Blocks/CommonGrid/components/Filters/GridSelect/GridSelect.js +92 -376
  37. package/ui/Blocks/CommonGrid/components/Filters/GridSelect/guards.js +4 -8
  38. package/ui/Blocks/CommonGrid/components/Filters/GridSelect/index.js +4 -2
  39. package/ui/Blocks/CommonGrid/components/Filters/NumberRange/NumberRange.js +142 -293
  40. package/ui/Blocks/CommonGrid/components/Filters/NumberRange/index.js +3 -1
  41. package/ui/Blocks/CommonGrid/components/Filters/NumberRange/types.js +1 -0
  42. package/ui/Blocks/CommonGrid/components/Filters/TextRange/TextRange.js +160 -320
  43. package/ui/Blocks/CommonGrid/components/Filters/TextRange/index.js +3 -1
  44. package/ui/Blocks/CommonGrid/components/Filters/TextRange/types.js +1 -0
  45. package/ui/Blocks/CommonGrid/components/FloatingButton/FloatingButton.js +79 -156
  46. package/ui/Blocks/CommonGrid/components/FloatingButton/index.js +3 -1
  47. package/ui/Blocks/CommonGrid/components/GridInfo/index.js +30 -41
  48. package/ui/Blocks/CommonGrid/components/GridModals/index.js +132 -134
  49. package/ui/Blocks/CommonGrid/components/GridStatus/index.js +23 -25
  50. package/ui/Blocks/CommonGrid/components/GroupRow.js +26 -87
  51. package/ui/Blocks/CommonGrid/components/HeadCell.js +33 -89
  52. package/ui/Blocks/CommonGrid/components/HeadRow.js +69 -192
  53. package/ui/Blocks/CommonGrid/components/IconList/IconList.js +61 -99
  54. package/ui/Blocks/CommonGrid/components/IconList/index.js +3 -1
  55. package/ui/Blocks/CommonGrid/components/ManageColumnForm/ManageColumnForm.js +52 -114
  56. package/ui/Blocks/CommonGrid/components/ManageColumnForm/components/ManageColumnRow.js +66 -171
  57. package/ui/Blocks/CommonGrid/components/ManageColumnForm/index.js +3 -1
  58. package/ui/Blocks/CommonGrid/components/ManageColumnForm/styles.js +16 -34
  59. package/ui/Blocks/CommonGrid/components/ManageColumnForm/utils.js +7 -9
  60. package/ui/Blocks/CommonGrid/components/MobileFilterModal.js +110 -228
  61. package/ui/Blocks/CommonGrid/components/MobileOverlayWrapper.js +13 -21
  62. package/ui/Blocks/CommonGrid/components/MobileSortModal.js +64 -88
  63. package/ui/Blocks/CommonGrid/components/OversizedScroll.js +34 -86
  64. package/ui/Blocks/CommonGrid/components/PresetsModalBody/components/TagRemove.js +17 -20
  65. package/ui/Blocks/CommonGrid/components/PresetsModalBody/index.js +88 -201
  66. package/ui/Blocks/CommonGrid/components/QuickFilter/QuickFilter.js +29 -54
  67. package/ui/Blocks/CommonGrid/components/QuickFilter/index.js +3 -1
  68. package/ui/Blocks/CommonGrid/components/Resize.js +46 -53
  69. package/ui/Blocks/CommonGrid/components/Table.js +40 -94
  70. package/ui/Blocks/CommonGrid/components/TablePagination/TablePagination.js +63 -113
  71. package/ui/Blocks/CommonGrid/components/TablePagination/index.js +3 -1
  72. package/ui/Blocks/CommonGrid/components/gridCells/BoolIcon.js +16 -32
  73. package/ui/Blocks/CommonGrid/components/gridCells/ButtonInCell.js +10 -58
  74. package/ui/Blocks/CommonGrid/components/gridCells/Date.js +7 -7
  75. package/ui/Blocks/CommonGrid/components/gridCells/DateTime.js +9 -12
  76. package/ui/Blocks/CommonGrid/components/gridCells/EnumInCell.js +27 -100
  77. package/ui/Blocks/CommonGrid/components/gridCells/HoverBubble.js +48 -48
  78. package/ui/Blocks/CommonGrid/components/gridCells/IconButtonInCell.js +31 -33
  79. package/ui/Blocks/CommonGrid/components/gridCells/ImageCell.js +28 -50
  80. package/ui/Blocks/CommonGrid/components/gridCells/LinkInCell.js +8 -22
  81. package/ui/Blocks/CommonGrid/components/gridCells/RemoveItem.js +37 -63
  82. package/ui/Blocks/CommonGrid/components/gridCells/RowActionsCell.js +75 -113
  83. package/ui/Blocks/CommonGrid/components/gridCells/StringJoin.js +7 -7
  84. package/ui/Blocks/CommonGrid/components/gridCells/SwitchInCell.js +9 -57
  85. package/ui/Blocks/CommonGrid/components/gridCells/ToggleCell.js +30 -82
  86. package/ui/Blocks/CommonGrid/components/gridCells/index.js +14 -14
  87. package/ui/Blocks/CommonGrid/components/icons/Edit.js +13 -65
  88. package/ui/Blocks/CommonGrid/components/icons/EyeOpen.js +13 -65
  89. package/ui/Blocks/CommonGrid/components/icons/Sorting.js +19 -72
  90. package/ui/Blocks/CommonGrid/components/utils.js +18 -67
  91. package/ui/Blocks/CommonGrid/hooks/useAddFilter.js +14 -14
  92. package/ui/Blocks/CommonGrid/hooks/useColumnSizes.js +85 -119
  93. package/ui/Blocks/CommonGrid/hooks/useCreatePreset.js +29 -77
  94. package/ui/Blocks/CommonGrid/hooks/useDeletePreset.js +21 -32
  95. package/ui/Blocks/CommonGrid/hooks/useEditReadAsColumn.js +56 -91
  96. package/ui/Blocks/CommonGrid/hooks/useEvent.js +10 -14
  97. package/ui/Blocks/CommonGrid/hooks/useFloatingButton.js +14 -15
  98. package/ui/Blocks/CommonGrid/hooks/useGridActionTrigger.js +25 -42
  99. package/ui/Blocks/CommonGrid/hooks/useGridAutoRowsPerPage.js +10 -20
  100. package/ui/Blocks/CommonGrid/hooks/useManageColumn.js +97 -220
  101. package/ui/Blocks/CommonGrid/hooks/usePresetFileHandlers.js +54 -124
  102. package/ui/Blocks/CommonGrid/hooks/usePresetsState.js +13 -57
  103. package/ui/Blocks/CommonGrid/hooks/useQuickFilter.js +76 -149
  104. package/ui/Blocks/CommonGrid/hooks/useRowsKeyControls.js +19 -23
  105. package/ui/Blocks/CommonGrid/hooks/useSelectPreset.js +18 -80
  106. package/ui/Blocks/CommonGrid/hooks/useToggleAllCheckbox.js +17 -28
  107. package/ui/Blocks/CommonGrid/hooks/useUxReset.js +12 -63
  108. package/ui/Blocks/CommonGrid/index.js +26 -10
  109. package/ui/Blocks/CommonGrid/store/index.js +286 -430
  110. package/ui/Blocks/CommonGrid/store/migrateState.js +10 -10
  111. package/ui/Blocks/CommonGrid/storybook/components/ComplexCell.js +16 -20
  112. package/ui/Blocks/CommonGrid/storybook/components/EnumCellExample.js +17 -22
  113. package/ui/Blocks/CommonGrid/storybook/utils/actions.js +9 -15
  114. package/ui/Blocks/CommonGrid/storybook/utils/columnDefinition.js +121 -156
  115. package/ui/Blocks/CommonGrid/storybook/utils/utils.js +106 -145
  116. package/ui/Blocks/CommonGrid/storybook/utils/withRedux.js +11 -14
  117. package/ui/Blocks/CommonGrid/storybook/utils/withRouter.js +5 -7
  118. package/ui/Blocks/CommonGrid/storybook/utils/withTheme.js +4 -5
  119. package/ui/Blocks/CommonGrid/styles.js +252 -97
  120. package/ui/Blocks/CommonGrid/types.js +22 -14
  121. package/ui/Blocks/CommonGrid/utils/constants.js +24 -22
  122. package/ui/Blocks/CommonGrid/utils/getExtendedExtraControlButtons.js +15 -44
  123. package/ui/Blocks/CommonGrid/utils/getRowsPerPage.js +8 -9
  124. package/ui/Blocks/CommonGrid/utils/hasSortTerminated.js +8 -9
  125. package/ui/Blocks/CommonGrid/utils/index.js +69 -107
  126. package/ui/Blocks/CornerDialog/CornerDialog.js +40 -94
  127. package/ui/Blocks/CornerDialog/index.js +3 -1
  128. package/ui/Blocks/CornerDialog/styles.js +56 -83
  129. package/ui/Blocks/CornerDialog/types.js +1 -0
  130. package/ui/Blocks/CornerDialog/utils.js +28 -26
  131. package/ui/Blocks/Header/components/MenuItems/components/MenuItem/index.js +12 -11
  132. package/ui/Blocks/Header/components/MenuItems/index.js +6 -11
  133. package/ui/Blocks/Header/components/MenuItems/styles.js +21 -35
  134. package/ui/Blocks/Header/components/UserMenu/components/UserInfo/index.js +20 -28
  135. package/ui/Blocks/Header/components/UserMenu/components/UserInfo/styles.js +13 -31
  136. package/ui/Blocks/Header/components/UserMenu/hooks/index.js +1 -1
  137. package/ui/Blocks/Header/components/UserMenu/hooks/useLogout.js +8 -9
  138. package/ui/Blocks/Header/components/UserMenu/index.js +45 -99
  139. package/ui/Blocks/Header/components/UserMenu/styles.js +24 -44
  140. package/ui/Blocks/Header/hooks/useChangeLanguage.js +7 -8
  141. package/ui/Blocks/Header/index.js +41 -57
  142. package/ui/Blocks/Header/styles.js +33 -54
  143. package/ui/Blocks/Header/types.js +1 -0
  144. package/ui/Blocks/Header/utils/constants.js +3 -1
  145. package/ui/Blocks/Header/utils/languageItems.js +13 -18
  146. package/ui/Blocks/HidePrint/HidePrint.js +11 -28
  147. package/ui/Blocks/ImageList/ImageList.js +76 -131
  148. package/ui/Blocks/ImageList/components/AddPhoto/index.js +33 -182
  149. package/ui/Blocks/ImageList/components/AddPhoto/styles.js +29 -42
  150. package/ui/Blocks/ImageList/components/CloseButton/index.js +15 -13
  151. package/ui/Blocks/ImageList/components/CloseButton/styles.js +17 -25
  152. package/ui/Blocks/ImageList/components/ImageElement/index.js +26 -27
  153. package/ui/Blocks/ImageList/components/ImageElement/styles.js +21 -63
  154. package/ui/Blocks/ImageList/components/ImageTag/index.js +12 -15
  155. package/ui/Blocks/ImageList/components/ImageTag/styles.js +8 -21
  156. package/ui/Blocks/ImageList/hooks/useControls.js +12 -66
  157. package/ui/Blocks/ImageList/hooks/useOnElementClick.js +12 -70
  158. package/ui/Blocks/ImageList/index.js +3 -1
  159. package/ui/Blocks/ImageList/styles.js +28 -47
  160. package/ui/Blocks/ImageList/types.js +1 -0
  161. package/ui/Blocks/LanguageSwitch/LanguageSwitch.js +50 -136
  162. package/ui/Blocks/LanguageSwitch/index.js +3 -1
  163. package/ui/Blocks/LanguageSwitch/styles.js +31 -49
  164. package/ui/Blocks/LanguageSwitch/types.js +1 -0
  165. package/ui/Blocks/LightBox/LightBox.js +37 -46
  166. package/ui/Blocks/LightBox/hooks/useLightBox.js +14 -19
  167. package/ui/Blocks/LightBox/index.js +4 -2
  168. package/ui/Blocks/LightBox/styles.js +27 -51
  169. package/ui/Blocks/LightBox/types.js +1 -0
  170. package/ui/Blocks/LoginPage/LoginPage.js +60 -77
  171. package/ui/Blocks/LoginPage/components/LoginForm.js +165 -220
  172. package/ui/Blocks/LoginPage/components/SocialLinks.js +78 -98
  173. package/ui/Blocks/LoginPage/index.js +4 -2
  174. package/ui/Blocks/LoginPage/styles.js +73 -93
  175. package/ui/Blocks/LoginPage/types.js +1 -0
  176. package/ui/Blocks/LoginPage/utils/links.js +9 -7
  177. package/ui/Blocks/Modal/Modal.js +122 -148
  178. package/ui/Blocks/Modal/hooks/useClickOutside.js +25 -35
  179. package/ui/Blocks/Modal/hooks/useModal.js +17 -64
  180. package/ui/Blocks/Modal/index.js +5 -3
  181. package/ui/Blocks/Modal/styles.js +181 -255
  182. package/ui/Blocks/Modal/types.js +1 -0
  183. package/ui/Blocks/Modal/utils.js +8 -6
  184. package/ui/Blocks/Popover/index.js +29 -50
  185. package/ui/Blocks/Scheduler/Scheduler.js +40 -104
  186. package/ui/Blocks/Scheduler/components/BookedTimeSlots/index.js +35 -123
  187. package/ui/Blocks/Scheduler/components/BookedTimeSlots/styles.js +34 -53
  188. package/ui/Blocks/Scheduler/components/CurrentTimeMarker/hooks/useCurrentTime.js +14 -61
  189. package/ui/Blocks/Scheduler/components/CurrentTimeMarker/index.js +11 -15
  190. package/ui/Blocks/Scheduler/components/CurrentTimeMarker/styles.js +29 -51
  191. package/ui/Blocks/Scheduler/components/DateChanger/index.js +46 -50
  192. package/ui/Blocks/Scheduler/components/DateChanger/styles.js +22 -35
  193. package/ui/Blocks/Scheduler/components/Groups/index.js +8 -14
  194. package/ui/Blocks/Scheduler/components/Groups/styles.js +31 -53
  195. package/ui/Blocks/Scheduler/components/TimeSlots/hooks/useRangeSelection.js +43 -114
  196. package/ui/Blocks/Scheduler/components/TimeSlots/hooks/useScroll.js +13 -17
  197. package/ui/Blocks/Scheduler/components/TimeSlots/index.js +45 -53
  198. package/ui/Blocks/Scheduler/components/TimeSlots/styles.js +51 -75
  199. package/ui/Blocks/Scheduler/hooks/useChangeDate.js +32 -83
  200. package/ui/Blocks/Scheduler/index.js +1 -1
  201. package/ui/Blocks/Scheduler/styles.js +21 -32
  202. package/ui/Blocks/Scheduler/types.js +1 -0
  203. package/ui/Blocks/Scheduler/utils/constants.js +8 -6
  204. package/ui/Blocks/Scheduler/utils/convertDateToTime.js +4 -4
  205. package/ui/Blocks/Scheduler/utils/convertIndexToISOString.js +9 -7
  206. package/ui/Blocks/Scheduler/utils/convertMinutesToDuration.js +8 -10
  207. package/ui/Blocks/Scheduler/utils/formatDate.js +7 -8
  208. package/ui/Blocks/Scheduler/utils/generateTimeArray.js +17 -15
  209. package/ui/Blocks/Scheduler/utils/getClosestStep.js +10 -8
  210. package/ui/Blocks/Scheduler/utils/getMinutesFromString.js +5 -5
  211. package/ui/Blocks/Scheduler/utils/getMinutesFromTime.js +5 -49
  212. package/ui/Blocks/Scheduler/utils/isActiveTime.js +9 -8
  213. package/ui/Blocks/Scheduler/utils/isToday.js +5 -3
  214. package/ui/Blocks/SideMenu/MenuItem.js +98 -191
  215. package/ui/Blocks/SideMenu/SideMenu.js +35 -80
  216. package/ui/Blocks/SideMenu/components/Footer.js +61 -95
  217. package/ui/Blocks/SideMenu/components/HamburgerMenu.js +49 -68
  218. package/ui/Blocks/SideMenu/components/SubitemTooltip.js +49 -133
  219. package/ui/Blocks/SideMenu/context/LeftMenuContext.js +17 -67
  220. package/ui/Blocks/SideMenu/context/useLeftMenuContext.js +7 -5
  221. package/ui/Blocks/SideMenu/hooks/useOutsideHover.js +23 -76
  222. package/ui/Blocks/SideMenu/index.js +5 -3
  223. package/ui/Blocks/SideMenu/stories/menuItems.js +106 -100
  224. package/ui/Blocks/SideMenu/styles.js +308 -415
  225. package/ui/Blocks/SideMenu/types.js +1 -0
  226. package/ui/Blocks/SideMenu/utils/constants.js +4 -2
  227. package/ui/Blocks/Stepper/Stepper.js +31 -50
  228. package/ui/Blocks/Stepper/components/StepCircle/index.js +14 -13
  229. package/ui/Blocks/Stepper/components/StepCircle/styles.js +22 -47
  230. package/ui/Blocks/Stepper/components/StepItem/index.js +48 -58
  231. package/ui/Blocks/Stepper/components/StepItem/styles.js +77 -86
  232. package/ui/Blocks/Stepper/hooks/useStepper.js +30 -78
  233. package/ui/Blocks/Stepper/index.js +3 -3
  234. package/ui/Blocks/Stepper/styles.js +24 -39
  235. package/ui/Blocks/Stepper/types.js +1 -0
  236. package/ui/Blocks/Table/Table.js +10 -31
  237. package/ui/Blocks/Table/index.js +1 -1
  238. package/ui/Blocks/Table/types.js +1 -0
  239. package/ui/Blocks/Tabs/TabContent.js +7 -8
  240. package/ui/Blocks/Tabs/Tabs.js +42 -53
  241. package/ui/Blocks/Tabs/hooks/useTabs.js +11 -59
  242. package/ui/Blocks/Tabs/index.js +5 -3
  243. package/ui/Blocks/Tabs/styles.js +94 -109
  244. package/ui/Blocks/Tabs/types.js +1 -0
  245. package/ui/Elements/Alert/Alert.js +71 -95
  246. package/ui/Elements/Alert/index.js +3 -1
  247. package/ui/Elements/Alert/styles.js +81 -126
  248. package/ui/Elements/Alert/types.js +1 -0
  249. package/ui/Elements/AsyncSelect/AsyncSelect.js +31 -157
  250. package/ui/Elements/AsyncSelect/index.js +3 -1
  251. package/ui/Elements/Avatar/Avatar.js +35 -150
  252. package/ui/Elements/Avatar/index.js +4 -3
  253. package/ui/Elements/Avatar/types.js +1 -0
  254. package/ui/Elements/Badge/Badge.js +50 -105
  255. package/ui/Elements/Badge/index.js +3 -1
  256. package/ui/Elements/BarChartSymbol/BarChartSymbol.js +19 -22
  257. package/ui/Elements/BarChartSymbol/index.js +1 -1
  258. package/ui/Elements/BarChartSymbol/styles.js +8 -32
  259. package/ui/Elements/BorderedBox/BorderedBox.js +20 -124
  260. package/ui/Elements/BorderedBox/index.js +3 -1
  261. package/ui/Elements/BorderedBox/types.js +1 -0
  262. package/ui/Elements/Button/Button.js +43 -153
  263. package/ui/Elements/Button/index.js +3 -1
  264. package/ui/Elements/Button/styles.js +224 -95
  265. package/ui/Elements/Button/types.js +1 -0
  266. package/ui/Elements/Card/Card.js +13 -13
  267. package/ui/Elements/Card/index.js +3 -1
  268. package/ui/Elements/Card/styles.js +21 -49
  269. package/ui/Elements/Card/types.js +1 -0
  270. package/ui/Elements/CheckedCircle/index.js +12 -11
  271. package/ui/Elements/CheckedCircle/styles.js +14 -29
  272. package/ui/Elements/DatePicker/DatePicker.js +84 -206
  273. package/ui/Elements/DatePicker/Datetime/DateTime.js +422 -724
  274. package/ui/Elements/DatePicker/Datetime/components/DateRepeater.js +62 -126
  275. package/ui/Elements/DatePicker/Datetime/components/FooterRow.js +10 -24
  276. package/ui/Elements/DatePicker/Datetime/components/FooterRowLabel.js +14 -20
  277. package/ui/Elements/DatePicker/Datetime/components/TimeInput.js +15 -21
  278. package/ui/Elements/DatePicker/Datetime/components/Timepicker.js +160 -254
  279. package/ui/Elements/DatePicker/Datetime/components/ViewNavigation.js +28 -84
  280. package/ui/Elements/DatePicker/Datetime/types.js +13 -11
  281. package/ui/Elements/DatePicker/Datetime/views/DaysView.js +134 -334
  282. package/ui/Elements/DatePicker/Datetime/views/MonthsView.js +71 -265
  283. package/ui/Elements/DatePicker/Datetime/views/YearsView.js +81 -276
  284. package/ui/Elements/DatePicker/index.js +5 -3
  285. package/ui/Elements/DatePicker/styles.js +233 -35
  286. package/ui/Elements/DatePicker/utils/constants.js +27 -33
  287. package/ui/Elements/Dropdown/Dropdown.js +53 -88
  288. package/ui/Elements/Dropdown/index.js +3 -1
  289. package/ui/Elements/Dropdown/types.js +1 -0
  290. package/ui/Elements/DropdownMenu/DropdownMenu.js +32 -134
  291. package/ui/Elements/DropdownMenu/components/DefaultItem.js +30 -56
  292. package/ui/Elements/DropdownMenu/components/MenuItem.js +56 -103
  293. package/ui/Elements/DropdownMenu/components/MenuList.js +13 -14
  294. package/ui/Elements/DropdownMenu/index.js +1 -1
  295. package/ui/Elements/DropdownMenu/types.js +1 -0
  296. package/ui/Elements/DropdownSelect/DropdownSelect.js +126 -205
  297. package/ui/Elements/DropdownSelect/index.js +3 -2
  298. package/ui/Elements/ErrorMessage/ErrorMessage.js +62 -56
  299. package/ui/Elements/ErrorMessage/index.js +3 -1
  300. package/ui/Elements/ErrorMessage/types.js +1 -0
  301. package/ui/Elements/HighlightBox/HighlightBox.js +97 -99
  302. package/ui/Elements/HighlightBox/index.js +3 -1
  303. package/ui/Elements/Icon/BadgeIcon.js +26 -121
  304. package/ui/Elements/Icon/Icon.js +182 -255
  305. package/ui/Elements/Icon/icons/Add.js +31 -91
  306. package/ui/Elements/Icon/icons/AddPhoto.js +32 -84
  307. package/ui/Elements/Icon/icons/Admin.js +24 -79
  308. package/ui/Elements/Icon/icons/ArrowDown.js +16 -68
  309. package/ui/Elements/Icon/icons/ArrowForward.js +10 -64
  310. package/ui/Elements/Icon/icons/ArrowUp.js +16 -68
  311. package/ui/Elements/Icon/icons/ArrowUpRightDownLeft.js +19 -77
  312. package/ui/Elements/Icon/icons/ArrowsLeftRight.js +10 -64
  313. package/ui/Elements/Icon/icons/ArrowsUpDown.js +10 -64
  314. package/ui/Elements/Icon/icons/BarcodeScan.js +11 -65
  315. package/ui/Elements/Icon/icons/Box.js +15 -67
  316. package/ui/Elements/Icon/icons/Calendar.js +37 -89
  317. package/ui/Elements/Icon/icons/Cancel.js +16 -68
  318. package/ui/Elements/Icon/icons/CheckedBox.js +21 -76
  319. package/ui/Elements/Icon/icons/CircleHalfStroke.js +10 -64
  320. package/ui/Elements/Icon/icons/Company.js +80 -137
  321. package/ui/Elements/Icon/icons/Complaint.js +57 -114
  322. package/ui/Elements/Icon/icons/Consolidation.js +11 -65
  323. package/ui/Elements/Icon/icons/Container.js +11 -65
  324. package/ui/Elements/Icon/icons/Dashboard.js +34 -86
  325. package/ui/Elements/Icon/icons/Desktop.js +61 -118
  326. package/ui/Elements/Icon/icons/Dispatch.js +11 -65
  327. package/ui/Elements/Icon/icons/EmptyRack.js +32 -32
  328. package/ui/Elements/Icon/icons/Expeditions.js +60 -112
  329. package/ui/Elements/Icon/icons/Filter.js +15 -67
  330. package/ui/Elements/Icon/icons/FlagCZ.js +53 -108
  331. package/ui/Elements/Icon/icons/FlagEL.js +48 -100
  332. package/ui/Elements/Icon/icons/FlagESP.js +91 -143
  333. package/ui/Elements/Icon/icons/FlagHU.js +25 -77
  334. package/ui/Elements/Icon/icons/FlagITA.js +53 -108
  335. package/ui/Elements/Icon/icons/FlagNL.js +25 -77
  336. package/ui/Elements/Icon/icons/FlagRUS.js +53 -108
  337. package/ui/Elements/Icon/icons/FlagSVK.js +90 -145
  338. package/ui/Elements/Icon/icons/FlagUK.js +18 -73
  339. package/ui/Elements/Icon/icons/FlagUSA.js +104 -168
  340. package/ui/Elements/Icon/icons/Foldable.js +32 -84
  341. package/ui/Elements/Icon/icons/Fragile.js +40 -92
  342. package/ui/Elements/Icon/icons/Gift.js +39 -91
  343. package/ui/Elements/Icon/icons/Group.js +15 -67
  344. package/ui/Elements/Icon/icons/HamburgerMenu.js +39 -91
  345. package/ui/Elements/Icon/icons/HelpCircle1.js +30 -82
  346. package/ui/Elements/Icon/icons/HorizontalLines.js +34 -86
  347. package/ui/Elements/Icon/icons/ImagePlaceholder.js +15 -67
  348. package/ui/Elements/Icon/icons/Income.js +20 -75
  349. package/ui/Elements/Icon/icons/Info.js +31 -83
  350. package/ui/Elements/Icon/icons/Integrations.js +15 -67
  351. package/ui/Elements/Icon/icons/Inventory.js +43 -100
  352. package/ui/Elements/Icon/icons/Inventory2.js +64 -121
  353. package/ui/Elements/Icon/icons/Layout.js +41 -91
  354. package/ui/Elements/Icon/icons/Link.js +18 -73
  355. package/ui/Elements/Icon/icons/Liquid.js +20 -75
  356. package/ui/Elements/Icon/icons/Location.js +11 -65
  357. package/ui/Elements/Icon/icons/Logout1.js +30 -82
  358. package/ui/Elements/Icon/icons/MachinePackingForbidden.js +68 -120
  359. package/ui/Elements/Icon/icons/MakePhoto.js +33 -85
  360. package/ui/Elements/Icon/icons/MenuItems.js +37 -91
  361. package/ui/Elements/Icon/icons/Message.js +36 -96
  362. package/ui/Elements/Icon/icons/MobileCancel.js +20 -75
  363. package/ui/Elements/Icon/icons/MobilePhone.js +45 -97
  364. package/ui/Elements/Icon/icons/Moon.js +10 -64
  365. package/ui/Elements/Icon/icons/Notification2.js +23 -78
  366. package/ui/Elements/Icon/icons/OpenBox.js +35 -87
  367. package/ui/Elements/Icon/icons/Pallet.js +34 -93
  368. package/ui/Elements/Icon/icons/Plus1.js +15 -67
  369. package/ui/Elements/Icon/icons/Print.js +39 -91
  370. package/ui/Elements/Icon/icons/Product.js +15 -67
  371. package/ui/Elements/Icon/icons/Products.js +14 -66
  372. package/ui/Elements/Icon/icons/Profile.js +23 -78
  373. package/ui/Elements/Icon/icons/Puzzle1.js +16 -68
  374. package/ui/Elements/Icon/icons/QRCode.js +17 -69
  375. package/ui/Elements/Icon/icons/Rack.js +63 -115
  376. package/ui/Elements/Icon/icons/Reload.js +11 -65
  377. package/ui/Elements/Icon/icons/Return.js +17 -72
  378. package/ui/Elements/Icon/icons/Rows.js +37 -89
  379. package/ui/Elements/Icon/icons/Settings2.js +31 -91
  380. package/ui/Elements/Icon/icons/ShieldUser.js +7 -61
  381. package/ui/Elements/Icon/icons/ShoppingBag.js +16 -67
  382. package/ui/Elements/Icon/icons/Sort.js +21 -76
  383. package/ui/Elements/Icon/icons/Sun.js +10 -64
  384. package/ui/Elements/Icon/icons/ThreeDots.js +37 -89
  385. package/ui/Elements/Icon/icons/ToastError.js +25 -82
  386. package/ui/Elements/Icon/icons/ToastSuccess.js +25 -82
  387. package/ui/Elements/Icon/icons/Transfer.js +19 -74
  388. package/ui/Elements/Icon/icons/TrashBin.js +31 -83
  389. package/ui/Elements/Icon/icons/Truck.js +71 -127
  390. package/ui/Elements/Icon/icons/TwoBoxes.js +18 -73
  391. package/ui/Elements/Icon/icons/TwoCheckedBoxes.js +27 -27
  392. package/ui/Elements/Icon/icons/TwoUsers.js +40 -91
  393. package/ui/Elements/Icon/icons/UserCowboy.js +7 -61
  394. package/ui/Elements/Icon/icons/Valuable.js +32 -83
  395. package/ui/Elements/Icon/icons/Weight.js +10 -64
  396. package/ui/Elements/Icon/icons/index.js +188 -92
  397. package/ui/Elements/Icon/index.js +96 -4
  398. package/ui/Elements/Icon/types.js +1 -0
  399. package/ui/Elements/Image/Image.js +13 -154
  400. package/ui/Elements/Image/index.js +3 -1
  401. package/ui/Elements/Image/types.js +1 -0
  402. package/ui/Elements/Label/Label.js +22 -61
  403. package/ui/Elements/Label/index.js +4 -3
  404. package/ui/Elements/Line/Line.js +20 -44
  405. package/ui/Elements/Line/index.js +3 -1
  406. package/ui/Elements/Line/types.js +1 -0
  407. package/ui/Elements/Link/Link.js +42 -126
  408. package/ui/Elements/Link/index.js +3 -1
  409. package/ui/Elements/Logo/Logo.js +51 -148
  410. package/ui/Elements/Logo/index.js +3 -1
  411. package/ui/Elements/Logo/types.js +1 -0
  412. package/ui/Elements/Pagination/Pagination.js +61 -85
  413. package/ui/Elements/Pagination/index.js +3 -1
  414. package/ui/Elements/Pagination/styled.js +62 -89
  415. package/ui/Elements/Portal/index.js +20 -68
  416. package/ui/Elements/ProgressBar/ProgressBar.js +15 -19
  417. package/ui/Elements/ProgressBar/index.js +3 -1
  418. package/ui/Elements/ProgressBar/styles.js +69 -114
  419. package/ui/Elements/Select/Select.js +94 -442
  420. package/ui/Elements/Select/components/ChevronOption.js +29 -87
  421. package/ui/Elements/Select/components/ConnectedMenu.js +24 -85
  422. package/ui/Elements/Select/components/CountMultiValue.js +40 -132
  423. package/ui/Elements/Select/components/CustomInput.js +11 -61
  424. package/ui/Elements/Select/components/DropdownIndicator.js +28 -94
  425. package/ui/Elements/Select/components/IconValueContainer.js +27 -139
  426. package/ui/Elements/Select/components/SelectAll.js +87 -164
  427. package/ui/Elements/Select/components/SelectedIndicator.js +7 -23
  428. package/ui/Elements/Select/components/SimplifiedOption.js +15 -23
  429. package/ui/Elements/Select/index.js +3 -1
  430. package/ui/Elements/Select/styles.js +16 -44
  431. package/ui/Elements/Select/themes/index.js +37 -44
  432. package/ui/Elements/Select/themes/selectStyles.js +194 -302
  433. package/ui/Elements/Select/types.js +1 -0
  434. package/ui/Elements/SimpleLink/SimpleLink.js +35 -64
  435. package/ui/Elements/SimpleLink/index.js +5 -3
  436. package/ui/Elements/SingleSelect/SingleSelect.js +145 -509
  437. package/ui/Elements/SingleSelect/index.js +3 -1
  438. package/ui/Elements/SpaceAround/SpaceAround.js +31 -166
  439. package/ui/Elements/SpaceAround/index.js +3 -1
  440. package/ui/Elements/SpaceAround/types.js +1 -0
  441. package/ui/Elements/Spinner/Spinner.js +35 -36
  442. package/ui/Elements/Spinner/index.js +3 -1
  443. package/ui/Elements/Spinner/styles.js +35 -65
  444. package/ui/Elements/Spinner/types.js +1 -0
  445. package/ui/Elements/Table/Table.js +44 -77
  446. package/ui/Elements/Table/index.js +1 -1
  447. package/ui/Elements/Tag/Tag.js +47 -82
  448. package/ui/Elements/Tag/index.js +4 -2
  449. package/ui/Elements/Tag/palettes.js +50 -45
  450. package/ui/Elements/Tag/stories/components/predefinedTags.js +17 -18
  451. package/ui/Elements/Tag/types.js +1 -0
  452. package/ui/Elements/Text/Text.js +9 -75
  453. package/ui/Elements/Text/index.js +1 -1
  454. package/ui/Elements/Text/types.js +1 -0
  455. package/ui/Elements/Toast/Toast.js +33 -55
  456. package/ui/Elements/Toast/constants.js +17 -15
  457. package/ui/Elements/Toast/index.js +3 -1
  458. package/ui/Elements/Toast/styles.js +74 -104
  459. package/ui/Elements/Toggle/Toggle.js +120 -258
  460. package/ui/Elements/Toggle/index.js +3 -1
  461. package/ui/Elements/Toggle/types.js +1 -0
  462. package/ui/Elements/Tooltip/Tooltip.js +49 -119
  463. package/ui/Elements/Tooltip/index.js +3 -1
  464. package/ui/Elements/Typography/Typography.js +73 -158
  465. package/ui/Elements/Typography/index.js +4 -3
  466. package/ui/Forms/Checkbox/Checkbox.js +39 -40
  467. package/ui/Forms/Checkbox/index.js +5 -3
  468. package/ui/Forms/Checkbox/styles.js +92 -74
  469. package/ui/Forms/Checkbox/types.js +1 -0
  470. package/ui/Forms/Input/Input.js +125 -258
  471. package/ui/Forms/Input/index.js +3 -1
  472. package/ui/Forms/Input/styles.js +217 -201
  473. package/ui/Forms/Input/types.js +1 -0
  474. package/ui/Forms/RadioButton/RadioButton.js +22 -101
  475. package/ui/Forms/RadioButton/index.js +3 -1
  476. package/ui/Forms/RadioButton/styles.js +85 -75
  477. package/ui/Forms/RadioButton/types.js +1 -0
  478. package/ui/Forms/TextArea/TextArea.js +33 -153
  479. package/ui/Forms/TextArea/index.js +3 -1
  480. package/ui/Forms/TextArea/styles.js +75 -99
  481. package/ui/System/Fonts/index.js +47 -10
  482. package/ui/ThemeProvider/ThemeProvider.js +15 -18
  483. package/ui/ThemeProvider/index.js +5 -4
  484. package/ui/ThemeProvider/themes/default.js +185 -193
  485. package/ui/ThemeProvider/themes/index.js +10 -9
  486. package/ui/ThemeProvider/themes/light.js +7 -8
  487. package/ui/ThemeProvider/themes/mailwise.js +229 -236
  488. package/ui/ThemeProvider/types.js +1 -0
  489. package/ui/_virtual/_rolldown/runtime.js +13 -0
  490. package/ui/hooks/useToggleAndClose.js +15 -62
  491. package/ui/index.js +179 -94
  492. package/ui/utils/CheckDeviceWidth/checkDeviceWidth.js +14 -63
  493. package/ui/utils/CreateRgba/createRgba.js +11 -16
  494. package/ui/utils/CreateRgba/types.js +1 -0
  495. package/ui/utils/KeyPress/KeyPress.js +15 -22
  496. package/ui/utils/KeyPress/index.js +4 -2
  497. package/ui/utils/KeyPress/types.js +1 -0
  498. package/ui/utils/LinguiContainer/index.js +7 -6
  499. package/ui/utils/index.js +7 -5
  500. package/ui/utils/translations.js +334 -333
  501. package/ui/Blocks/CommonGrid/store/store.d.js +0 -0
  502. package/ui/Blocks/CornerDialog/index.d.js +0 -2
  503. package/ui/Blocks/ImageList/index.d.js +0 -2
  504. package/ui/Blocks/LightBox/index.d.js +0 -3
  505. package/ui/Blocks/Modal/index.d.js +0 -3
  506. package/ui/Blocks/Tabs/index.d.js +0 -3
  507. package/ui/Elements/Alert/index.d.js +0 -3
  508. package/ui/Elements/Avatar/index.d.js +0 -2
  509. package/ui/Elements/Badge/index.d.js +0 -2
  510. package/ui/Elements/BorderedBox/index.d.js +0 -3
  511. package/ui/Elements/Button/Button.d.js +0 -2
  512. package/ui/Elements/Button/index.d.js +0 -3
  513. package/ui/Elements/Card/index.d.js +0 -2
  514. package/ui/Elements/ErrorMessage/index.d.js +0 -3
  515. package/ui/Elements/Line/index.d.js +0 -3
  516. package/ui/Elements/Logo/default.d.js +0 -0
  517. package/ui/Elements/Logo/index.d.js +0 -2
  518. package/ui/Elements/Pagination/index.d.js +0 -3
  519. package/ui/Elements/Spinner/index.d.js +0 -2
  520. package/ui/Elements/Tag/index.d.js +0 -3
  521. package/ui/Elements/Text/index.d.js +0 -2
  522. package/ui/Elements/Toast/index.d.js +0 -3
  523. package/ui/Elements/Toggle/index.d.js +0 -2
  524. package/ui/Elements/Tooltip/index.d.js +0 -2
  525. package/ui/Elements/Typography/index.d.js +0 -2
  526. package/ui/Forms/Checkbox/index.d.js +0 -2
  527. package/ui/Forms/Input/index.d.js +0 -3
  528. package/ui/Forms/RadioButton/index.d.js +0 -2
  529. package/ui/System/Fonts/font.d.js +0 -0
  530. package/ui/ThemeProvider/ThemeProvider.d.js +0 -2
  531. package/ui/ThemeProvider/index.d.js +0 -3
  532. package/ui/utils/index.d.js +0 -3
@@ -1,730 +1,428 @@
1
- function _assert_this_initialized(self) {
2
- if (self === void 0) {
3
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
4
- }
5
- return self;
6
- }
7
- function _call_super(_this, derived, args) {
8
- derived = _get_prototype_of(derived);
9
- return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
10
- }
11
- function _class_call_check(instance, Constructor) {
12
- if (!(instance instanceof Constructor)) {
13
- throw new TypeError("Cannot call a class as a function");
14
- }
15
- }
16
- function _defineProperties(target, props) {
17
- for(var i = 0; i < props.length; i++){
18
- var descriptor = props[i];
19
- descriptor.enumerable = descriptor.enumerable || false;
20
- descriptor.configurable = true;
21
- if ("value" in descriptor) descriptor.writable = true;
22
- Object.defineProperty(target, descriptor.key, descriptor);
23
- }
24
- }
25
- function _create_class(Constructor, protoProps, staticProps) {
26
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
27
- if (staticProps) _defineProperties(Constructor, staticProps);
28
- return Constructor;
29
- }
30
- function _define_property(obj, key, value) {
31
- if (key in obj) {
32
- Object.defineProperty(obj, key, {
33
- value: value,
34
- enumerable: true,
35
- configurable: true,
36
- writable: true
37
- });
38
- } else {
39
- obj[key] = value;
40
- }
41
- return obj;
42
- }
43
- function _get_prototype_of(o) {
44
- _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
45
- return o.__proto__ || Object.getPrototypeOf(o);
46
- };
47
- return _get_prototype_of(o);
48
- }
49
- function _inherits(subClass, superClass) {
50
- if (typeof superClass !== "function" && superClass !== null) {
51
- throw new TypeError("Super expression must either be null or a function");
52
- }
53
- subClass.prototype = Object.create(superClass && superClass.prototype, {
54
- constructor: {
55
- value: subClass,
56
- writable: true,
57
- configurable: true
58
- }
59
- });
60
- if (superClass) _set_prototype_of(subClass, superClass);
61
- }
62
- function _object_spread(target) {
63
- for(var i = 1; i < arguments.length; i++){
64
- var source = arguments[i] != null ? arguments[i] : {};
65
- var ownKeys = Object.keys(source);
66
- if (typeof Object.getOwnPropertySymbols === "function") {
67
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
68
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
69
- }));
70
- }
71
- ownKeys.forEach(function(key) {
72
- _define_property(target, key, source[key]);
73
- });
74
- }
75
- return target;
76
- }
77
- function ownKeys(object, enumerableOnly) {
78
- var keys = Object.keys(object);
79
- if (Object.getOwnPropertySymbols) {
80
- var symbols = Object.getOwnPropertySymbols(object);
81
- if (enumerableOnly) {
82
- symbols = symbols.filter(function(sym) {
83
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
84
- });
85
- }
86
- keys.push.apply(keys, symbols);
87
- }
88
- return keys;
89
- }
90
- function _object_spread_props(target, source) {
91
- source = source != null ? source : {};
92
- if (Object.getOwnPropertyDescriptors) {
93
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
94
- } else {
95
- ownKeys(Object(source)).forEach(function(key) {
96
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
97
- });
98
- }
99
- return target;
100
- }
101
- function _possible_constructor_return(self, call) {
102
- if (call && (_type_of(call) === "object" || typeof call === "function")) {
103
- return call;
104
- }
105
- return _assert_this_initialized(self);
106
- }
107
- function _set_prototype_of(o, p) {
108
- _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
109
- o.__proto__ = p;
110
- return o;
111
- };
112
- return _set_prototype_of(o, p);
113
- }
114
- function _type_of(obj) {
115
- "@swc/helpers - typeof";
116
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
117
- }
118
- function _is_native_reflect_construct() {
119
- try {
120
- var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
121
- } catch (_) {}
122
- return (_is_native_reflect_construct = function() {
123
- return !!result;
124
- })();
125
- }
126
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ import DaysView from "./views/DaysView.js";
2
+ import MonthsView from "./views/MonthsView.js";
3
+ import YearsView from "./views/YearsView.js";
127
4
  import React from "react";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
128
6
  import moment from "moment";
129
7
  import onClickOutside from "react-onclickoutside";
130
- import DaysView from "./views/DaysView";
131
- import MonthsView from "./views/MonthsView";
132
- import YearsView from "./views/YearsView";
133
- var viewModes = {
134
- YEARS: "years",
135
- MONTHS: "months",
136
- DAYS: "days",
137
- TIME: "time"
8
+ //#region packages/ui/Elements/DatePicker/Datetime/DateTime.tsx
9
+ const viewModes = {
10
+ YEARS: "years",
11
+ MONTHS: "months",
12
+ DAYS: "days",
13
+ TIME: "time"
14
+ };
15
+ const nofn = function() {};
16
+ var Datetime = class extends React.Component {
17
+ static {
18
+ this.defaultProps = {
19
+ onOpen: nofn,
20
+ onClose: nofn,
21
+ onCalendarOpen: nofn,
22
+ onCalendarClose: nofn,
23
+ onChange: nofn,
24
+ onNavigate: nofn,
25
+ onBeforeNavigate: function(next) {
26
+ return next;
27
+ },
28
+ onNavigateBack: nofn,
29
+ onNavigateForward: nofn,
30
+ dateFormat: true,
31
+ timeFormat: true,
32
+ utc: false,
33
+ className: "",
34
+ input: true,
35
+ inputProps: {},
36
+ timeConstraints: {},
37
+ isValidDate: function() {
38
+ return true;
39
+ },
40
+ strictParsing: true,
41
+ closeOnSelect: false,
42
+ closeOnTab: true,
43
+ closeOnClickOutside: true,
44
+ renderView: (_, renderFunc) => renderFunc()
45
+ };
46
+ }
47
+ static {
48
+ this.moment = moment;
49
+ }
50
+ constructor(props) {
51
+ super(props);
52
+ this._renderCalendar = () => {
53
+ const props = this.props;
54
+ const state = this.state;
55
+ let viewProps = {
56
+ viewDate: state.viewDate.clone(),
57
+ label: props.label,
58
+ isSecondDatePicker: props.isSecondDatePicker,
59
+ secondValue: props.secondValue,
60
+ selectedDate: this.getSelectedDate(),
61
+ isValidDate: props.isValidDate,
62
+ updateDate: this._updateDate,
63
+ others: props.others,
64
+ onChangeOthers: props.onChangeOthers,
65
+ reset: this._reset,
66
+ navigate: this._viewNavigate,
67
+ moment,
68
+ showView: this._showView
69
+ };
70
+ switch (state.currentView) {
71
+ case viewModes.YEARS:
72
+ viewProps.renderYear = props.renderYear;
73
+ return /* @__PURE__ */ jsx(YearsView, { ...viewProps });
74
+ case viewModes.MONTHS:
75
+ viewProps.renderMonth = props.renderMonth;
76
+ return /* @__PURE__ */ jsx(MonthsView, { ...viewProps });
77
+ case viewModes.DAYS:
78
+ viewProps.renderDay = props.renderDay;
79
+ viewProps.timeFormat = this.getFormat("time");
80
+ viewProps.setTime = this._setTime;
81
+ viewProps.value = this.props.value;
82
+ viewProps.disabled = this.props.disabled;
83
+ return /* @__PURE__ */ jsx(DaysView, { ...viewProps });
84
+ default:
85
+ viewProps.renderDay = props.renderDay;
86
+ viewProps.timeFormat = this.getFormat("time");
87
+ viewProps.setTime = this._setTime;
88
+ viewProps.value = this.props.value;
89
+ return /* @__PURE__ */ jsx(DaysView, { ...viewProps });
90
+ }
91
+ };
92
+ this._showView = (view, date) => {
93
+ const d = (date || this.state.viewDate).clone();
94
+ const nextView = this.props.onBeforeNavigate(view, this.state.currentView, d);
95
+ if (nextView && this.state.currentView !== nextView) {
96
+ this.props.onNavigate(nextView);
97
+ this.setState({ currentView: nextView });
98
+ }
99
+ };
100
+ this.viewToMethod = {
101
+ days: "date",
102
+ months: "month",
103
+ years: "year"
104
+ };
105
+ this.nextView = {
106
+ days: "time",
107
+ months: "days",
108
+ years: "months"
109
+ };
110
+ this._updateDate = (e) => {
111
+ let currentView = this.state.currentView;
112
+ let updateOnView = this.getUpdateOn(this.getFormat("date"));
113
+ let viewDate = this.state.viewDate.clone();
114
+ viewDate[this.viewToMethod[currentView]](parseInt(e.target.getAttribute("data-value"), 10));
115
+ if (currentView === "days") {
116
+ viewDate.month(parseInt(e.target.getAttribute("data-month"), 10));
117
+ viewDate.year(parseInt(e.target.getAttribute("data-year"), 10));
118
+ }
119
+ let update = { viewDate };
120
+ if (currentView === updateOnView) {
121
+ update.selectedDate = viewDate.clone();
122
+ update.inputValue = viewDate.format(this.getFormat("datetime"));
123
+ if (this.props.open === void 0 && this.props.input && this.props.closeOnSelect) this._closeCalendar();
124
+ this.props.onChange(viewDate.clone());
125
+ } else this._showView(this.nextView[currentView], viewDate);
126
+ this.setState(update);
127
+ };
128
+ this._viewNavigate = (modifier, unit) => {
129
+ let viewDate = this.state.viewDate.clone();
130
+ viewDate.add(modifier, unit);
131
+ if (modifier > 0) this.props.onNavigateForward(modifier, unit);
132
+ else this.props.onNavigateBack(-modifier, unit);
133
+ this.setState({ viewDate });
134
+ };
135
+ this._setTime = (type, value) => {
136
+ let date = (this.getSelectedDate() || this.state.viewDate).clone();
137
+ date[type](value);
138
+ if (!this.props.value) this.setState({
139
+ selectedDate: date,
140
+ viewDate: date.clone(),
141
+ inputValue: date.format(this.getFormat("datetime"))
142
+ });
143
+ this.props.onChange(date);
144
+ };
145
+ this._reset = () => {
146
+ this.props.onChange(void 0);
147
+ };
148
+ this._openCalendar = () => {
149
+ if (this.isOpen()) return;
150
+ this.setState({ open: true }, this.props.onOpen);
151
+ };
152
+ this._closeCalendar = () => {
153
+ if (!this.isOpen()) return;
154
+ this.setState({ open: false }, () => {
155
+ this.props.onClose(this.state.selectedDate || this.state.inputValue);
156
+ });
157
+ };
158
+ this._handleClickOutside = () => {
159
+ let props = this.props;
160
+ if (props.input && this.state.open && props.open === void 0 && props.closeOnClickOutside) this._closeCalendar();
161
+ };
162
+ this._onInputFocus = (e) => {
163
+ if (!this.callHandler(this.props.inputProps.onFocus, e)) return;
164
+ this._openCalendar();
165
+ };
166
+ this._onInputChange = (e) => {
167
+ if (!this.callHandler(this.props.inputProps.onChange, e)) return;
168
+ const value = e.target ? e.target.value : e;
169
+ const localMoment = this.localMoment(value, this.getFormat("datetime"));
170
+ let update = { inputValue: value };
171
+ if (localMoment.isValid()) {
172
+ update.selectedDate = localMoment;
173
+ update.viewDate = localMoment.clone().startOf("month");
174
+ } else update.selectedDate = null;
175
+ this.setState(update, () => {
176
+ this.props.onChange(localMoment.isValid() ? localMoment : this.state.inputValue);
177
+ });
178
+ };
179
+ this._onInputKeyDown = (e) => {
180
+ if (!this.callHandler(this.props.inputProps.onKeyDown, e)) return;
181
+ if (e.which === 9 && this.props.closeOnTab) this._closeCalendar();
182
+ };
183
+ this._onInputClick = (e) => {
184
+ if (!this.callHandler(this.props.inputProps.onClick, e)) return;
185
+ this._openCalendar();
186
+ };
187
+ this.state = this.getInitialState();
188
+ }
189
+ render() {
190
+ return /* @__PURE__ */ jsxs(ClickableWrapper, {
191
+ className: this.getClassName(),
192
+ onClickOut: this._handleClickOutside,
193
+ children: [this.renderInput(), /* @__PURE__ */ jsx("div", {
194
+ className: "rdtPicker",
195
+ children: this.renderView()
196
+ })]
197
+ });
198
+ }
199
+ renderInput() {
200
+ if (!this.props.input) return;
201
+ const finalInputProps = {
202
+ type: "text",
203
+ className: "form-control",
204
+ value: this.getInputValue(),
205
+ ...this.props.inputProps,
206
+ onFocus: this._onInputFocus,
207
+ onChange: this._onInputChange,
208
+ onKeyDown: this._onInputKeyDown,
209
+ onClick: this._onInputClick
210
+ };
211
+ if (this.props.renderInput) return /* @__PURE__ */ jsx("div", { children: this.props.renderInput(finalInputProps, this._openCalendar, this._closeCalendar) });
212
+ return /* @__PURE__ */ jsx("input", { ...finalInputProps });
213
+ }
214
+ renderView() {
215
+ return this.props.renderView(this.state.currentView, this._renderCalendar);
216
+ }
217
+ getInitialState() {
218
+ let props = this.props;
219
+ let inputFormat = this.getFormat("datetime");
220
+ let selectedDate = this.parseDate(props.value || props.initialValue, inputFormat);
221
+ this.checkTZ();
222
+ return {
223
+ open: !props.input,
224
+ currentView: props.initialViewMode || this.getInitialView(),
225
+ viewDate: this.getInitialViewDate(selectedDate),
226
+ selectedDate: selectedDate && selectedDate.isValid() ? selectedDate : void 0,
227
+ inputValue: this.getInitialInputValue(selectedDate)
228
+ };
229
+ }
230
+ getInitialViewDate(selectedDate) {
231
+ const propDate = this.props.initialViewDate;
232
+ let viewDate;
233
+ if (propDate) {
234
+ viewDate = this.parseDate(propDate, this.getFormat("datetime"));
235
+ if (viewDate && viewDate.isValid()) return viewDate;
236
+ else console.log("The initialViewDated given \"" + propDate + "\" is not valid. Using current date instead.");
237
+ } else if (selectedDate && selectedDate.isValid()) return selectedDate.clone();
238
+ return this.getInitialDate();
239
+ }
240
+ getInitialDate() {
241
+ let m = this.localMoment();
242
+ m.hour(0).minute(0).second(0).millisecond(0);
243
+ return m;
244
+ }
245
+ getInitialView() {
246
+ const dateFormat = this.getFormat("date");
247
+ return dateFormat ? this.getUpdateOn(dateFormat) : viewModes.TIME;
248
+ }
249
+ parseDate(date, dateFormat) {
250
+ let parsedDate;
251
+ if (date && typeof date === "string") parsedDate = this.localMoment(date, dateFormat);
252
+ else if (date) parsedDate = this.localMoment(date);
253
+ if (parsedDate && !parsedDate.isValid()) parsedDate = null;
254
+ return parsedDate;
255
+ }
256
+ getClassName() {
257
+ let cn = "rdt";
258
+ let props = this.props;
259
+ let propCn = props.className;
260
+ if (Array.isArray(propCn)) cn += " " + propCn.join(" ");
261
+ else if (propCn) cn += " " + propCn;
262
+ if (!props.input) cn += " rdtStatic";
263
+ if (this.isOpen()) cn += " rdtOpen";
264
+ return cn;
265
+ }
266
+ isOpen() {
267
+ return !this.props.input || (this.props.open === void 0 ? this.state.open : this.props.open);
268
+ }
269
+ getUpdateOn(dateFormat) {
270
+ if (this.props.updateOnView) return this.props.updateOnView;
271
+ if (dateFormat.match(/[lLD]/)) return viewModes.DAYS;
272
+ if (dateFormat.indexOf("M") !== -1) return viewModes.MONTHS;
273
+ if (dateFormat.indexOf("Y") !== -1) return viewModes.YEARS;
274
+ return viewModes.DAYS;
275
+ }
276
+ getLocaleData() {
277
+ let p = this.props;
278
+ return this.localMoment(p.value || p.defaultValue || /* @__PURE__ */ new Date()).localeData();
279
+ }
280
+ getDateFormat() {
281
+ const locale = this.getLocaleData();
282
+ let format = this.props.dateFormat;
283
+ if (format === true) return locale.longDateFormat("L");
284
+ if (format) return format;
285
+ return "";
286
+ }
287
+ getTimeFormat() {
288
+ const locale = this.getLocaleData();
289
+ let format = this.props.timeFormat;
290
+ if (format === true) return locale.longDateFormat("LT");
291
+ return format || "";
292
+ }
293
+ getFormat(type) {
294
+ if (type === "date") return this.getDateFormat();
295
+ else if (type === "time") return this.getTimeFormat();
296
+ let dateFormat = this.getDateFormat();
297
+ let timeFormat = this.getTimeFormat();
298
+ return dateFormat && timeFormat ? dateFormat + " " + timeFormat : dateFormat || timeFormat;
299
+ }
300
+ updateTime(op, amount, type, toSelected) {
301
+ let update = {};
302
+ const date = toSelected ? "selectedDate" : "viewDate";
303
+ update[date] = this.state[date].clone()[op](amount, type);
304
+ this.setState(update);
305
+ }
306
+ localMoment(date, format, props) {
307
+ props = props || this.props;
308
+ let m = null;
309
+ if (props.utc) m = moment.utc(date, format, props.strictParsing);
310
+ else if (props.displayTimeZone) m = moment.tz(date, format, props.displayTimeZone);
311
+ else m = moment(date, format, props.strictParsing);
312
+ if (props.locale) m.locale(props.locale);
313
+ return m;
314
+ }
315
+ checkTZ() {
316
+ const { displayTimeZone } = this.props;
317
+ if (displayTimeZone && !this.tzWarning && !moment.tz) this.tzWarning = true;
318
+ }
319
+ componentDidUpdate(prevProps) {
320
+ if (prevProps === this.props) return;
321
+ let needsUpdate = false;
322
+ let thisProps = this.props;
323
+ [
324
+ "locale",
325
+ "utc",
326
+ "displayZone",
327
+ "dateFormat",
328
+ "timeFormat"
329
+ ].forEach(function(p) {
330
+ prevProps[p] !== thisProps[p] && (needsUpdate = true);
331
+ });
332
+ if (needsUpdate) this.regenerateDates();
333
+ if (thisProps.value && thisProps.value !== prevProps.value) this.setViewDate(thisProps.value);
334
+ this.checkTZ();
335
+ }
336
+ regenerateDates() {
337
+ const props = this.props;
338
+ let viewDate = this.state.viewDate.clone();
339
+ let selectedDate = this.state.selectedDate && this.state.selectedDate.clone();
340
+ if (props.locale) {
341
+ viewDate.locale(props.locale);
342
+ selectedDate && selectedDate.locale(props.locale);
343
+ }
344
+ if (props.utc) {
345
+ viewDate.utc();
346
+ selectedDate && selectedDate.utc();
347
+ } else if (props.displayTimeZone) {
348
+ viewDate.tz(props.displayTimeZone);
349
+ selectedDate && selectedDate.tz(props.displayTimeZone);
350
+ } else {
351
+ viewDate.locale();
352
+ selectedDate && selectedDate.locale();
353
+ }
354
+ let update = {
355
+ viewDate,
356
+ selectedDate
357
+ };
358
+ if (selectedDate && selectedDate.isValid()) update.inputValue = selectedDate.format(this.getFormat("datetime"));
359
+ this.setState(update);
360
+ }
361
+ getSelectedDate() {
362
+ if (this.props.value === void 0) return this.state.selectedDate;
363
+ let selectedDate = this.parseDate(this.props.value, this.getFormat("datetime"));
364
+ return selectedDate && selectedDate.isValid() ? selectedDate : false;
365
+ }
366
+ getInitialInputValue(selectedDate) {
367
+ const props = this.props;
368
+ if (props.inputProps.value) return props.inputProps.value;
369
+ if (selectedDate && selectedDate.isValid()) return selectedDate.format(this.getFormat("datetime"));
370
+ if (props.value && typeof props.value === "string") return props.value;
371
+ if (props.initialValue && typeof props.initialValue === "string") return props.initialValue;
372
+ return "";
373
+ }
374
+ getInputValue() {
375
+ let selectedDate = this.getSelectedDate();
376
+ return selectedDate ? selectedDate.format(this.getFormat("datetime")) : this.state.inputValue;
377
+ }
378
+ /**
379
+ * Set the date that is currently shown in the calendar.
380
+ * This is independent from the selected date and it's the one used to navigate through months or days in the calendar.
381
+ * @param dateType date
382
+ * @public
383
+ */
384
+ setViewDate(date) {
385
+ let logError = function() {
386
+ return console.log("Invalid date passed to the `setViewDate` method: " + date);
387
+ };
388
+ if (!date) return logError();
389
+ let viewDate;
390
+ if (typeof date === "string") viewDate = this.localMoment(date, this.getFormat("datetime"));
391
+ else viewDate = this.localMoment(date);
392
+ if (!viewDate || !viewDate.isValid()) return logError();
393
+ this.setState({ viewDate });
394
+ }
395
+ /**
396
+ * Set the view currently shown by the calendar. View modes shipped with react-datetime are 'years', 'months', 'days' and 'time'.
397
+ * @param TYPES.string mode
398
+ */
399
+ navigate(mode) {
400
+ this._showView(mode);
401
+ }
402
+ callHandler(method, e) {
403
+ if (!method) return true;
404
+ return method(e) !== false;
405
+ }
138
406
  };
139
- var nofn = function nofn() {};
140
- var Datetime = /*#__PURE__*/ function(_React_Component) {
141
- "use strict";
142
- _inherits(Datetime, _React_Component);
143
- function Datetime(props) {
144
- _class_call_check(this, Datetime);
145
- var _this;
146
- _this = _call_super(this, Datetime, [
147
- props
148
- ]);
149
- _this._renderCalendar = function() {
150
- var _$props = _this.props;
151
- var state = _this.state;
152
- var viewProps = {
153
- viewDate: state.viewDate.clone(),
154
- label: _$props.label,
155
- isSecondDatePicker: _$props.isSecondDatePicker,
156
- secondValue: _$props.secondValue,
157
- selectedDate: _this.getSelectedDate(),
158
- isValidDate: _$props.isValidDate,
159
- updateDate: _this._updateDate,
160
- others: _$props.others,
161
- onChangeOthers: _$props.onChangeOthers,
162
- reset: _this._reset,
163
- navigate: _this._viewNavigate,
164
- moment: moment,
165
- showView: _this._showView
166
- };
167
- switch(state.currentView){
168
- case viewModes.YEARS:
169
- viewProps.renderYear = _$props.renderYear;
170
- return /* @__PURE__ */ jsx(YearsView, _object_spread({}, viewProps));
171
- case viewModes.MONTHS:
172
- viewProps.renderMonth = _$props.renderMonth;
173
- return /* @__PURE__ */ jsx(MonthsView, _object_spread({}, viewProps));
174
- case viewModes.DAYS:
175
- viewProps.renderDay = _$props.renderDay;
176
- viewProps.timeFormat = _this.getFormat("time");
177
- viewProps.setTime = _this._setTime;
178
- viewProps.value = _this.props.value;
179
- viewProps.disabled = _this.props.disabled;
180
- return /* @__PURE__ */ jsx(DaysView, _object_spread({}, viewProps));
181
- default:
182
- viewProps.renderDay = _$props.renderDay;
183
- viewProps.timeFormat = _this.getFormat("time");
184
- viewProps.setTime = _this._setTime;
185
- viewProps.value = _this.props.value;
186
- return /* @__PURE__ */ jsx(DaysView, _object_spread({}, viewProps));
187
- }
188
- };
189
- _this._showView = function(view, date) {
190
- var d = (date || _this.state.viewDate).clone();
191
- var nextView = _this.props.onBeforeNavigate(view, _this.state.currentView, d);
192
- if (nextView && _this.state.currentView !== nextView) {
193
- _this.props.onNavigate(nextView);
194
- _this.setState({
195
- currentView: nextView
196
- });
197
- }
198
- };
199
- _this.viewToMethod = {
200
- days: "date",
201
- months: "month",
202
- years: "year"
203
- };
204
- _this.nextView = {
205
- days: "time",
206
- months: "days",
207
- years: "months"
208
- };
209
- _this._updateDate = function(e) {
210
- var state = _this.state;
211
- var currentView = state.currentView;
212
- var updateOnView = _this.getUpdateOn(_this.getFormat("date"));
213
- var viewDate = _this.state.viewDate.clone();
214
- viewDate[_this.viewToMethod[currentView]](parseInt(e.target.getAttribute("data-value"), 10));
215
- if (currentView === "days") {
216
- viewDate.month(parseInt(e.target.getAttribute("data-month"), 10));
217
- viewDate.year(parseInt(e.target.getAttribute("data-year"), 10));
218
- }
219
- var update = {
220
- viewDate: viewDate
221
- };
222
- if (currentView === updateOnView) {
223
- update.selectedDate = viewDate.clone();
224
- update.inputValue = viewDate.format(_this.getFormat("datetime"));
225
- if (_this.props.open === void 0 && _this.props.input && _this.props.closeOnSelect) {
226
- _this._closeCalendar();
227
- }
228
- _this.props.onChange(viewDate.clone());
229
- } else {
230
- _this._showView(_this.nextView[currentView], viewDate);
231
- }
232
- _this.setState(update);
233
- };
234
- _this._viewNavigate = function(modifier, unit) {
235
- var viewDate = _this.state.viewDate.clone();
236
- viewDate.add(modifier, unit);
237
- if (modifier > 0) {
238
- _this.props.onNavigateForward(modifier, unit);
239
- } else {
240
- _this.props.onNavigateBack(-modifier, unit);
241
- }
242
- _this.setState({
243
- viewDate: viewDate
244
- });
245
- };
246
- _this._setTime = function(type, value) {
247
- var date = (_this.getSelectedDate() || _this.state.viewDate).clone();
248
- date[type](value);
249
- if (!_this.props.value) {
250
- _this.setState({
251
- selectedDate: date,
252
- viewDate: date.clone(),
253
- inputValue: date.format(_this.getFormat("datetime"))
254
- });
255
- }
256
- _this.props.onChange(date);
257
- };
258
- _this._reset = function() {
259
- _this.props.onChange(void 0);
260
- };
261
- _this._openCalendar = function() {
262
- if (_this.isOpen()) return;
263
- _this.setState({
264
- open: true
265
- }, _this.props.onOpen);
266
- };
267
- _this._closeCalendar = function() {
268
- if (!_this.isOpen()) return;
269
- _this.setState({
270
- open: false
271
- }, function() {
272
- _this.props.onClose(_this.state.selectedDate || _this.state.inputValue);
273
- });
274
- };
275
- _this._handleClickOutside = function() {
276
- var _$props = _this.props;
277
- if (_$props.input && _this.state.open && _$props.open === void 0 && _$props.closeOnClickOutside) {
278
- _this._closeCalendar();
279
- }
280
- };
281
- _this._onInputFocus = function(e) {
282
- if (!_this.callHandler(_this.props.inputProps.onFocus, e)) return;
283
- _this._openCalendar();
284
- };
285
- _this._onInputChange = function(e) {
286
- if (!_this.callHandler(_this.props.inputProps.onChange, e)) return;
287
- var value = e.target ? e.target.value : e;
288
- var localMoment = _this.localMoment(value, _this.getFormat("datetime"));
289
- var update = {
290
- inputValue: value
291
- };
292
- if (localMoment.isValid()) {
293
- update.selectedDate = localMoment;
294
- update.viewDate = localMoment.clone().startOf("month");
295
- } else {
296
- update.selectedDate = null;
297
- }
298
- _this.setState(update, function() {
299
- _this.props.onChange(localMoment.isValid() ? localMoment : _this.state.inputValue);
300
- });
301
- };
302
- _this._onInputKeyDown = function(e) {
303
- if (!_this.callHandler(_this.props.inputProps.onKeyDown, e)) return;
304
- if (e.which === 9 && _this.props.closeOnTab) {
305
- _this._closeCalendar();
306
- }
307
- };
308
- _this._onInputClick = function(e) {
309
- if (!_this.callHandler(_this.props.inputProps.onClick, e)) return;
310
- _this._openCalendar();
311
- };
312
- _this.state = _this.getInitialState();
313
- return _this;
314
- }
315
- _create_class(Datetime, [
316
- {
317
- key: "render",
318
- value: function render() {
319
- return /* @__PURE__ */ jsxs(ClickableWrapper, {
320
- className: this.getClassName(),
321
- onClickOut: this._handleClickOutside,
322
- children: [
323
- this.renderInput(),
324
- /* @__PURE__ */ jsx("div", {
325
- className: "rdtPicker",
326
- children: this.renderView()
327
- })
328
- ]
329
- });
330
- }
331
- },
332
- {
333
- key: "renderInput",
334
- value: function renderInput() {
335
- if (!this.props.input) return;
336
- var finalInputProps = _object_spread_props(_object_spread({
337
- type: "text",
338
- className: "form-control",
339
- value: this.getInputValue()
340
- }, this.props.inputProps), {
341
- onFocus: this._onInputFocus,
342
- onChange: this._onInputChange,
343
- onKeyDown: this._onInputKeyDown,
344
- onClick: this._onInputClick
345
- });
346
- if (this.props.renderInput) {
347
- return /* @__PURE__ */ jsx("div", {
348
- children: this.props.renderInput(finalInputProps, this._openCalendar, this._closeCalendar)
349
- });
350
- }
351
- return /* @__PURE__ */ jsx("input", _object_spread({}, finalInputProps));
352
- }
353
- },
354
- {
355
- key: "renderView",
356
- value: function renderView() {
357
- return this.props.renderView(this.state.currentView, this._renderCalendar);
358
- }
359
- },
360
- {
361
- key: "getInitialState",
362
- value: function getInitialState() {
363
- var props = this.props;
364
- var inputFormat = this.getFormat("datetime");
365
- var selectedDate = this.parseDate(props.value || props.initialValue, inputFormat);
366
- this.checkTZ();
367
- return {
368
- open: !props.input,
369
- currentView: props.initialViewMode || this.getInitialView(),
370
- viewDate: this.getInitialViewDate(selectedDate),
371
- selectedDate: selectedDate && selectedDate.isValid() ? selectedDate : void 0,
372
- inputValue: this.getInitialInputValue(selectedDate)
373
- };
374
- }
375
- },
376
- {
377
- key: "getInitialViewDate",
378
- value: function getInitialViewDate(selectedDate) {
379
- var propDate = this.props.initialViewDate;
380
- var viewDate;
381
- if (propDate) {
382
- viewDate = this.parseDate(propDate, this.getFormat("datetime"));
383
- if (viewDate && viewDate.isValid()) {
384
- return viewDate;
385
- } else {
386
- console.log('The initialViewDated given "' + propDate + '" is not valid. Using current date instead.');
387
- }
388
- } else if (selectedDate && selectedDate.isValid()) {
389
- return selectedDate.clone();
390
- }
391
- return this.getInitialDate();
392
- }
393
- },
394
- {
395
- key: "getInitialDate",
396
- value: function getInitialDate() {
397
- var m = this.localMoment();
398
- m.hour(0).minute(0).second(0).millisecond(0);
399
- return m;
400
- }
401
- },
402
- {
403
- key: "getInitialView",
404
- value: function getInitialView() {
405
- var dateFormat = this.getFormat("date");
406
- return dateFormat ? this.getUpdateOn(dateFormat) : viewModes.TIME;
407
- }
408
- },
409
- {
410
- key: "parseDate",
411
- value: function parseDate(date, dateFormat) {
412
- var parsedDate;
413
- if (date && typeof date === "string") parsedDate = this.localMoment(date, dateFormat);
414
- else if (date) parsedDate = this.localMoment(date);
415
- if (parsedDate && !parsedDate.isValid()) parsedDate = null;
416
- return parsedDate;
417
- }
418
- },
419
- {
420
- key: "getClassName",
421
- value: function getClassName() {
422
- var cn = "rdt";
423
- var props = this.props;
424
- var propCn = props.className;
425
- if (Array.isArray(propCn)) {
426
- cn += " " + propCn.join(" ");
427
- } else if (propCn) {
428
- cn += " " + propCn;
429
- }
430
- if (!props.input) {
431
- cn += " rdtStatic";
432
- }
433
- if (this.isOpen()) {
434
- cn += " rdtOpen";
435
- }
436
- return cn;
437
- }
438
- },
439
- {
440
- key: "isOpen",
441
- value: function isOpen() {
442
- return !this.props.input || (this.props.open === void 0 ? this.state.open : this.props.open);
443
- }
444
- },
445
- {
446
- key: "getUpdateOn",
447
- value: function getUpdateOn(dateFormat) {
448
- if (this.props.updateOnView) {
449
- return this.props.updateOnView;
450
- }
451
- if (dateFormat.match(/[lLD]/)) {
452
- return viewModes.DAYS;
453
- }
454
- if (dateFormat.indexOf("M") !== -1) {
455
- return viewModes.MONTHS;
456
- }
457
- if (dateFormat.indexOf("Y") !== -1) {
458
- return viewModes.YEARS;
459
- }
460
- return viewModes.DAYS;
461
- }
462
- },
463
- {
464
- key: "getLocaleData",
465
- value: function getLocaleData() {
466
- var p = this.props;
467
- return this.localMoment(p.value || p.defaultValue || /* @__PURE__ */ new Date()).localeData();
468
- }
469
- },
470
- {
471
- key: "getDateFormat",
472
- value: function getDateFormat() {
473
- var locale = this.getLocaleData();
474
- var format = this.props.dateFormat;
475
- if (format === true) return locale.longDateFormat("L");
476
- if (format) return format;
477
- return "";
478
- }
479
- },
480
- {
481
- key: "getTimeFormat",
482
- value: function getTimeFormat() {
483
- var locale = this.getLocaleData();
484
- var format = this.props.timeFormat;
485
- if (format === true) {
486
- return locale.longDateFormat("LT");
487
- }
488
- return format || "";
489
- }
490
- },
491
- {
492
- key: "getFormat",
493
- value: function getFormat(type) {
494
- if (type === "date") {
495
- return this.getDateFormat();
496
- } else if (type === "time") {
497
- return this.getTimeFormat();
498
- }
499
- var dateFormat = this.getDateFormat();
500
- var timeFormat = this.getTimeFormat();
501
- return dateFormat && timeFormat ? dateFormat + " " + timeFormat : dateFormat || timeFormat;
502
- }
503
- },
504
- {
505
- key: "updateTime",
506
- value: function updateTime(op, amount, type, toSelected) {
507
- var update = {};
508
- var date = toSelected ? "selectedDate" : "viewDate";
509
- update[date] = this.state[date].clone()[op](amount, type);
510
- this.setState(update);
511
- }
512
- },
513
- {
514
- key: "localMoment",
515
- value: function localMoment(date, format, props) {
516
- props = props || this.props;
517
- var m = null;
518
- if (props.utc) {
519
- m = moment.utc(date, format, props.strictParsing);
520
- } else if (props.displayTimeZone) {
521
- m = moment.tz(date, format, props.displayTimeZone);
522
- } else {
523
- m = moment(date, format, props.strictParsing);
524
- }
525
- if (props.locale) m.locale(props.locale);
526
- return m;
527
- }
528
- },
529
- {
530
- key: "checkTZ",
531
- value: function checkTZ() {
532
- var displayTimeZone = this.props.displayTimeZone;
533
- if (displayTimeZone && !this.tzWarning && !moment.tz) {
534
- this.tzWarning = true;
535
- }
536
- }
537
- },
538
- {
539
- key: "componentDidUpdate",
540
- value: function componentDidUpdate(prevProps) {
541
- if (prevProps === this.props) return;
542
- var needsUpdate = false;
543
- var thisProps = this.props;
544
- [
545
- "locale",
546
- "utc",
547
- "displayZone",
548
- "dateFormat",
549
- "timeFormat"
550
- ].forEach(function(p) {
551
- prevProps[p] !== thisProps[p] && (needsUpdate = true);
552
- });
553
- if (needsUpdate) {
554
- this.regenerateDates();
555
- }
556
- if (thisProps.value && thisProps.value !== prevProps.value) {
557
- this.setViewDate(thisProps.value);
558
- }
559
- this.checkTZ();
560
- }
561
- },
562
- {
563
- key: "regenerateDates",
564
- value: function regenerateDates() {
565
- var props = this.props;
566
- var viewDate = this.state.viewDate.clone();
567
- var selectedDate = this.state.selectedDate && this.state.selectedDate.clone();
568
- if (props.locale) {
569
- viewDate.locale(props.locale);
570
- selectedDate && selectedDate.locale(props.locale);
571
- }
572
- if (props.utc) {
573
- viewDate.utc();
574
- selectedDate && selectedDate.utc();
575
- } else if (props.displayTimeZone) {
576
- viewDate.tz(props.displayTimeZone);
577
- selectedDate && selectedDate.tz(props.displayTimeZone);
578
- } else {
579
- viewDate.locale();
580
- selectedDate && selectedDate.locale();
581
- }
582
- var update = {
583
- viewDate: viewDate,
584
- selectedDate: selectedDate
585
- };
586
- if (selectedDate && selectedDate.isValid()) {
587
- update.inputValue = selectedDate.format(this.getFormat("datetime"));
588
- }
589
- this.setState(update);
590
- }
591
- },
592
- {
593
- key: "getSelectedDate",
594
- value: function getSelectedDate() {
595
- if (this.props.value === void 0) return this.state.selectedDate;
596
- var selectedDate = this.parseDate(this.props.value, this.getFormat("datetime"));
597
- return selectedDate && selectedDate.isValid() ? selectedDate : false;
598
- }
599
- },
600
- {
601
- key: "getInitialInputValue",
602
- value: function getInitialInputValue(selectedDate) {
603
- var props = this.props;
604
- if (props.inputProps.value) return props.inputProps.value;
605
- if (selectedDate && selectedDate.isValid()) return selectedDate.format(this.getFormat("datetime"));
606
- if (props.value && typeof props.value === "string") return props.value;
607
- if (props.initialValue && typeof props.initialValue === "string") return props.initialValue;
608
- return "";
609
- }
610
- },
611
- {
612
- key: "getInputValue",
613
- value: function getInputValue() {
614
- var selectedDate = this.getSelectedDate();
615
- return selectedDate ? selectedDate.format(this.getFormat("datetime")) : this.state.inputValue;
616
- }
617
- },
618
- {
619
- /**
620
- * Set the date that is currently shown in the calendar.
621
- * This is independent from the selected date and it's the one used to navigate through months or days in the calendar.
622
- * @param dateType date
623
- * @public
624
- */ key: "setViewDate",
625
- value: function setViewDate(date) {
626
- var logError = function logError() {
627
- return console.log("Invalid date passed to the `setViewDate` method: " + date);
628
- };
629
- if (!date) return logError();
630
- var viewDate;
631
- if (typeof date === "string") {
632
- viewDate = this.localMoment(date, this.getFormat("datetime"));
633
- } else {
634
- viewDate = this.localMoment(date);
635
- }
636
- if (!viewDate || !viewDate.isValid()) return logError();
637
- this.setState({
638
- viewDate: viewDate
639
- });
640
- }
641
- },
642
- {
643
- /**
644
- * Set the view currently shown by the calendar. View modes shipped with react-datetime are 'years', 'months', 'days' and 'time'.
645
- * @param TYPES.string mode
646
- */ key: "navigate",
647
- value: function navigate(mode) {
648
- this._showView(mode);
649
- }
650
- },
651
- {
652
- key: "callHandler",
653
- value: function callHandler(method, e) {
654
- if (!method) return true;
655
- return method(e) !== false;
656
- }
657
- }
658
- ]);
659
- return Datetime;
660
- }(React.Component);
661
- Datetime.defaultProps = {
662
- onOpen: nofn,
663
- onClose: nofn,
664
- onCalendarOpen: nofn,
665
- onCalendarClose: nofn,
666
- onChange: nofn,
667
- onNavigate: nofn,
668
- onBeforeNavigate: function onBeforeNavigate(next) {
669
- return next;
670
- },
671
- onNavigateBack: nofn,
672
- onNavigateForward: nofn,
673
- dateFormat: true,
674
- timeFormat: true,
675
- utc: false,
676
- className: "",
677
- input: true,
678
- inputProps: {},
679
- timeConstraints: {},
680
- isValidDate: function isValidDate() {
681
- return true;
682
- },
683
- strictParsing: true,
684
- closeOnSelect: false,
685
- closeOnTab: true,
686
- closeOnClickOutside: true,
687
- renderView: function renderView(_, renderFunc) {
688
- return renderFunc();
689
- }
407
+ var ClickOutBase = class extends React.Component {
408
+ constructor(..._args) {
409
+ super(..._args);
410
+ this.container = React.createRef();
411
+ }
412
+ render() {
413
+ return /* @__PURE__ */ jsx("div", {
414
+ className: this.props.className,
415
+ ref: this.container,
416
+ children: this.props.children
417
+ });
418
+ }
419
+ handleClickOutside(e) {
420
+ this.props.onClickOut(e);
421
+ }
422
+ setClickOutsideRef() {
423
+ return this.container.current;
424
+ }
690
425
  };
691
- // Make moment accessible through the Datetime class
692
- Datetime.moment = moment;
693
- var ClickOutBase = /*#__PURE__*/ function(_React_Component) {
694
- "use strict";
695
- _inherits(ClickOutBase, _React_Component);
696
- function ClickOutBase() {
697
- _class_call_check(this, ClickOutBase);
698
- var _this;
699
- _this = _call_super(this, ClickOutBase, arguments);
700
- _this.container = React.createRef();
701
- return _this;
702
- }
703
- _create_class(ClickOutBase, [
704
- {
705
- key: "render",
706
- value: function render() {
707
- return /* @__PURE__ */ jsx("div", {
708
- className: this.props.className,
709
- ref: this.container,
710
- children: this.props.children
711
- });
712
- }
713
- },
714
- {
715
- key: "handleClickOutside",
716
- value: function handleClickOutside(e) {
717
- this.props.onClickOut(e);
718
- }
719
- },
720
- {
721
- key: "setClickOutsideRef",
722
- value: function setClickOutsideRef() {
723
- return this.container.current;
724
- }
725
- }
726
- ]);
727
- return ClickOutBase;
728
- }(React.Component);
729
- var ClickableWrapper = onClickOutside(ClickOutBase);
426
+ const ClickableWrapper = onClickOutside(ClickOutBase);
427
+ //#endregion
730
428
  export { Datetime as default };