@mailstep/design-system 0.8.27 → 0.8.28

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 (552) 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/assets/mailship.js +4 -0
  172. package/ui/Blocks/LoginPage/components/LoginForm.js +165 -220
  173. package/ui/Blocks/LoginPage/components/SocialLinks.js +78 -98
  174. package/ui/Blocks/LoginPage/index.js +4 -2
  175. package/ui/Blocks/LoginPage/styles.js +74 -94
  176. package/ui/Blocks/LoginPage/types.js +1 -0
  177. package/ui/Blocks/LoginPage/utils/links.js +9 -7
  178. package/ui/Blocks/Modal/Modal.js +122 -148
  179. package/ui/Blocks/Modal/hooks/useClickOutside.js +25 -35
  180. package/ui/Blocks/Modal/hooks/useModal.js +17 -64
  181. package/ui/Blocks/Modal/index.js +5 -3
  182. package/ui/Blocks/Modal/styles.js +181 -255
  183. package/ui/Blocks/Modal/types.js +1 -0
  184. package/ui/Blocks/Modal/utils.js +8 -6
  185. package/ui/Blocks/Popover/index.js +29 -50
  186. package/ui/Blocks/Scheduler/Scheduler.js +40 -104
  187. package/ui/Blocks/Scheduler/components/BookedTimeSlots/index.js +35 -123
  188. package/ui/Blocks/Scheduler/components/BookedTimeSlots/styles.js +34 -53
  189. package/ui/Blocks/Scheduler/components/CurrentTimeMarker/hooks/useCurrentTime.js +14 -61
  190. package/ui/Blocks/Scheduler/components/CurrentTimeMarker/index.js +11 -15
  191. package/ui/Blocks/Scheduler/components/CurrentTimeMarker/styles.js +29 -51
  192. package/ui/Blocks/Scheduler/components/DateChanger/index.js +46 -50
  193. package/ui/Blocks/Scheduler/components/DateChanger/styles.js +22 -35
  194. package/ui/Blocks/Scheduler/components/Groups/index.js +8 -14
  195. package/ui/Blocks/Scheduler/components/Groups/styles.js +31 -53
  196. package/ui/Blocks/Scheduler/components/TimeSlots/hooks/useRangeSelection.js +43 -114
  197. package/ui/Blocks/Scheduler/components/TimeSlots/hooks/useScroll.js +13 -17
  198. package/ui/Blocks/Scheduler/components/TimeSlots/index.js +45 -53
  199. package/ui/Blocks/Scheduler/components/TimeSlots/styles.js +51 -75
  200. package/ui/Blocks/Scheduler/hooks/useChangeDate.js +32 -83
  201. package/ui/Blocks/Scheduler/index.js +1 -1
  202. package/ui/Blocks/Scheduler/styles.js +21 -32
  203. package/ui/Blocks/Scheduler/types.js +1 -0
  204. package/ui/Blocks/Scheduler/utils/constants.js +8 -6
  205. package/ui/Blocks/Scheduler/utils/convertDateToTime.js +4 -4
  206. package/ui/Blocks/Scheduler/utils/convertIndexToISOString.js +9 -7
  207. package/ui/Blocks/Scheduler/utils/convertMinutesToDuration.js +8 -10
  208. package/ui/Blocks/Scheduler/utils/formatDate.js +7 -8
  209. package/ui/Blocks/Scheduler/utils/generateTimeArray.js +17 -15
  210. package/ui/Blocks/Scheduler/utils/getClosestStep.js +10 -8
  211. package/ui/Blocks/Scheduler/utils/getMinutesFromString.js +5 -5
  212. package/ui/Blocks/Scheduler/utils/getMinutesFromTime.js +5 -49
  213. package/ui/Blocks/Scheduler/utils/isActiveTime.js +9 -8
  214. package/ui/Blocks/Scheduler/utils/isToday.js +5 -3
  215. package/ui/Blocks/SideMenu/MenuItem.js +98 -191
  216. package/ui/Blocks/SideMenu/SideMenu.js +35 -80
  217. package/ui/Blocks/SideMenu/components/Footer.js +61 -95
  218. package/ui/Blocks/SideMenu/components/HamburgerMenu.js +49 -68
  219. package/ui/Blocks/SideMenu/components/SubitemTooltip.js +49 -133
  220. package/ui/Blocks/SideMenu/context/LeftMenuContext.js +17 -67
  221. package/ui/Blocks/SideMenu/context/useLeftMenuContext.js +7 -5
  222. package/ui/Blocks/SideMenu/hooks/useOutsideHover.js +23 -76
  223. package/ui/Blocks/SideMenu/index.js +5 -3
  224. package/ui/Blocks/SideMenu/stories/menuItems.js +106 -100
  225. package/ui/Blocks/SideMenu/styles.js +308 -415
  226. package/ui/Blocks/SideMenu/types.js +1 -0
  227. package/ui/Blocks/SideMenu/utils/constants.js +4 -2
  228. package/ui/Blocks/Stepper/Stepper.js +31 -50
  229. package/ui/Blocks/Stepper/components/StepCircle/index.js +14 -13
  230. package/ui/Blocks/Stepper/components/StepCircle/styles.js +22 -47
  231. package/ui/Blocks/Stepper/components/StepItem/index.js +48 -58
  232. package/ui/Blocks/Stepper/components/StepItem/styles.js +77 -86
  233. package/ui/Blocks/Stepper/hooks/useStepper.js +30 -78
  234. package/ui/Blocks/Stepper/index.js +3 -3
  235. package/ui/Blocks/Stepper/styles.js +24 -39
  236. package/ui/Blocks/Stepper/types.js +1 -0
  237. package/ui/Blocks/Table/Table.js +10 -31
  238. package/ui/Blocks/Table/index.js +1 -1
  239. package/ui/Blocks/Table/types.js +1 -0
  240. package/ui/Blocks/Tabs/TabContent.js +7 -8
  241. package/ui/Blocks/Tabs/Tabs.js +42 -53
  242. package/ui/Blocks/Tabs/hooks/useTabs.js +11 -59
  243. package/ui/Blocks/Tabs/index.js +5 -3
  244. package/ui/Blocks/Tabs/styles.js +94 -109
  245. package/ui/Blocks/Tabs/types.js +1 -0
  246. package/ui/Elements/Alert/Alert.js +71 -95
  247. package/ui/Elements/Alert/index.js +3 -1
  248. package/ui/Elements/Alert/styles.js +81 -126
  249. package/ui/Elements/Alert/types.js +1 -0
  250. package/ui/Elements/AsyncSelect/AsyncSelect.js +31 -157
  251. package/ui/Elements/AsyncSelect/index.js +3 -1
  252. package/ui/Elements/Avatar/Avatar.js +35 -150
  253. package/ui/Elements/Avatar/index.js +4 -3
  254. package/ui/Elements/Avatar/types.js +1 -0
  255. package/ui/Elements/Badge/Badge.js +50 -105
  256. package/ui/Elements/Badge/index.js +3 -1
  257. package/ui/Elements/BarChartSymbol/BarChartSymbol.js +19 -22
  258. package/ui/Elements/BarChartSymbol/index.js +1 -1
  259. package/ui/Elements/BarChartSymbol/styles.js +8 -32
  260. package/ui/Elements/BorderedBox/BorderedBox.js +20 -124
  261. package/ui/Elements/BorderedBox/index.js +3 -1
  262. package/ui/Elements/BorderedBox/types.js +1 -0
  263. package/ui/Elements/Button/Button.js +43 -153
  264. package/ui/Elements/Button/index.js +3 -1
  265. package/ui/Elements/Button/styles.js +224 -95
  266. package/ui/Elements/Button/types.js +1 -0
  267. package/ui/Elements/Card/Card.js +13 -13
  268. package/ui/Elements/Card/index.js +3 -1
  269. package/ui/Elements/Card/styles.js +21 -49
  270. package/ui/Elements/Card/types.js +1 -0
  271. package/ui/Elements/CheckedCircle/index.js +12 -11
  272. package/ui/Elements/CheckedCircle/styles.js +14 -29
  273. package/ui/Elements/DatePicker/DatePicker.js +84 -206
  274. package/ui/Elements/DatePicker/Datetime/DateTime.js +422 -724
  275. package/ui/Elements/DatePicker/Datetime/components/DateRepeater.js +62 -126
  276. package/ui/Elements/DatePicker/Datetime/components/FooterRow.js +10 -24
  277. package/ui/Elements/DatePicker/Datetime/components/FooterRowLabel.js +14 -20
  278. package/ui/Elements/DatePicker/Datetime/components/TimeInput.js +15 -21
  279. package/ui/Elements/DatePicker/Datetime/components/Timepicker.js +160 -254
  280. package/ui/Elements/DatePicker/Datetime/components/ViewNavigation.js +28 -84
  281. package/ui/Elements/DatePicker/Datetime/types.js +13 -11
  282. package/ui/Elements/DatePicker/Datetime/views/DaysView.js +134 -334
  283. package/ui/Elements/DatePicker/Datetime/views/MonthsView.js +71 -265
  284. package/ui/Elements/DatePicker/Datetime/views/YearsView.js +81 -276
  285. package/ui/Elements/DatePicker/index.js +5 -3
  286. package/ui/Elements/DatePicker/styles.js +233 -35
  287. package/ui/Elements/DatePicker/utils/constants.js +27 -33
  288. package/ui/Elements/Dropdown/Dropdown.js +53 -88
  289. package/ui/Elements/Dropdown/index.js +3 -1
  290. package/ui/Elements/Dropdown/types.js +1 -0
  291. package/ui/Elements/DropdownMenu/DropdownMenu.js +32 -134
  292. package/ui/Elements/DropdownMenu/components/DefaultItem.js +30 -56
  293. package/ui/Elements/DropdownMenu/components/MenuItem.js +56 -103
  294. package/ui/Elements/DropdownMenu/components/MenuList.js +13 -14
  295. package/ui/Elements/DropdownMenu/index.js +1 -1
  296. package/ui/Elements/DropdownMenu/types.js +1 -0
  297. package/ui/Elements/DropdownSelect/DropdownSelect.js +126 -205
  298. package/ui/Elements/DropdownSelect/index.js +3 -2
  299. package/ui/Elements/ErrorMessage/ErrorMessage.js +62 -56
  300. package/ui/Elements/ErrorMessage/index.js +3 -1
  301. package/ui/Elements/ErrorMessage/types.js +1 -0
  302. package/ui/Elements/HighlightBox/HighlightBox.js +97 -99
  303. package/ui/Elements/HighlightBox/index.js +3 -1
  304. package/ui/Elements/Icon/BadgeIcon.js +26 -121
  305. package/ui/Elements/Icon/Icon.js +182 -255
  306. package/ui/Elements/Icon/icons/Add.js +31 -91
  307. package/ui/Elements/Icon/icons/AddPhoto.js +32 -84
  308. package/ui/Elements/Icon/icons/Admin.js +24 -79
  309. package/ui/Elements/Icon/icons/ArrowDown.js +16 -68
  310. package/ui/Elements/Icon/icons/ArrowForward.js +10 -64
  311. package/ui/Elements/Icon/icons/ArrowUp.js +16 -68
  312. package/ui/Elements/Icon/icons/ArrowUpRightDownLeft.js +19 -77
  313. package/ui/Elements/Icon/icons/ArrowsLeftRight.js +10 -64
  314. package/ui/Elements/Icon/icons/ArrowsUpDown.js +10 -64
  315. package/ui/Elements/Icon/icons/BarcodeScan.js +11 -65
  316. package/ui/Elements/Icon/icons/Box.js +15 -67
  317. package/ui/Elements/Icon/icons/Calendar.js +37 -89
  318. package/ui/Elements/Icon/icons/Cancel.js +16 -68
  319. package/ui/Elements/Icon/icons/CheckedBox.js +21 -76
  320. package/ui/Elements/Icon/icons/CircleHalfStroke.js +10 -64
  321. package/ui/Elements/Icon/icons/Company.js +80 -137
  322. package/ui/Elements/Icon/icons/Complaint.js +57 -114
  323. package/ui/Elements/Icon/icons/Consolidation.js +11 -65
  324. package/ui/Elements/Icon/icons/Container.js +11 -65
  325. package/ui/Elements/Icon/icons/Dashboard.js +34 -86
  326. package/ui/Elements/Icon/icons/Desktop.js +61 -118
  327. package/ui/Elements/Icon/icons/Dispatch.js +11 -65
  328. package/ui/Elements/Icon/icons/EmptyRack.js +32 -32
  329. package/ui/Elements/Icon/icons/Expeditions.js +60 -112
  330. package/ui/Elements/Icon/icons/Filter.js +15 -67
  331. package/ui/Elements/Icon/icons/FlagCZ.js +53 -108
  332. package/ui/Elements/Icon/icons/FlagEL.js +48 -100
  333. package/ui/Elements/Icon/icons/FlagESP.js +91 -143
  334. package/ui/Elements/Icon/icons/FlagHU.js +25 -77
  335. package/ui/Elements/Icon/icons/FlagITA.js +53 -108
  336. package/ui/Elements/Icon/icons/FlagNL.js +25 -77
  337. package/ui/Elements/Icon/icons/FlagRUS.js +53 -108
  338. package/ui/Elements/Icon/icons/FlagSVK.js +90 -145
  339. package/ui/Elements/Icon/icons/FlagUK.js +18 -73
  340. package/ui/Elements/Icon/icons/FlagUSA.js +104 -168
  341. package/ui/Elements/Icon/icons/Foldable.js +32 -84
  342. package/ui/Elements/Icon/icons/Fragile.js +40 -92
  343. package/ui/Elements/Icon/icons/Gift.js +39 -91
  344. package/ui/Elements/Icon/icons/Group.js +15 -67
  345. package/ui/Elements/Icon/icons/HamburgerMenu.js +39 -91
  346. package/ui/Elements/Icon/icons/HelpCircle1.js +30 -82
  347. package/ui/Elements/Icon/icons/HorizontalLines.js +34 -86
  348. package/ui/Elements/Icon/icons/ImagePlaceholder.js +15 -67
  349. package/ui/Elements/Icon/icons/Income.js +20 -75
  350. package/ui/Elements/Icon/icons/Info.js +31 -83
  351. package/ui/Elements/Icon/icons/Integrations.js +15 -67
  352. package/ui/Elements/Icon/icons/Inventory.js +43 -100
  353. package/ui/Elements/Icon/icons/Inventory2.js +64 -121
  354. package/ui/Elements/Icon/icons/Layout.js +41 -91
  355. package/ui/Elements/Icon/icons/Link.js +18 -73
  356. package/ui/Elements/Icon/icons/Liquid.js +20 -75
  357. package/ui/Elements/Icon/icons/Location.js +11 -65
  358. package/ui/Elements/Icon/icons/Logout1.js +30 -82
  359. package/ui/Elements/Icon/icons/MachinePackingForbidden.js +68 -120
  360. package/ui/Elements/Icon/icons/MakePhoto.js +33 -85
  361. package/ui/Elements/Icon/icons/MenuItems.js +37 -91
  362. package/ui/Elements/Icon/icons/Message.js +36 -96
  363. package/ui/Elements/Icon/icons/MobileCancel.js +20 -75
  364. package/ui/Elements/Icon/icons/MobilePhone.js +45 -97
  365. package/ui/Elements/Icon/icons/Moon.js +10 -64
  366. package/ui/Elements/Icon/icons/Notification2.js +23 -78
  367. package/ui/Elements/Icon/icons/OpenBox.js +35 -87
  368. package/ui/Elements/Icon/icons/Pallet.js +34 -93
  369. package/ui/Elements/Icon/icons/Plus1.js +15 -67
  370. package/ui/Elements/Icon/icons/Print.js +39 -91
  371. package/ui/Elements/Icon/icons/Product.js +15 -67
  372. package/ui/Elements/Icon/icons/Products.js +14 -66
  373. package/ui/Elements/Icon/icons/Profile.js +23 -78
  374. package/ui/Elements/Icon/icons/Puzzle1.js +16 -68
  375. package/ui/Elements/Icon/icons/QRCode.js +17 -69
  376. package/ui/Elements/Icon/icons/Rack.js +63 -115
  377. package/ui/Elements/Icon/icons/Reload.js +11 -65
  378. package/ui/Elements/Icon/icons/Return.js +17 -72
  379. package/ui/Elements/Icon/icons/Rows.js +37 -89
  380. package/ui/Elements/Icon/icons/Settings2.js +31 -91
  381. package/ui/Elements/Icon/icons/ShieldUser.js +7 -61
  382. package/ui/Elements/Icon/icons/ShoppingBag.js +16 -67
  383. package/ui/Elements/Icon/icons/Sort.js +21 -76
  384. package/ui/Elements/Icon/icons/Sun.js +10 -64
  385. package/ui/Elements/Icon/icons/ThreeDots.js +37 -89
  386. package/ui/Elements/Icon/icons/ToastError.js +25 -82
  387. package/ui/Elements/Icon/icons/ToastSuccess.js +25 -82
  388. package/ui/Elements/Icon/icons/Transfer.js +19 -74
  389. package/ui/Elements/Icon/icons/TrashBin.js +31 -83
  390. package/ui/Elements/Icon/icons/Truck.js +71 -127
  391. package/ui/Elements/Icon/icons/TwoBoxes.js +18 -73
  392. package/ui/Elements/Icon/icons/TwoCheckedBoxes.js +27 -27
  393. package/ui/Elements/Icon/icons/TwoUsers.js +40 -91
  394. package/ui/Elements/Icon/icons/UserCowboy.js +7 -61
  395. package/ui/Elements/Icon/icons/Valuable.js +32 -83
  396. package/ui/Elements/Icon/icons/Weight.js +10 -64
  397. package/ui/Elements/Icon/icons/index.js +188 -92
  398. package/ui/Elements/Icon/index.js +96 -4
  399. package/ui/Elements/Icon/types.js +1 -0
  400. package/ui/Elements/Image/Image.js +13 -154
  401. package/ui/Elements/Image/index.js +3 -1
  402. package/ui/Elements/Image/types.js +1 -0
  403. package/ui/Elements/Label/Label.js +22 -61
  404. package/ui/Elements/Label/index.js +4 -3
  405. package/ui/Elements/Line/Line.js +20 -44
  406. package/ui/Elements/Line/index.js +3 -1
  407. package/ui/Elements/Line/types.js +1 -0
  408. package/ui/Elements/Link/Link.js +42 -126
  409. package/ui/Elements/Link/index.js +3 -1
  410. package/ui/Elements/Logo/Logo.js +65 -162
  411. package/ui/Elements/Logo/assets/mailship/logo_black.js +4 -0
  412. package/ui/Elements/Logo/assets/mailship/logo_m.js +4 -0
  413. package/ui/Elements/Logo/assets/mailship/logo_white.js +4 -0
  414. package/ui/Elements/Logo/assets/mailship/mailship-logo.js +4 -0
  415. package/ui/Elements/Logo/assets/mailstep/mailstep_black.js +4 -0
  416. package/ui/Elements/Logo/assets/mailstep/mailstep_white.js +4 -0
  417. package/ui/Elements/Logo/assets/mailstock/mailstock.js +4 -0
  418. package/ui/Elements/Logo/assets/mailwise/mailwiseLogo.js +4 -0
  419. package/ui/Elements/Logo/assets/mailwise/mailwiseLogoSmall.js +4 -0
  420. package/ui/Elements/Logo/assets/mailwrap/mailwrapLogo.js +4 -0
  421. package/ui/Elements/Logo/assets/mailwrap/mailwrapLogoSmall.js +4 -0
  422. package/ui/Elements/Logo/assets/warehouse/manager.js +4 -0
  423. package/ui/Elements/Logo/assets/warehouse/manager2.js +4 -0
  424. package/ui/Elements/Logo/assets/warehouse/manager3.js +4 -0
  425. package/ui/Elements/Logo/index.js +3 -1
  426. package/ui/Elements/Logo/types.js +1 -0
  427. package/ui/Elements/Pagination/Pagination.js +61 -85
  428. package/ui/Elements/Pagination/index.js +3 -1
  429. package/ui/Elements/Pagination/styled.js +62 -89
  430. package/ui/Elements/Portal/index.js +20 -68
  431. package/ui/Elements/ProgressBar/ProgressBar.js +15 -19
  432. package/ui/Elements/ProgressBar/index.js +3 -1
  433. package/ui/Elements/ProgressBar/styles.js +69 -114
  434. package/ui/Elements/Select/Select.js +94 -442
  435. package/ui/Elements/Select/components/ChevronOption.js +29 -87
  436. package/ui/Elements/Select/components/ConnectedMenu.js +24 -85
  437. package/ui/Elements/Select/components/CountMultiValue.js +40 -132
  438. package/ui/Elements/Select/components/CustomInput.js +11 -61
  439. package/ui/Elements/Select/components/DropdownIndicator.js +28 -94
  440. package/ui/Elements/Select/components/IconValueContainer.js +27 -139
  441. package/ui/Elements/Select/components/SelectAll.js +87 -164
  442. package/ui/Elements/Select/components/SelectedIndicator.js +7 -23
  443. package/ui/Elements/Select/components/SimplifiedOption.js +15 -23
  444. package/ui/Elements/Select/index.js +3 -1
  445. package/ui/Elements/Select/styles.js +16 -44
  446. package/ui/Elements/Select/themes/index.js +37 -44
  447. package/ui/Elements/Select/themes/selectStyles.js +194 -302
  448. package/ui/Elements/Select/types.js +1 -0
  449. package/ui/Elements/SimpleLink/SimpleLink.js +35 -64
  450. package/ui/Elements/SimpleLink/index.js +5 -3
  451. package/ui/Elements/SingleSelect/SingleSelect.js +145 -509
  452. package/ui/Elements/SingleSelect/index.js +3 -1
  453. package/ui/Elements/SpaceAround/SpaceAround.js +31 -166
  454. package/ui/Elements/SpaceAround/index.js +3 -1
  455. package/ui/Elements/SpaceAround/types.js +1 -0
  456. package/ui/Elements/Spinner/Spinner.js +35 -36
  457. package/ui/Elements/Spinner/index.js +3 -1
  458. package/ui/Elements/Spinner/styles.js +35 -65
  459. package/ui/Elements/Spinner/types.js +1 -0
  460. package/ui/Elements/Table/Table.js +44 -77
  461. package/ui/Elements/Table/index.js +1 -1
  462. package/ui/Elements/Tag/Tag.js +47 -82
  463. package/ui/Elements/Tag/index.js +4 -2
  464. package/ui/Elements/Tag/palettes.js +50 -45
  465. package/ui/Elements/Tag/stories/components/predefinedTags.js +17 -18
  466. package/ui/Elements/Tag/types.js +1 -0
  467. package/ui/Elements/Text/Text.js +9 -75
  468. package/ui/Elements/Text/index.js +1 -1
  469. package/ui/Elements/Text/types.js +1 -0
  470. package/ui/Elements/Toast/Toast.js +33 -55
  471. package/ui/Elements/Toast/constants.js +17 -15
  472. package/ui/Elements/Toast/index.js +3 -1
  473. package/ui/Elements/Toast/styles.js +74 -104
  474. package/ui/Elements/Toggle/Toggle.js +120 -258
  475. package/ui/Elements/Toggle/index.js +3 -1
  476. package/ui/Elements/Toggle/types.js +1 -0
  477. package/ui/Elements/Tooltip/Tooltip.js +49 -119
  478. package/ui/Elements/Tooltip/index.js +3 -1
  479. package/ui/Elements/Typography/Typography.js +73 -158
  480. package/ui/Elements/Typography/index.js +4 -3
  481. package/ui/Forms/Checkbox/Checkbox.js +39 -40
  482. package/ui/Forms/Checkbox/index.js +5 -3
  483. package/ui/Forms/Checkbox/styles.js +92 -74
  484. package/ui/Forms/Checkbox/types.js +1 -0
  485. package/ui/Forms/Input/Input.js +125 -258
  486. package/ui/Forms/Input/index.js +3 -1
  487. package/ui/Forms/Input/styles.js +217 -201
  488. package/ui/Forms/Input/types.js +1 -0
  489. package/ui/Forms/RadioButton/RadioButton.js +22 -101
  490. package/ui/Forms/RadioButton/index.js +3 -1
  491. package/ui/Forms/RadioButton/styles.js +85 -75
  492. package/ui/Forms/RadioButton/types.js +1 -0
  493. package/ui/Forms/TextArea/TextArea.js +33 -153
  494. package/ui/Forms/TextArea/index.js +3 -1
  495. package/ui/Forms/TextArea/styles.js +75 -99
  496. package/ui/System/Fonts/index.js +52 -15
  497. package/ui/ThemeProvider/ThemeProvider.js +15 -18
  498. package/ui/ThemeProvider/index.js +5 -4
  499. package/ui/ThemeProvider/themes/default.js +185 -193
  500. package/ui/ThemeProvider/themes/index.js +10 -9
  501. package/ui/ThemeProvider/themes/light.js +7 -8
  502. package/ui/ThemeProvider/themes/mailwise.js +229 -236
  503. package/ui/ThemeProvider/types.js +1 -0
  504. package/ui/_virtual/_rolldown/runtime.js +13 -0
  505. package/ui/hooks/useToggleAndClose.js +15 -62
  506. package/ui/index.js +179 -94
  507. package/ui/packages/assets/fonts/Inter-Bold_mailstep.js +4 -0
  508. package/ui/packages/assets/fonts/Inter-Light_mailstep.js +4 -0
  509. package/ui/packages/assets/fonts/Inter-Medium_mailstep.js +4 -0
  510. package/ui/packages/assets/fonts/Inter-Regular_mailstep.js +4 -0
  511. package/ui/packages/assets/fonts/Inter-SemiBold_mailstep.js +4 -0
  512. package/ui/utils/CheckDeviceWidth/checkDeviceWidth.js +14 -63
  513. package/ui/utils/CreateRgba/createRgba.js +11 -16
  514. package/ui/utils/CreateRgba/types.js +1 -0
  515. package/ui/utils/KeyPress/KeyPress.js +15 -22
  516. package/ui/utils/KeyPress/index.js +4 -2
  517. package/ui/utils/KeyPress/types.js +1 -0
  518. package/ui/utils/LinguiContainer/index.js +7 -6
  519. package/ui/utils/index.js +7 -5
  520. package/ui/utils/translations.js +334 -333
  521. package/ui/Blocks/CommonGrid/store/store.d.js +0 -0
  522. package/ui/Blocks/CornerDialog/index.d.js +0 -2
  523. package/ui/Blocks/ImageList/index.d.js +0 -2
  524. package/ui/Blocks/LightBox/index.d.js +0 -3
  525. package/ui/Blocks/Modal/index.d.js +0 -3
  526. package/ui/Blocks/Tabs/index.d.js +0 -3
  527. package/ui/Elements/Alert/index.d.js +0 -3
  528. package/ui/Elements/Avatar/index.d.js +0 -2
  529. package/ui/Elements/Badge/index.d.js +0 -2
  530. package/ui/Elements/BorderedBox/index.d.js +0 -3
  531. package/ui/Elements/Button/Button.d.js +0 -2
  532. package/ui/Elements/Button/index.d.js +0 -3
  533. package/ui/Elements/Card/index.d.js +0 -2
  534. package/ui/Elements/ErrorMessage/index.d.js +0 -3
  535. package/ui/Elements/Line/index.d.js +0 -3
  536. package/ui/Elements/Logo/default.d.js +0 -0
  537. package/ui/Elements/Logo/index.d.js +0 -2
  538. package/ui/Elements/Pagination/index.d.js +0 -3
  539. package/ui/Elements/Spinner/index.d.js +0 -2
  540. package/ui/Elements/Tag/index.d.js +0 -3
  541. package/ui/Elements/Text/index.d.js +0 -2
  542. package/ui/Elements/Toast/index.d.js +0 -3
  543. package/ui/Elements/Toggle/index.d.js +0 -2
  544. package/ui/Elements/Tooltip/index.d.js +0 -2
  545. package/ui/Elements/Typography/index.d.js +0 -2
  546. package/ui/Forms/Checkbox/index.d.js +0 -2
  547. package/ui/Forms/Input/index.d.js +0 -3
  548. package/ui/Forms/RadioButton/index.d.js +0 -2
  549. package/ui/System/Fonts/font.d.js +0 -0
  550. package/ui/ThemeProvider/ThemeProvider.d.js +0 -2
  551. package/ui/ThemeProvider/index.d.js +0 -3
  552. 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 };