@hipay/hipay-material-ui 2.3.0-rc.4 → 2.3.0-rc.PSYCHE-2530

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 (359) hide show
  1. package/HiAlertModal/HiAlertModal.js +18 -80
  2. package/HiAlertModal/index.js +1 -1
  3. package/HiAppBar/HiAppBar.js +12 -56
  4. package/HiAppBar/index.js +1 -1
  5. package/HiBadge/HiBadge.js +4 -32
  6. package/HiBadge/index.js +1 -1
  7. package/HiBreadcrumb/HiBreadcrumb.js +15 -46
  8. package/HiBreadcrumb/HiStep.js +17 -72
  9. package/HiBreadcrumb/HiStepConnector.js +18 -57
  10. package/HiBreadcrumb/HiStepContent.js +10 -20
  11. package/HiBreadcrumb/HiStepIcon.js +11 -34
  12. package/HiBreadcrumb/HiStepLabel.js +28 -80
  13. package/HiBreadcrumb/HiStepper.js +12 -28
  14. package/HiBreadcrumb/index.js +1 -1
  15. package/HiButton/HiButton.js +58 -205
  16. package/HiButton/index.js +6 -8
  17. package/HiCell/CellAddress.js +10 -51
  18. package/HiCell/CellDate.js +13 -43
  19. package/HiCell/CellIcon.js +10 -52
  20. package/HiCell/CellImage.js +10 -51
  21. package/HiCell/CellNumeric.js +10 -41
  22. package/HiCell/CellPinToAction.js +6 -25
  23. package/HiCell/CellRate.js +9 -47
  24. package/HiCell/CellSentinel.js +10 -20
  25. package/HiCell/CellSentinelScore.js +10 -16
  26. package/HiCell/CellText.js +12 -34
  27. package/HiCell/CellTextStyled.js +1 -39
  28. package/HiCell/index.js +1 -1
  29. package/HiCheckbox/HiCheckbox.js +16 -64
  30. package/HiCheckbox/index.js +1 -1
  31. package/HiChip/HiChip.js +15 -115
  32. package/HiChip/HiChipSwitch.js +22 -76
  33. package/HiChip/index.js +1 -1
  34. package/HiColoredLabel/HiColoredLabel.js +13 -55
  35. package/HiColoredLabel/index.js +1 -1
  36. package/HiDatePicker/Caption.js +3 -39
  37. package/HiDatePicker/HiDatePicker.js +56 -150
  38. package/HiDatePicker/HiDatePickerMobile.js +11 -32
  39. package/HiDatePicker/HiDateRangePicker.js +71 -226
  40. package/HiDatePicker/HiDateRangeSelector.js +57 -179
  41. package/HiDatePicker/ListPicker.js +13 -44
  42. package/HiDatePicker/NavBar.js +1 -49
  43. package/HiDatePicker/Overlays/CustomOverlayLayout.js +7 -27
  44. package/HiDatePicker/Overlays/CustomOverlayLayoutWithoutFooter.js +7 -27
  45. package/HiDatePicker/Overlays/MonthPickerOverlay.js +15 -46
  46. package/HiDatePicker/Overlays/Overlay.js +5 -47
  47. package/HiDatePicker/Overlays/TimePickerOverlay.js +21 -55
  48. package/HiDatePicker/Overlays/YearPickerOverlay.js +15 -61
  49. package/HiDatePicker/Overlays/index.js +1 -1
  50. package/HiDatePicker/Weekday.js +1 -24
  51. package/HiDatePicker/index.js +15 -0
  52. package/HiDatePicker/stylesheet.js +6 -6
  53. package/HiDotsStepper/HiDot.js +12 -18
  54. package/HiDotsStepper/HiDotsStepper.js +15 -25
  55. package/HiDotsStepper/index.js +23 -0
  56. package/HiExpansionPanel/HiExpansionPanel.js +24 -73
  57. package/HiExpansionPanel/index.js +6 -8
  58. package/HiForm/HiAddressField.js +18 -41
  59. package/HiForm/HiEmailField.js +14 -47
  60. package/HiForm/HiFormControl.js +28 -125
  61. package/HiForm/HiFormLabel.js +15 -59
  62. package/HiForm/HiInput.js +29 -209
  63. package/HiForm/HiPasswordField.js +14 -26
  64. package/HiForm/HiSearchField.js +16 -46
  65. package/HiForm/HiSlider.js +15 -86
  66. package/HiForm/HiTextField.js +17 -156
  67. package/HiForm/HiUpload.js +29 -91
  68. package/HiForm/HiUploadField.js +12 -73
  69. package/HiForm/HiUploadInput.js +33 -113
  70. package/HiForm/index.js +1 -1
  71. package/HiIcon/HiIcon.js +36 -114
  72. package/HiIcon/index.js +1 -1
  73. package/HiIconButton/HiIconButton.js +4 -22
  74. package/HiIconButton/index.js +1 -1
  75. package/HiLoader/HiLoader.js +7 -27
  76. package/HiLoader/index.js +1 -1
  77. package/HiMap/HiMap.js +18 -39
  78. package/HiMap/HiMapExpand.js +15 -43
  79. package/HiMap/index.js +1 -1
  80. package/HiNotice/HiKPI.js +13 -83
  81. package/HiNotice/HiKPINotice.js +1 -29
  82. package/HiNotice/index.js +1 -1
  83. package/HiPaymentMeans/HiPaymentMeans.js +17 -112
  84. package/HiPaymentMeans/index.js +1 -1
  85. package/HiPdfReader/HiPdfReader.js +24 -48
  86. package/HiPdfReader/index.js +1 -1
  87. package/HiPin/HiPin.js +3 -16
  88. package/HiPin/index.js +1 -1
  89. package/HiRadio/HiRadio.js +1 -13
  90. package/HiRadio/index.js +1 -1
  91. package/HiSelect/HiDynamicSelect.js +28 -99
  92. package/HiSelect/HiDynamicSelectField.js +8 -56
  93. package/HiSelect/HiNestedSelect.js +33 -124
  94. package/HiSelect/HiNestedSelectContent.js +31 -109
  95. package/HiSelect/HiNestedSelectField.js +8 -56
  96. package/HiSelect/HiSelect.js +73 -275
  97. package/HiSelect/HiSelectContent.js +51 -176
  98. package/HiSelect/HiSelectField.js +8 -61
  99. package/HiSelect/HiSelectInput.js +29 -130
  100. package/HiSelect/HiSelectMobile.js +23 -54
  101. package/HiSelect/HiSuggestSelect.js +25 -105
  102. package/HiSelect/HiSuggestSelectField.js +8 -56
  103. package/HiSelect/index.js +2 -2
  104. package/HiSelectableList/HiSelectableList.js +24 -122
  105. package/HiSelectableList/HiSelectableListHierarchic.js +18 -78
  106. package/HiSelectableList/HiSelectableListItem.js +22 -161
  107. package/HiSelectableList/index.js +1 -1
  108. package/HiSwitch/HiSwitch.js +4 -40
  109. package/HiSwitch/HiSwitchState.js +2 -58
  110. package/HiSwitch/index.js +1 -1
  111. package/HiTable/HiCellBuilder.js +13 -34
  112. package/HiTable/HiTable.js +12 -66
  113. package/HiTable/HiTableBody.js +6 -34
  114. package/HiTable/HiTableHeader.js +13 -50
  115. package/HiTable/HiTableRow.js +12 -50
  116. package/HiTable/constants.js +2 -2
  117. package/HiTable/index.js +1 -1
  118. package/README.md +11 -38
  119. package/es/HiAlertModal/HiAlertModal.js +211 -220
  120. package/es/HiAlertModal/index.js +15 -1
  121. package/es/HiAppBar/HiAppBar.js +120 -118
  122. package/es/HiAppBar/index.js +15 -1
  123. package/es/HiBadge/HiBadge.js +85 -100
  124. package/es/HiBadge/index.js +15 -1
  125. package/es/HiBreadcrumb/HiBreadcrumb.js +98 -83
  126. package/es/HiBreadcrumb/HiStep.js +113 -113
  127. package/es/HiBreadcrumb/HiStepConnector.js +144 -137
  128. package/es/HiBreadcrumb/HiStepContent.js +90 -58
  129. package/es/HiBreadcrumb/HiStepIcon.js +144 -141
  130. package/es/HiBreadcrumb/HiStepLabel.js +161 -184
  131. package/es/HiBreadcrumb/HiStepper.js +73 -46
  132. package/es/HiBreadcrumb/index.js +15 -1
  133. package/es/HiButton/HiButton.js +77 -217
  134. package/es/HiButton/index.js +13 -1
  135. package/es/HiCell/CellAddress.js +85 -83
  136. package/es/HiCell/CellDate.js +87 -71
  137. package/es/HiCell/CellIcon.js +94 -96
  138. package/es/HiCell/CellImage.js +99 -98
  139. package/es/HiCell/CellNumeric.js +79 -68
  140. package/es/HiCell/CellPinToAction.js +61 -41
  141. package/es/HiCell/CellRate.js +137 -133
  142. package/es/HiCell/CellSentinel.js +75 -46
  143. package/es/HiCell/CellSentinelScore.js +69 -35
  144. package/es/HiCell/CellText.js +190 -160
  145. package/es/HiCell/CellTextStyled.js +37 -59
  146. package/es/HiCell/index.js +79 -9
  147. package/es/HiCheckbox/HiCheckbox.js +154 -162
  148. package/es/HiCheckbox/index.js +15 -1
  149. package/es/HiChip/HiChip.js +172 -245
  150. package/es/HiChip/HiChipSwitch.js +208 -223
  151. package/es/HiChip/index.js +23 -2
  152. package/es/HiColoredLabel/HiColoredLabel.js +157 -185
  153. package/es/HiColoredLabel/index.js +15 -1
  154. package/es/HiDatePicker/Caption.js +46 -61
  155. package/es/HiDatePicker/HiDatePicker.js +283 -323
  156. package/es/HiDatePicker/HiDatePickerMobile.js +104 -87
  157. package/es/HiDatePicker/HiDateRangePicker.js +500 -570
  158. package/es/HiDatePicker/HiDateRangeSelector.js +328 -375
  159. package/es/HiDatePicker/ListPicker.js +125 -101
  160. package/es/HiDatePicker/NavBar.js +94 -112
  161. package/es/HiDatePicker/Overlays/CustomOverlayLayout.js +93 -96
  162. package/es/HiDatePicker/Overlays/CustomOverlayLayoutWithoutFooter.js +86 -89
  163. package/es/HiDatePicker/Overlays/MonthPickerOverlay.js +80 -75
  164. package/es/HiDatePicker/Overlays/Overlay.js +62 -87
  165. package/es/HiDatePicker/Overlays/TimePickerOverlay.js +202 -188
  166. package/es/HiDatePicker/Overlays/YearPickerOverlay.js +90 -95
  167. package/es/HiDatePicker/Overlays/index.js +47 -5
  168. package/es/HiDatePicker/Weekday.js +19 -32
  169. package/es/HiDatePicker/hiLocaleUtils.js +41 -28
  170. package/es/HiDatePicker/index.js +15 -0
  171. package/es/HiDatePicker/stylesheet.js +259 -244
  172. package/es/HiDotsStepper/HiDot.js +86 -50
  173. package/es/HiDotsStepper/HiDotsStepper.js +96 -58
  174. package/es/HiDotsStepper/index.js +23 -0
  175. package/es/HiExpansionPanel/HiExpansionPanel.js +198 -204
  176. package/es/HiExpansionPanel/index.js +13 -1
  177. package/es/HiForm/HiAddressField.js +125 -106
  178. package/es/HiForm/HiEmailField.js +69 -66
  179. package/es/HiForm/HiFormControl.js +266 -309
  180. package/es/HiForm/HiFormLabel.js +110 -112
  181. package/es/HiForm/HiInput.js +397 -530
  182. package/es/HiForm/HiPasswordField.js +101 -67
  183. package/es/HiForm/HiSearchField.js +130 -121
  184. package/es/HiForm/HiSlider.js +251 -272
  185. package/es/HiForm/HiTextField.js +145 -244
  186. package/es/HiForm/HiUpload.js +288 -300
  187. package/es/HiForm/HiUploadField.js +82 -109
  188. package/es/HiForm/HiUploadInput.js +295 -325
  189. package/es/HiForm/index.js +95 -11
  190. package/es/HiIcon/HiIcon.js +75 -132
  191. package/es/HiIcon/index.js +15 -1
  192. package/es/HiIconButton/HiIconButton.js +82 -80
  193. package/es/HiIconButton/index.js +15 -1
  194. package/es/HiLoader/HiLoader.js +30 -37
  195. package/es/HiLoader/index.js +15 -1
  196. package/es/HiMap/HiMap.js +281 -245
  197. package/es/HiMap/HiMapExpand.js +182 -162
  198. package/es/HiMap/index.js +23 -2
  199. package/es/HiNotice/HiKPI.js +173 -201
  200. package/es/HiNotice/HiKPINotice.js +42 -52
  201. package/es/HiNotice/index.js +23 -2
  202. package/es/HiPaymentMeans/HiPaymentMeans.js +453 -500
  203. package/es/HiPaymentMeans/index.js +15 -1
  204. package/es/HiPdfReader/HiPdfReader.js +215 -184
  205. package/es/HiPdfReader/index.js +15 -1
  206. package/es/HiPin/HiPin.js +82 -79
  207. package/es/HiPin/index.js +15 -1
  208. package/es/HiRadio/HiRadio.js +47 -40
  209. package/es/HiRadio/index.js +15 -1
  210. package/es/HiSelect/HiDynamicSelect.js +110 -146
  211. package/es/HiSelect/HiDynamicSelectField.js +91 -104
  212. package/es/HiSelect/HiNestedSelect.js +235 -260
  213. package/es/HiSelect/HiNestedSelectContent.js +186 -197
  214. package/es/HiSelect/HiNestedSelectField.js +91 -104
  215. package/es/HiSelect/HiSelect.js +564 -684
  216. package/es/HiSelect/HiSelectContent.js +283 -338
  217. package/es/HiSelect/HiSelectField.js +93 -111
  218. package/es/HiSelect/HiSelectInput.js +266 -321
  219. package/es/HiSelect/HiSelectMobile.js +118 -100
  220. package/es/HiSelect/HiSuggestSelect.js +237 -256
  221. package/es/HiSelect/HiSuggestSelectField.js +80 -93
  222. package/es/HiSelect/index.js +85 -8
  223. package/es/HiSelectableList/HiSelectableList.js +195 -219
  224. package/es/HiSelectableList/HiSelectableListHierarchic.js +148 -150
  225. package/es/HiSelectableList/HiSelectableListItem.js +378 -475
  226. package/es/HiSelectableList/index.js +31 -3
  227. package/es/HiSwitch/HiSwitch.js +172 -185
  228. package/es/HiSwitch/HiSwitchState.js +134 -171
  229. package/es/HiSwitch/index.js +23 -2
  230. package/es/HiTable/HiCellBuilder.js +106 -72
  231. package/es/HiTable/HiTable.js +92 -105
  232. package/es/HiTable/HiTableBody.js +59 -53
  233. package/es/HiTable/HiTableHeader.js +133 -116
  234. package/es/HiTable/HiTableRow.js +126 -110
  235. package/es/HiTable/constants.js +97 -138
  236. package/es/HiTable/index.js +15 -1
  237. package/es/hi-svg-icons/HiAccount.js +41 -21
  238. package/es/hi-svg-icons/HiActivity.js +40 -20
  239. package/es/hi-svg-icons/HiAll.js +44 -24
  240. package/es/hi-svg-icons/HiBilling.js +41 -21
  241. package/es/hi-svg-icons/HiBriefcaseRescue.js +29 -10
  242. package/es/hi-svg-icons/HiCatalog.js +41 -21
  243. package/es/hi-svg-icons/HiCustomer.js +41 -21
  244. package/es/hi-svg-icons/HiDownload.js +29 -12
  245. package/es/hi-svg-icons/HiFinance.js +41 -21
  246. package/es/hi-svg-icons/HiPermission.js +40 -20
  247. package/es/hi-svg-icons/HiRoute.js +41 -21
  248. package/es/hi-svg-icons/HiSettlement.js +41 -21
  249. package/es/hi-svg-icons/HiSizeLarge.js +28 -15
  250. package/es/hi-svg-icons/HiSizeMedium.js +26 -15
  251. package/es/hi-svg-icons/HiSizeSmall.js +26 -15
  252. package/es/hi-svg-icons/HiTransaction.js +41 -21
  253. package/es/hi-svg-icons/HiUser.js +41 -21
  254. package/es/hi-svg-icons/HiWidget.js +44 -24
  255. package/es/hi-svg-icons/index.js +151 -18
  256. package/es/hi-svg-icons/index.text.js +27 -17
  257. package/es/styleguide/Wrapper.js +51 -0
  258. package/es/styles/MuiThemeProvider.js +131 -111
  259. package/es/styles/colorManipulator.js +89 -52
  260. package/es/styles/createBreakpoints.js +48 -35
  261. package/es/styles/createGenerateClassName.js +34 -22
  262. package/es/styles/createMixins.js +31 -20
  263. package/es/styles/createMuiTheme.js +67 -44
  264. package/es/styles/createPalette.js +135 -102
  265. package/es/styles/createStyles.js +8 -1
  266. package/es/styles/createTypography.js +86 -75
  267. package/es/styles/getStylesCreator.js +31 -18
  268. package/es/styles/getThemeProps.js +11 -5
  269. package/es/styles/index.js +47 -7
  270. package/es/styles/jssPreset.js +25 -9
  271. package/es/styles/mergeClasses.js +28 -16
  272. package/es/styles/shadows.js +14 -7
  273. package/es/styles/shape.js +9 -2
  274. package/es/styles/spacing.js +13 -2
  275. package/es/styles/themeListener.js +22 -10
  276. package/es/styles/transitions.js +61 -31
  277. package/es/styles/zIndex.js +9 -2
  278. package/es/test-utils/createMount.js +31 -18
  279. package/es/test-utils/createRender.js +25 -12
  280. package/es/test-utils/createShallow.js +34 -19
  281. package/es/test-utils/getClasses.js +11 -2
  282. package/es/test-utils/index.js +47 -5
  283. package/es/test-utils/until.js +25 -12
  284. package/es/test-utils/unwrap.js +8 -1
  285. package/es/theme/palette.js +106 -0
  286. package/es/theme/typography.js +170 -0
  287. package/es/theme.js +22 -0
  288. package/es/transitions/utils.js +18 -6
  289. package/es/utils/helpers.js +99 -39
  290. package/es/withMobileDialog/index.js +15 -1
  291. package/es/withMobileDialog/withMobileDialog.js +32 -20
  292. package/hi-svg-icons/HiAccount.js +16 -10
  293. package/hi-svg-icons/HiActivity.js +16 -10
  294. package/hi-svg-icons/HiAll.js +16 -10
  295. package/hi-svg-icons/HiBilling.js +16 -10
  296. package/hi-svg-icons/HiBriefcaseRescue.js +15 -9
  297. package/hi-svg-icons/HiCatalog.js +16 -10
  298. package/hi-svg-icons/HiCustomer.js +16 -10
  299. package/hi-svg-icons/HiDownload.js +13 -5
  300. package/hi-svg-icons/HiFinance.js +16 -10
  301. package/hi-svg-icons/HiPermission.js +16 -10
  302. package/hi-svg-icons/HiRoute.js +16 -10
  303. package/hi-svg-icons/HiSettlement.js +16 -10
  304. package/hi-svg-icons/HiSizeLarge.js +5 -3
  305. package/hi-svg-icons/HiSizeMedium.js +3 -3
  306. package/hi-svg-icons/HiSizeSmall.js +3 -3
  307. package/hi-svg-icons/HiTransaction.js +16 -10
  308. package/hi-svg-icons/HiUser.js +16 -10
  309. package/hi-svg-icons/HiWidget.js +16 -10
  310. package/hi-svg-icons/index.js +1 -1
  311. package/hi-svg-icons/index.text.js +1 -1
  312. package/package.json +37 -57
  313. package/styleguide/Wrapper.js +51 -0
  314. package/styles/MuiThemeProvider.js +17 -44
  315. package/styles/colorManipulator.js +1 -1
  316. package/styles/createBreakpoints.js +4 -4
  317. package/styles/createGenerateClassName.js +1 -1
  318. package/styles/createMixins.js +6 -6
  319. package/styles/createMuiTheme.js +4 -4
  320. package/styles/createPalette.js +5 -5
  321. package/styles/createTypography.js +15 -15
  322. package/styles/getStylesCreator.js +4 -4
  323. package/styles/index.js +2 -18
  324. package/styles/jssPreset.js +1 -1
  325. package/styles/mergeClasses.js +3 -3
  326. package/styles/themeListener.js +2 -2
  327. package/styles/transitions.js +2 -2
  328. package/test-utils/createMount.js +5 -5
  329. package/test-utils/createRender.js +4 -4
  330. package/test-utils/createShallow.js +5 -5
  331. package/test-utils/index.js +1 -1
  332. package/test-utils/until.js +5 -5
  333. package/theme/palette.js +106 -0
  334. package/theme/typography.js +170 -0
  335. package/theme.js +22 -0
  336. package/utils/helpers.js +4 -4
  337. package/withMobileDialog/index.js +1 -1
  338. package/withMobileDialog/withMobileDialog.js +3 -8
  339. package/CHANGELOG.md +0 -8486
  340. package/LICENSE +0 -21
  341. package/es/index.js +0 -26
  342. package/es/styles/withStyles.js +0 -317
  343. package/es/styles/withTheme.js +0 -84
  344. package/es/utils/exactProp.js +0 -28
  345. package/es/utils/ownerDocument.js +0 -5
  346. package/es/utils/ownerWindow.js +0 -8
  347. package/es/utils/reactHelpers.js +0 -19
  348. package/es/utils/requirePropFactory.js +0 -20
  349. package/es/utils/unsupportedProp.js +0 -16
  350. package/index.es.js +0 -31
  351. package/index.js +0 -256
  352. package/styles/withStyles.js +0 -378
  353. package/styles/withTheme.js +0 -126
  354. package/utils/exactProp.js +0 -43
  355. package/utils/ownerDocument.js +0 -13
  356. package/utils/ownerWindow.js +0 -19
  357. package/utils/reactHelpers.js +0 -36
  358. package/utils/requirePropFactory.js +0 -32
  359. package/utils/unsupportedProp.js +0 -24
@@ -1,111 +1,161 @@
1
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
- import _objectSpread from "@babel/runtime/helpers/objectSpread";
3
- import _extends from "@babel/runtime/helpers/extends";
4
- import React from 'react';
5
- import PropTypes from 'prop-types';
6
- import moment from 'moment-timezone';
7
- import MomentLocaleUtils from 'react-day-picker/moment';
8
- import HiLocaleUtils from './hiLocaleUtils';
9
- import DayPickerInput from 'react-day-picker/DayPickerInput';
10
- import classNames from 'classnames';
11
- import { withStyles } from '@material-ui/core/styles';
12
- import Caption from './Caption';
13
- import Overlay from './Overlays/Overlay';
14
- import TimePickerOverlay from './Overlays/TimePickerOverlay';
15
- import MonthPickerOverlay from './Overlays/MonthPickerOverlay';
16
- import YearPickerOverlay from './Overlays/YearPickerOverlay';
17
- import NavBar from './NavBar';
18
- import Weekday from './Weekday';
19
- import { HiTextField } from '../HiForm';
20
- import styles from './stylesheet';
21
- import HiFormControl from '../HiForm/HiFormControl';
22
- import { isMobile } from 'react-device-detect';
23
- import HiDatePickerMobile from './HiDatePickerMobile';
24
-
25
- class HiDateRangePicker extends React.Component {
26
- constructor(props) {
27
- super(props);
28
-
29
- this.handleDayChange = (name, day) => {
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("/home/mfazio/dev/projects/hipay-material-ui/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _objectWithoutProperties2 = _interopRequireDefault(require("/home/mfazio/dev/projects/hipay-material-ui/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties"));
11
+
12
+ var _objectSpread2 = _interopRequireDefault(require("/home/mfazio/dev/projects/hipay-material-ui/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/objectSpread2"));
13
+
14
+ var _extends2 = _interopRequireDefault(require("/home/mfazio/dev/projects/hipay-material-ui/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/extends"));
15
+
16
+ var _classCallCheck2 = _interopRequireDefault(require("/home/mfazio/dev/projects/hipay-material-ui/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/classCallCheck"));
17
+
18
+ var _createClass2 = _interopRequireDefault(require("/home/mfazio/dev/projects/hipay-material-ui/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/createClass"));
19
+
20
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("/home/mfazio/dev/projects/hipay-material-ui/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn"));
21
+
22
+ var _getPrototypeOf2 = _interopRequireDefault(require("/home/mfazio/dev/projects/hipay-material-ui/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/getPrototypeOf"));
23
+
24
+ var _assertThisInitialized2 = _interopRequireDefault(require("/home/mfazio/dev/projects/hipay-material-ui/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/assertThisInitialized"));
25
+
26
+ var _inherits2 = _interopRequireDefault(require("/home/mfazio/dev/projects/hipay-material-ui/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/inherits"));
27
+
28
+ var _defineProperty2 = _interopRequireDefault(require("/home/mfazio/dev/projects/hipay-material-ui/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/defineProperty"));
29
+
30
+ var _react = _interopRequireDefault(require("react"));
31
+
32
+ var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
33
+
34
+ var _moment = _interopRequireDefault(require("react-day-picker/moment"));
35
+
36
+ var _hiLocaleUtils = _interopRequireDefault(require("./hiLocaleUtils"));
37
+
38
+ var _DayPickerInput = _interopRequireDefault(require("react-day-picker/DayPickerInput"));
39
+
40
+ var _classnames = _interopRequireDefault(require("classnames"));
41
+
42
+ var _styles = require("@material-ui/core/styles");
43
+
44
+ var _Caption = _interopRequireDefault(require("./Caption"));
45
+
46
+ var _Overlay = _interopRequireDefault(require("./Overlays/Overlay"));
47
+
48
+ var _TimePickerOverlay = _interopRequireDefault(require("./Overlays/TimePickerOverlay"));
49
+
50
+ var _MonthPickerOverlay = _interopRequireDefault(require("./Overlays/MonthPickerOverlay"));
51
+
52
+ var _YearPickerOverlay = _interopRequireDefault(require("./Overlays/YearPickerOverlay"));
53
+
54
+ var _NavBar = _interopRequireDefault(require("./NavBar"));
55
+
56
+ var _Weekday = _interopRequireDefault(require("./Weekday"));
57
+
58
+ var _HiForm = require("../HiForm");
59
+
60
+ var _stylesheet = _interopRequireDefault(require("./stylesheet"));
61
+
62
+ var _HiFormControl = _interopRequireDefault(require("../HiForm/HiFormControl"));
63
+
64
+ var _reactDeviceDetect = require("react-device-detect");
65
+
66
+ var _HiDatePickerMobile = _interopRequireDefault(require("./HiDatePickerMobile"));
67
+
68
+ var HiDateRangePicker =
69
+ /*#__PURE__*/
70
+ function (_React$Component) {
71
+ (0, _inherits2.default)(HiDateRangePicker, _React$Component);
72
+
73
+ function HiDateRangePicker(props) {
74
+ var _this;
75
+
76
+ (0, _classCallCheck2.default)(this, HiDateRangePicker);
77
+ _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(HiDateRangePicker).call(this, props));
78
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleDayChange", function (name, day) {
30
79
  if (day) {
31
80
  // if time disabled, focus TO input
32
81
  // else focus current input
33
- if (!this.props.enableTime) {
82
+ if (!_this.props.enableTime) {
34
83
  if (day instanceof Date) {
35
- if (name === 'from' && this.toInput) {
36
- this.toInput.getInput().focus();
84
+ if (name === 'from' && _this.toInput) {
85
+ _this.toInput.getInput().focus();
37
86
  }
38
87
  }
39
88
  } else {
40
- this.timeout = setTimeout(() => {
41
- if (this[`${name}Input`].getInput()) {
42
- this[`${name}Input`].getInput().focus();
89
+ _this.timeout = setTimeout(function () {
90
+ if (_this["".concat(name, "Input")].getInput()) {
91
+ _this["".concat(name, "Input")].getInput().focus();
43
92
  }
44
93
  }, 10);
45
94
  }
46
95
 
47
- if (this.props.onChange) {
48
- this.handleChange(name, day);
96
+ if (_this.props.onChange) {
97
+ _this.handleChange(name, day);
49
98
  }
50
99
 
51
- if (this.props.enableTime) {
52
- this.openPanel('time');
100
+ if (_this.props.enableTime) {
101
+ _this.openPanel('time');
53
102
  }
54
103
  }
55
- };
56
-
57
- this.handleInputChange = inputName => event => {
58
- this.handleChange(inputName, event.target.value);
59
- };
60
-
61
- this.onDayToClick = day => {
62
- let change = moment(day) >= moment(this.props.from);
63
- const today = moment().tz(this.props.timezoneName);
64
- const todayDate = new Date(today.year(), today.month(), today.date(), 23, 59, 59);
104
+ });
105
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleInputChange", function (inputName) {
106
+ return function (event) {
107
+ _this.handleChange(inputName, event.target.value);
108
+ };
109
+ });
110
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onDayToClick", function (day) {
111
+ var change = (0, _momentTimezone.default)(day) >= (0, _momentTimezone.default)(_this.props.from);
112
+ var today = (0, _momentTimezone.default)().tz(_this.props.timezoneName);
113
+ var todayDate = new Date(today.year(), today.month(), today.date(), 23, 59, 59);
65
114
 
66
115
  if (change && day > todayDate) {
67
116
  change = false;
68
117
  }
69
118
 
70
119
  if (change) {
71
- this.handleDayChange('to', day);
120
+ _this.handleDayChange('to', day);
121
+
72
122
  document.activeElement.blur();
73
123
  }
74
- };
75
-
76
- this.handleTimeChange = (name, date, precision) => {
77
- this.handleChange(name, date);
124
+ });
125
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleTimeChange", function (name, date, precision) {
126
+ _this.handleChange(name, date);
78
127
 
79
128
  if (name === 'from' && precision === 'minute') {
80
- this.fromInput.hideDayPicker();
81
- this.toInput.getInput().focus();
82
- this.toInput.showDayPicker();
83
- this.openPanel('calendar');
129
+ _this.fromInput.hideDayPicker();
130
+
131
+ _this.toInput.getInput().focus();
132
+
133
+ _this.toInput.showDayPicker();
134
+
135
+ _this.openPanel('calendar');
84
136
  } else if (name === 'to' && precision === 'minute') {
85
- this.toInput.hideDayPicker();
137
+ _this.toInput.hideDayPicker();
138
+
86
139
  document.activeElement.blur();
87
140
  }
88
- };
89
-
90
- this.handleChange = (name, day) => {
91
- const {
92
- translations,
93
- timezoneName
94
- } = this.props;
95
- let date;
96
- let error;
97
- const today = moment().tz(timezoneName);
98
- const now = new Date(today.year(), today.month(), today.date(), 23, 59, 59);
99
- const {
100
- minimumDate,
101
- disableFutureDays,
102
- format
103
- } = this.props;
141
+ });
142
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleChange", function (name, day) {
143
+ var _this$props = _this.props,
144
+ translations = _this$props.translations,
145
+ timezoneName = _this$props.timezoneName;
146
+ var date;
147
+ var error;
148
+ var today = (0, _momentTimezone.default)().tz(timezoneName);
149
+ var now = new Date(today.year(), today.month(), today.date(), 23, 59, 59);
150
+ var _this$props2 = _this.props,
151
+ minimumDate = _this$props2.minimumDate,
152
+ disableFutureDays = _this$props2.disableFutureDays,
153
+ format = _this$props2.format;
104
154
 
105
155
  if (day instanceof Date) {
106
156
  date = day;
107
157
  } else if (day) {
108
- const parsedValue = moment(day, this.props.format, true);
158
+ var parsedValue = (0, _momentTimezone.default)(day, _this.props.format, true);
109
159
 
110
160
  if (parsedValue.isValid()) {
111
161
  date = parsedValue.toDate();
@@ -115,17 +165,17 @@ class HiDateRangePicker extends React.Component {
115
165
  }
116
166
 
117
167
  if (date) {
118
- const comparativeDate = name === 'to' ? moment(this.props.from) : moment(this.props.to);
168
+ var comparativeDate = name === 'to' ? (0, _momentTimezone.default)(_this.props.from) : (0, _momentTimezone.default)(_this.props.to);
119
169
 
120
- if (name === 'to' && comparativeDate > moment(date) || name === 'from' && comparativeDate < moment(date)) {
170
+ if (name === 'to' && comparativeDate > (0, _momentTimezone.default)(date) || name === 'from' && comparativeDate < (0, _momentTimezone.default)(date)) {
121
171
  error = translations.to_superior_from;
122
- } else if (moment(date).utc() < moment(minimumDate).utc().startOf('day')) {
123
- error = translations.date_inferior_min_date.replace('%s', moment(minimumDate).format(format));
172
+ } else if ((0, _momentTimezone.default)(date).utc() < (0, _momentTimezone.default)(minimumDate).utc().startOf('day')) {
173
+ error = translations.date_inferior_min_date.replace('%s', (0, _momentTimezone.default)(minimumDate).format(format));
124
174
  } else if (disableFutureDays && date > now) {
125
- error = translations.date_superior_max_date.replace('%s', moment().tz(timezoneName).format(format));
175
+ error = translations.date_superior_max_date.replace('%s', (0, _momentTimezone.default)().tz(timezoneName).format(format));
126
176
  }
127
177
 
128
- if (!this.props.enableTime) {
178
+ if (!_this.props.enableTime) {
129
179
  if (name === 'from') {
130
180
  date.setHours(0, 0);
131
181
  } else {
@@ -134,415 +184,429 @@ class HiDateRangePicker extends React.Component {
134
184
  }
135
185
  }
136
186
 
137
- this.props.onChange(name, date);
138
- this.props.onChange(`${name}Error`, error);
139
- };
140
-
141
- this.handleChangeMobile = inputName => event => {
142
- let date;
187
+ _this.props.onChange(name, date);
143
188
 
144
- if (event.target.value) {
145
- date = new Date(event.target.value);
146
- }
189
+ _this.props.onChange("".concat(name, "Error"), error);
190
+ });
191
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleChangeMobile", function (inputName) {
192
+ return function (event) {
193
+ var date;
147
194
 
148
- this.props.onChange(inputName, date);
149
- };
195
+ if (event.target.value) {
196
+ date = new Date(event.target.value);
197
+ }
150
198
 
151
- this.handleCurrentMonthChange = day => {
152
- this.setState({
199
+ _this.props.onChange(inputName, date);
200
+ };
201
+ });
202
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleCurrentMonthChange", function (day) {
203
+ _this.setState({
153
204
  currentMonth: day,
154
205
  openedPanel: 'calendar'
155
206
  });
156
- };
157
-
158
- this.handleDayPickerFocus = name => {
159
- this.setState({
207
+ });
208
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleDayPickerFocus", function (name) {
209
+ _this.setState({
160
210
  focusedInput: name
161
211
  });
162
- };
163
-
164
- this.handleDayPickerBlur = name => {
165
- this.setState({
212
+ });
213
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleDayPickerBlur", function (name) {
214
+ _this.setState({
166
215
  focusedInput: ''
167
216
  });
168
217
 
169
- if (this.props.onBlur) {
170
- this.props.onBlur(name);
218
+ if (_this.props.onBlur) {
219
+ _this.props.onBlur(name);
171
220
  }
172
221
 
173
- this.timeout = setTimeout(() => {
174
- if (!['from', 'to'].includes(this.state.focusedInput)) {
175
- this.setState({
222
+ _this.timeout = setTimeout(function () {
223
+ if (!['from', 'to'].includes(_this.state.focusedInput)) {
224
+ _this.setState({
176
225
  openedPanel: 'calendar'
177
226
  });
178
227
  }
179
228
  }, 100);
180
- };
229
+ });
230
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleReset", function (name) {
231
+ _this.handleChange(name, undefined);
232
+ });
233
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleKeyDown", function (name) {
234
+ return function (event) {
235
+ if (event.key === 'Tab' && !event.shiftKey) {
236
+ var nodeName = document.activeElement.nodeName;
181
237
 
182
- this.handleReset = name => {
183
- this.handleChange(name, undefined);
184
- };
238
+ if (_this.props[name] && nodeName === 'INPUT' && document.activeElement.nextSibling.children.length > 0) {
239
+ document.activeElement.nextSibling.focus();
240
+ } else if (name === 'from') {
241
+ _this.handleDayPickerBlur('from');
185
242
 
186
- this.handleKeyDown = name => event => {
187
- if (event.key === 'Tab' && !event.shiftKey) {
188
- const nodeName = document.activeElement.nodeName;
189
-
190
- if (this.props[name] && nodeName === 'INPUT' && document.activeElement.nextSibling.children.length > 0) {
191
- document.activeElement.nextSibling.focus();
192
- } else if (name === 'from') {
193
- this.handleDayPickerBlur('from');
194
- this.handleDayPickerFocus('to');
195
- this.toInput.handleInputFocus();
196
- setTimeout(() => {
197
- document.getElementById(`${this.props.id}-to`).focus();
198
- }, 1);
199
- } else if (name === 'to') {
200
- this.handleDayPickerBlur('to');
201
- this.toInput.handleInputBlur(event);
202
- setTimeout(() => {
203
- document.activeElement.blur();
204
- }, 1);
205
- }
206
- } else if (event.key === 'Escape' && !event.shiftKey) {
207
- if (name === 'from') {
208
- this.fromInput.hideDayPicker();
209
- } else if (name === 'to') {
210
- this.toInput.hideDayPicker();
211
- }
243
+ _this.handleDayPickerFocus('to');
212
244
 
213
- event.stopPropagation();
214
- }
215
- };
245
+ _this.toInput.handleInputFocus();
246
+
247
+ setTimeout(function () {
248
+ document.getElementById("".concat(_this.props.id, "-to")).focus();
249
+ }, 1);
250
+ } else if (name === 'to') {
251
+ _this.handleDayPickerBlur('to');
216
252
 
217
- this.openPanel = panel => {
218
- this.setState({
253
+ _this.toInput.handleInputBlur(event);
254
+
255
+ setTimeout(function () {
256
+ document.activeElement.blur();
257
+ }, 1);
258
+ }
259
+ } else if (event.key === 'Escape' && !event.shiftKey) {
260
+ if (name === 'from') {
261
+ _this.fromInput.hideDayPicker();
262
+ } else if (name === 'to') {
263
+ _this.toInput.hideDayPicker();
264
+ }
265
+
266
+ event.stopPropagation();
267
+ }
268
+ };
269
+ });
270
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "openPanel", function (panel) {
271
+ _this.setState({
219
272
  openedPanel: panel
220
273
  });
221
- };
222
-
223
- this.renderCaption = propsCaption => {
224
- return React.createElement(Caption, _extends({
225
- onMonthClick: () => this.openPanel('months'),
226
- onYearClick: () => this.openPanel('years')
274
+ });
275
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderCaption", function (propsCaption) {
276
+ return _react.default.createElement(_Caption.default, (0, _extends2.default)({
277
+ onMonthClick: function onMonthClick() {
278
+ return _this.openPanel('months');
279
+ },
280
+ onYearClick: function onYearClick() {
281
+ return _this.openPanel('years');
282
+ }
227
283
  }, propsCaption));
228
- };
229
-
230
- this.renderNavBar = propsNavBar => {
231
- return React.createElement(NavBar, _extends({
232
- showClockButton: this.props.enableTime,
233
- onClockClick: () => this.openPanel('time')
284
+ });
285
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderNavBar", function (propsNavBar) {
286
+ return _react.default.createElement(_NavBar.default, (0, _extends2.default)({
287
+ showClockButton: _this.props.enableTime,
288
+ onClockClick: function onClockClick() {
289
+ return _this.openPanel('time');
290
+ }
234
291
  }, propsNavBar));
235
- };
236
-
237
- this.renderOverlay = (name, propsOverlay, staticPosition) => {
238
- const rangeOverlayProps = _objectSpread({}, propsOverlay, {
292
+ });
293
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderOverlay", function (name, propsOverlay, staticPosition) {
294
+ var rangeOverlayProps = (0, _objectSpread2.default)({}, propsOverlay, {
239
295
  side: name,
240
- staticPosition
296
+ staticPosition: staticPosition
241
297
  });
242
298
 
243
- switch (this.state.openedPanel) {
299
+ switch (_this.state.openedPanel) {
244
300
  case 'time':
245
- return this.renderTimePickerOverlay(name, rangeOverlayProps);
301
+ return _this.renderTimePickerOverlay(name, rangeOverlayProps);
246
302
 
247
303
  case 'months':
248
- return this.renderMonthPickerOverlay(name, rangeOverlayProps);
304
+ return _this.renderMonthPickerOverlay(name, rangeOverlayProps);
249
305
 
250
306
  case 'years':
251
- return this.renderYearPickerOverlay(name, rangeOverlayProps);
307
+ return _this.renderYearPickerOverlay(name, rangeOverlayProps);
252
308
 
253
309
  case 'calendar':
254
310
  default:
255
- return React.createElement(Overlay, rangeOverlayProps);
311
+ return _react.default.createElement(_Overlay.default, rangeOverlayProps);
256
312
  }
257
- };
258
-
259
- this.renderOverlayFrom = propsOverlay => {
260
- return this.renderOverlay('from', propsOverlay, this.props.staticPosition);
261
- };
262
-
263
- this.renderOverlayTo = propsOverlay => {
264
- return this.renderOverlay('to', propsOverlay, this.props.staticPosition);
265
- };
266
-
267
- this.renderMonthPickerOverlay = (name, propsOverlay) => {
268
- const monthPickerProps = {
269
- value: this.state.currentMonth,
270
- onChange: this.handleCurrentMonthChange
313
+ });
314
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderOverlayFrom", function (propsOverlay) {
315
+ return _this.renderOverlay('from', propsOverlay, _this.props.staticPosition);
316
+ });
317
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderOverlayTo", function (propsOverlay) {
318
+ return _this.renderOverlay('to', propsOverlay, _this.props.staticPosition);
319
+ });
320
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderMonthPickerOverlay", function (name, propsOverlay) {
321
+ var monthPickerProps = {
322
+ value: _this.state.currentMonth,
323
+ onChange: _this.handleCurrentMonthChange
271
324
  };
272
- return React.createElement(MonthPickerOverlay, _extends({
273
- key: `${name}-month-picker-overlay`
325
+ return _react.default.createElement(_MonthPickerOverlay.default, (0, _extends2.default)({
326
+ key: "".concat(name, "-month-picker-overlay")
274
327
  }, monthPickerProps, propsOverlay));
275
- };
276
-
277
- this.renderTimePickerOverlay = (name, propsOverlay) => {
278
- const timePickerProps = {
279
- value: this.props[name],
280
- onChange: (date, precision) => this.handleTimeChange(name, date, precision),
281
- onCalendarClick: () => this.openPanel('calendar')
328
+ });
329
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderTimePickerOverlay", function (name, propsOverlay) {
330
+ var timePickerProps = {
331
+ value: _this.props[name],
332
+ onChange: function onChange(date, precision) {
333
+ return _this.handleTimeChange(name, date, precision);
334
+ },
335
+ onCalendarClick: function onCalendarClick() {
336
+ return _this.openPanel('calendar');
337
+ }
282
338
  };
283
- return React.createElement(TimePickerOverlay, _extends({
284
- key: `${name}-time-picker-overlay`
339
+ return _react.default.createElement(_TimePickerOverlay.default, (0, _extends2.default)({
340
+ key: "".concat(name, "-time-picker-overlay")
285
341
  }, timePickerProps, propsOverlay));
286
- };
287
-
288
- this.renderYearPickerOverlay = (name, propsOverlay) => {
289
- const yearPickerProps = {
290
- value: this.state.currentMonth,
291
- onChange: this.handleCurrentMonthChange,
292
- disableFutureDays: this.props.disableFutureDays
342
+ });
343
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderYearPickerOverlay", function (name, propsOverlay) {
344
+ var yearPickerProps = {
345
+ value: _this.state.currentMonth,
346
+ onChange: _this.handleCurrentMonthChange,
347
+ disableFutureDays: _this.props.disableFutureDays
293
348
  };
294
- return React.createElement(YearPickerOverlay, _extends({
295
- key: `${name}-year-picker-overlay`
349
+ return _react.default.createElement(_YearPickerOverlay.default, (0, _extends2.default)({
350
+ key: "".concat(name, "-year-picker-overlay")
296
351
  }, yearPickerProps, propsOverlay));
297
- };
352
+ });
298
353
 
299
- const _today = moment().tz(this.props.timezoneName);
354
+ var _today = (0, _momentTimezone.default)().tz(_this.props.timezoneName);
300
355
 
301
- this.state = {
356
+ _this.state = {
302
357
  currentMonth: new Date(_today.year(), _today.month(), _today.date()),
303
358
  focusedInput: '',
304
359
  openedPanel: 'calendar'
305
360
  };
361
+ return _this;
306
362
  }
307
363
 
308
- componentWillUnmount() {
309
- clearTimeout(this.timeout);
310
- }
311
-
312
- render() {
313
- const _this$props = this.props,
314
- {
315
- classes,
316
- disabled,
317
- disabledDays,
318
- disableFutureDays,
319
- enableTime,
320
- labelFrom,
321
- labelTo,
322
- locale,
323
- format,
324
- from,
325
- fromError,
326
- minimumDate,
327
- onReset,
328
- to,
329
- toError,
330
- translations,
331
- id,
332
- staticPosition,
333
- errorText,
334
- hasSelector,
335
- helperIcon,
336
- helperText,
337
- timezoneName
338
- } = _this$props,
339
- props = _objectWithoutProperties(_this$props, ["classes", "disabled", "disabledDays", "disableFutureDays", "enableTime", "labelFrom", "labelTo", "locale", "format", "from", "fromError", "minimumDate", "onReset", "to", "toError", "translations", "id", "staticPosition", "errorText", "hasSelector", "helperIcon", "helperText", "timezoneName"]);
340
-
341
- const today = moment().tz(timezoneName);
342
- const now = new Date(today.year(), today.month(), today.date(), 23, 59, 59, 999);
343
- const modifiers = {
344
- start: from,
345
- end: to,
346
- [classes.currentDay]: new Date(today.year(), today.month(), today.date())
347
- };
348
- const modifiersStyles = {
349
- start: {
350
- borderTopLeftRadius: '50%',
351
- borderBottomLeftRadius: '50%'
352
- },
353
- end: {
354
- borderTopRightRadius: '50%',
355
- borderBottomRightRadius: '50%'
356
- }
357
- };
358
- const selectedDays = [];
359
- const selected = {};
360
-
361
- if (from instanceof Date) {
362
- selectedDays.push(from);
363
- selected.from = from;
364
- }
365
-
366
- if (to instanceof Date) {
367
- selectedDays.push(to);
368
- selected.to = to;
369
- }
370
-
371
- if (Object.values(selected).length > 0) {
372
- selectedDays.push(selected);
364
+ (0, _createClass2.default)(HiDateRangePicker, [{
365
+ key: "componentWillUnmount",
366
+ value: function componentWillUnmount() {
367
+ clearTimeout(this.timeout);
373
368
  }
369
+ }, {
370
+ key: "render",
371
+ value: function render() {
372
+ var _this2 = this,
373
+ _classNames;
374
+
375
+ var _this$props3 = this.props,
376
+ classes = _this$props3.classes,
377
+ disabled = _this$props3.disabled,
378
+ disabledDays = _this$props3.disabledDays,
379
+ disableFutureDays = _this$props3.disableFutureDays,
380
+ enableTime = _this$props3.enableTime,
381
+ labelFrom = _this$props3.labelFrom,
382
+ labelTo = _this$props3.labelTo,
383
+ locale = _this$props3.locale,
384
+ format = _this$props3.format,
385
+ from = _this$props3.from,
386
+ fromError = _this$props3.fromError,
387
+ minimumDate = _this$props3.minimumDate,
388
+ onReset = _this$props3.onReset,
389
+ to = _this$props3.to,
390
+ toError = _this$props3.toError,
391
+ translations = _this$props3.translations,
392
+ id = _this$props3.id,
393
+ staticPosition = _this$props3.staticPosition,
394
+ errorText = _this$props3.errorText,
395
+ hasSelector = _this$props3.hasSelector,
396
+ helperIcon = _this$props3.helperIcon,
397
+ helperText = _this$props3.helperText,
398
+ timezoneName = _this$props3.timezoneName,
399
+ props = (0, _objectWithoutProperties2.default)(_this$props3, ["classes", "disabled", "disabledDays", "disableFutureDays", "enableTime", "labelFrom", "labelTo", "locale", "format", "from", "fromError", "minimumDate", "onReset", "to", "toError", "translations", "id", "staticPosition", "errorText", "hasSelector", "helperIcon", "helperText", "timezoneName"]);
400
+ var today = (0, _momentTimezone.default)().tz(timezoneName);
401
+ var now = new Date(today.year(), today.month(), today.date(), 23, 59, 59, 999);
402
+ var modifiers = (0, _defineProperty2.default)({
403
+ start: from,
404
+ end: to
405
+ }, classes.currentDay, new Date(today.year(), today.month(), today.date()));
406
+ var modifiersStyles = {
407
+ start: {
408
+ borderTopLeftRadius: '50%',
409
+ borderBottomLeftRadius: '50%'
410
+ },
411
+ end: {
412
+ borderTopRightRadius: '50%',
413
+ borderBottomRightRadius: '50%'
414
+ }
415
+ };
416
+ var selectedDays = [];
417
+ var selected = {};
374
418
 
375
- const dayPickerProps = _objectSpread({
376
- classNames: classes,
377
- disabledDays,
378
- firstDayOfWeek: 1,
379
- fromMonth: minimumDate,
380
- locale,
381
- modifiers,
382
- modifiersStyles,
383
- // Both are required ?
384
- selectedDays,
385
- todayButton: translations.today,
386
- weekdayElement: Weekday
387
- }, props);
388
-
389
- const fromDayPickerProps = _objectSpread({}, dayPickerProps, {
390
- onTodayButtonClick: this.handleCurrentMonthChange,
391
- navbarElement: this.renderNavBar,
392
- captionElement: this.renderCaption,
393
- disabledDays: _objectSpread({}, dayPickerProps.disabledDays, {
394
- before: minimumDate
395
- }, disableFutureDays && {
396
- after: now
397
- }, to && {
398
- after: to
399
- }),
400
- locale,
401
- localeUtils: HiLocaleUtils,
402
- month: this.state.currentMonth,
403
- modifiers: _objectSpread({}, modifiers)
404
- });
419
+ if (from instanceof Date) {
420
+ selectedDays.push(from);
421
+ selected.from = from;
422
+ }
405
423
 
406
- const toDayPickerProps = _objectSpread({}, dayPickerProps, {
407
- onTodayButtonClick: this.handleCurrentMonthChange,
408
- navbarElement: this.renderNavBar,
409
- onDayClick: this.onDayToClick,
410
- captionElement: this.renderCaption,
411
- disabledDays: _objectSpread({}, dayPickerProps.disabledDays, {
412
- before: minimumDate
413
- }, disableFutureDays && {
414
- after: now
415
- }, from && {
416
- before: from
417
- }),
418
- locale,
419
- localeUtils: HiLocaleUtils,
420
- month: this.state.currentMonth,
421
- modifiers: _objectSpread({}, modifiers)
422
- }); // From & To InputProps
423
-
424
-
425
- const fromInputProps = _objectSpread({}, onReset && {
426
- onReset: () => this.handleReset('from')
427
- }, props, fromError && {
428
- error: true
429
- }, labelFrom && {
430
- label: labelFrom
431
- }, {
432
- id: `${id}-from`,
433
- onChange: this.handleInputChange('from'),
434
- disabled,
435
- HiInputProps: {
436
- onSubmit: this.props.onSubmit
424
+ if (to instanceof Date) {
425
+ selectedDays.push(to);
426
+ selected.to = to;
437
427
  }
438
- });
439
428
 
440
- const toInputProps = _objectSpread({}, onReset && {
441
- onReset: () => this.handleReset('to')
442
- }, props, toError && {
443
- error: true
444
- }, labelTo && {
445
- label: labelTo
446
- }, {
447
- id: `${id}-to`,
448
- onChange: this.handleInputChange('to'),
449
- disabled,
450
- HiInputProps: {
451
- onSubmit: this.props.onSubmit
429
+ if (Object.values(selected).length > 0) {
430
+ selectedDays.push(selected);
452
431
  }
453
- });
454
432
 
455
- const toClass = classNames(classes.toInput, {
456
- [classes.absolute]: !isMobile && staticPosition === true && this.state.focusedInput === 'from',
457
- [classes.right4]: !isMobile && staticPosition === true && this.state.focusedInput === 'from'
458
- });
459
- let content = React.createElement("div", {
460
- className: classNames(classes.root, classes.rangePickerContainer)
461
- }, React.createElement("div", {
462
- className: classes.fromInput,
463
- onFocus: !isMobile ? () => this.handleDayPickerFocus('from') : undefined,
464
- onKeyDown: !isMobile ? this.handleKeyDown('from') : undefined
465
- }, React.createElement("div", null, !isMobile ? React.createElement(DayPickerInput, {
466
- key: '1',
467
- ref: el => {
468
- this.fromInput = el;
469
- },
470
- value: from,
471
- hideOnDayClick: false,
472
- overlayComponent: this.renderOverlayFrom,
473
- dayPickerProps: fromDayPickerProps,
474
- component: HiTextField,
475
- inputProps: fromInputProps,
476
- format: enableTime ? `${format} HH:mm` : format,
477
- formatDate: MomentLocaleUtils.formatDate,
478
- parseDate: MomentLocaleUtils.parseDate,
479
- onDayChange: day => this.handleDayChange('from', day),
480
- placeholder: ''
481
- }) : React.createElement(HiDatePickerMobile, {
482
- id: this.props.id,
483
- label: labelFrom,
484
- range: true,
485
- required: this.props.required,
486
- enableTime: enableTime,
487
- value: from,
488
- onChange: this.handleChangeMobile('from'),
489
- disablePastDays: this.props.disablePastDays,
490
- disableFutureDays: disableFutureDays,
491
- today: today,
492
- minimumDate: minimumDate,
493
- format: enableTime ? `${format} HH:mm` : format
494
- }))), React.createElement("div", {
495
- className: toClass,
496
- onFocus: !isMobile ? () => this.handleDayPickerFocus('to') : undefined,
497
- onBlur: !isMobile ? () => this.handleDayPickerBlur('to') : undefined,
498
- onKeyDown: !isMobile ? this.handleKeyDown('to') : undefined
499
- }, !isMobile ? React.createElement(DayPickerInput, {
500
- key: '1',
501
- ref: el => {
502
- this.toInput = el;
503
- },
504
- value: to,
505
- hideOnDayClick: false,
506
- overlayComponent: this.renderOverlayTo,
507
- dayPickerProps: toDayPickerProps,
508
- component: HiTextField,
509
- inputProps: toInputProps,
510
- format: enableTime ? `${format} HH:mm` : format,
511
- formatDate: MomentLocaleUtils.formatDate,
512
- parseDate: MomentLocaleUtils.parseDate,
513
- placeholder: ''
514
- }) : React.createElement(HiDatePickerMobile, {
515
- id: this.props.id,
516
- label: labelTo,
517
- range: true,
518
- required: this.props.required,
519
- enableTime: enableTime,
520
- value: to,
521
- onChange: this.handleChangeMobile('to'),
522
- disablePastDays: this.props.disablePastDays,
523
- disableFutureDays: disableFutureDays,
524
- today: today,
525
- minimumDate: minimumDate,
526
- format: enableTime ? `${format} HH:mm` : format
527
- })));
528
-
529
- if (!hasSelector) {
530
- content = React.createElement(HiFormControl, {
433
+ var dayPickerProps = (0, _objectSpread2.default)({
434
+ classNames: classes,
435
+ disabledDays: disabledDays,
436
+ firstDayOfWeek: 1,
437
+ fromMonth: minimumDate,
438
+ locale: locale,
439
+ modifiers: modifiers,
440
+ modifiersStyles: modifiersStyles,
441
+ // Both are required ?
442
+ selectedDays: selectedDays,
443
+ todayButton: translations.today,
444
+ weekdayElement: _Weekday.default
445
+ }, props);
446
+ var fromDayPickerProps = (0, _objectSpread2.default)({}, dayPickerProps, {
447
+ onTodayButtonClick: this.handleCurrentMonthChange,
448
+ navbarElement: this.renderNavBar,
449
+ captionElement: this.renderCaption,
450
+ disabledDays: (0, _objectSpread2.default)({}, dayPickerProps.disabledDays, {
451
+ before: minimumDate
452
+ }, disableFutureDays && {
453
+ after: now
454
+ }, {}, to && {
455
+ after: to
456
+ }),
457
+ locale: locale,
458
+ localeUtils: _hiLocaleUtils.default,
459
+ month: this.state.currentMonth,
460
+ modifiers: (0, _objectSpread2.default)({}, modifiers)
461
+ });
462
+ var toDayPickerProps = (0, _objectSpread2.default)({}, dayPickerProps, {
463
+ onTodayButtonClick: this.handleCurrentMonthChange,
464
+ navbarElement: this.renderNavBar,
465
+ onDayClick: this.onDayToClick,
466
+ captionElement: this.renderCaption,
467
+ disabledDays: (0, _objectSpread2.default)({}, dayPickerProps.disabledDays, {
468
+ before: minimumDate
469
+ }, disableFutureDays && {
470
+ after: now
471
+ }, {}, from && {
472
+ before: from
473
+ }),
474
+ locale: locale,
475
+ localeUtils: _hiLocaleUtils.default,
476
+ month: this.state.currentMonth,
477
+ modifiers: (0, _objectSpread2.default)({}, modifiers)
478
+ }); // From & To InputProps
479
+
480
+ var fromInputProps = (0, _objectSpread2.default)({}, onReset && {
481
+ onReset: function onReset() {
482
+ return _this2.handleReset('from');
483
+ }
484
+ }, {}, props, {}, fromError && {
485
+ error: true
486
+ }, {}, labelFrom && {
487
+ label: labelFrom
488
+ }, {
489
+ id: "".concat(id, "-from"),
490
+ onChange: this.handleInputChange('from'),
531
491
  disabled: disabled,
532
- helperIcon: helperIcon,
533
- helperText: helperText,
534
- errorText: errorText,
535
- error: fromError || toError,
536
- label: ' '
537
- }, content);
538
- }
539
-
540
- return content;
541
- }
492
+ HiInputProps: {
493
+ onSubmit: this.props.onSubmit
494
+ }
495
+ });
496
+ var toInputProps = (0, _objectSpread2.default)({}, onReset && {
497
+ onReset: function onReset() {
498
+ return _this2.handleReset('to');
499
+ }
500
+ }, {}, props, {}, toError && {
501
+ error: true
502
+ }, {}, labelTo && {
503
+ label: labelTo
504
+ }, {
505
+ id: "".concat(id, "-to"),
506
+ onChange: this.handleInputChange('to'),
507
+ disabled: disabled,
508
+ HiInputProps: {
509
+ onSubmit: this.props.onSubmit
510
+ }
511
+ });
512
+ var toClass = (0, _classnames.default)(classes.toInput, (_classNames = {}, (0, _defineProperty2.default)(_classNames, classes.absolute, !_reactDeviceDetect.isMobile && staticPosition === true && this.state.focusedInput === 'from'), (0, _defineProperty2.default)(_classNames, classes.right4, !_reactDeviceDetect.isMobile && staticPosition === true && this.state.focusedInput === 'from'), _classNames));
513
+
514
+ var content = _react.default.createElement("div", {
515
+ className: (0, _classnames.default)(classes.root, classes.rangePickerContainer)
516
+ }, _react.default.createElement("div", {
517
+ className: classes.fromInput,
518
+ onFocus: !_reactDeviceDetect.isMobile ? function () {
519
+ return _this2.handleDayPickerFocus('from');
520
+ } : undefined,
521
+ onKeyDown: !_reactDeviceDetect.isMobile ? this.handleKeyDown('from') : undefined
522
+ }, _react.default.createElement("div", null, !_reactDeviceDetect.isMobile ? _react.default.createElement(_DayPickerInput.default, {
523
+ key: '1',
524
+ ref: function ref(el) {
525
+ _this2.fromInput = el;
526
+ },
527
+ value: from,
528
+ hideOnDayClick: false,
529
+ overlayComponent: this.renderOverlayFrom,
530
+ dayPickerProps: fromDayPickerProps,
531
+ component: _HiForm.HiTextField,
532
+ inputProps: fromInputProps,
533
+ format: enableTime ? "".concat(format, " HH:mm") : format,
534
+ formatDate: _moment.default.formatDate,
535
+ parseDate: _moment.default.parseDate,
536
+ onDayChange: function onDayChange(day) {
537
+ return _this2.handleDayChange('from', day);
538
+ },
539
+ placeholder: ''
540
+ }) : _react.default.createElement(_HiDatePickerMobile.default, {
541
+ id: this.props.id,
542
+ label: labelFrom,
543
+ range: true,
544
+ required: this.props.required,
545
+ enableTime: enableTime,
546
+ value: from,
547
+ onChange: this.handleChangeMobile('from'),
548
+ disablePastDays: this.props.disablePastDays,
549
+ disableFutureDays: disableFutureDays,
550
+ today: today,
551
+ minimumDate: minimumDate,
552
+ format: enableTime ? "".concat(format, " HH:mm") : format
553
+ }))), _react.default.createElement("div", {
554
+ className: toClass,
555
+ onFocus: !_reactDeviceDetect.isMobile ? function () {
556
+ return _this2.handleDayPickerFocus('to');
557
+ } : undefined,
558
+ onBlur: !_reactDeviceDetect.isMobile ? function () {
559
+ return _this2.handleDayPickerBlur('to');
560
+ } : undefined,
561
+ onKeyDown: !_reactDeviceDetect.isMobile ? this.handleKeyDown('to') : undefined
562
+ }, !_reactDeviceDetect.isMobile ? _react.default.createElement(_DayPickerInput.default, {
563
+ key: '1',
564
+ ref: function ref(el) {
565
+ _this2.toInput = el;
566
+ },
567
+ value: to,
568
+ hideOnDayClick: false,
569
+ overlayComponent: this.renderOverlayTo,
570
+ dayPickerProps: toDayPickerProps,
571
+ component: _HiForm.HiTextField,
572
+ inputProps: toInputProps,
573
+ format: enableTime ? "".concat(format, " HH:mm") : format,
574
+ formatDate: _moment.default.formatDate,
575
+ parseDate: _moment.default.parseDate,
576
+ placeholder: ''
577
+ }) : _react.default.createElement(_HiDatePickerMobile.default, {
578
+ id: this.props.id,
579
+ label: labelTo,
580
+ range: true,
581
+ required: this.props.required,
582
+ enableTime: enableTime,
583
+ value: to,
584
+ onChange: this.handleChangeMobile('to'),
585
+ disablePastDays: this.props.disablePastDays,
586
+ disableFutureDays: disableFutureDays,
587
+ today: today,
588
+ minimumDate: minimumDate,
589
+ format: enableTime ? "".concat(format, " HH:mm") : format
590
+ })));
591
+
592
+ if (!hasSelector) {
593
+ content = _react.default.createElement(_HiFormControl.default, {
594
+ disabled: disabled,
595
+ helperIcon: helperIcon,
596
+ helperText: helperText,
597
+ errorText: errorText,
598
+ error: fromError || toError,
599
+ label: ' '
600
+ }, content);
601
+ }
542
602
 
543
- }
603
+ return content;
604
+ }
605
+ }]);
606
+ return HiDateRangePicker;
607
+ }(_react.default.Component);
544
608
 
545
- HiDateRangePicker.defaultProps = {
609
+ (0, _defineProperty2.default)(HiDateRangePicker, "defaultProps", {
546
610
  disabledDays: {},
547
611
  disableFutureDays: true,
548
612
  staticPosition: false,
@@ -568,144 +632,10 @@ HiDateRangePicker.defaultProps = {
568
632
  date_superior_max_date: 'Date from cannot be greater than %s',
569
633
  date_inferior_min_date: 'Date from cannot be before than %s'
570
634
  }
571
- };
572
- HiDateRangePicker.propTypes = process.env.NODE_ENV !== "production" ? {
573
- /**
574
- * Useful to extend the style applied to components.
575
- */
576
- classes: PropTypes.object,
577
-
578
- /**
579
- * Inactif
580
- */
581
- disabled: PropTypes.bool,
582
-
583
- /**
584
- * http://react-day-picker.js.org/api/DayPicker#disabledDays
585
- */
586
- disabledDays: PropTypes.object,
587
-
588
- /**
589
- * Uniquement la sélection de date antérieures à aujourd'hui (inclu)
590
- */
591
- disableFutureDays: PropTypes.bool,
592
-
593
- /**
594
- * Ajoute la gestion de l'heure
595
- */
596
- enableTime: PropTypes.bool,
597
-
598
- /**
599
- * Texte de l'erreur
600
- */
601
- errorText: PropTypes.string,
602
-
603
- /**
604
- * Format des dates affichées
605
- */
606
- format: PropTypes.string,
607
-
608
- /**
609
- * Date de début sélectionnée
610
- */
611
- from: PropTypes.instanceOf(Date),
612
- // from: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string]),
613
-
614
- /**
615
- * Erreur sur date from
616
- */
617
- fromError: PropTypes.bool,
618
-
619
- /**
620
- * @ignore
621
- * Si true, on n'enveloppe pas le composant avec un HiFormControl
622
- */
623
- hasSelector: PropTypes.bool,
624
-
625
- /**
626
- * Si "true", le texte d'aide s'affichera seulement au clic sur l'icône "Information"
627
- */
628
- helperIcon: PropTypes.bool,
629
-
630
- /**
631
- * Texte de l'aide
632
- */
633
- helperText: PropTypes.string,
634
-
635
- /**
636
- * Utilisé pour construire les ids des champs from et to en les suffixant "-from" et "-to"
637
- */
638
- id: PropTypes.string.isRequired,
639
-
640
- /**
641
- * Label du champs de début
642
- */
643
- labelFrom: PropTypes.string,
644
-
645
- /**
646
- * Label du champs de fin
647
- */
648
- labelTo: PropTypes.string,
649
-
650
- /**
651
- * Locale utilisée
652
- */
653
- locale: PropTypes.string,
654
-
655
- /**
656
- * Date minimale sélectionnable
657
- */
658
- minimumDate: PropTypes.instanceOf(Date),
659
-
660
- /**
661
- * Callback à la sélection d'une date
662
- * @param {string} nom de l'input
663
- */
664
- onBlur: PropTypes.func,
665
-
666
- /**
667
- * Callback à la sélection d'une date
668
- * @param {string} nom du champs
669
- * @param {string} nouvelle valeur du champs
670
- */
671
- onChange: PropTypes.func.isRequired,
672
-
673
- /**
674
- * Callback au reset de l'input
675
- * @param {string} nom du champs réinitialisé
676
- */
677
- onReset: PropTypes.func,
678
-
679
- /**
680
- * Callback lorsque l'utilisateur tape sur "Entrée"
681
- */
682
- onSubmit: PropTypes.func,
683
-
684
- /**
685
- * Si true, le calendrier sera dans une div static plutot que dans une popper absolute
686
- */
687
- staticPosition: PropTypes.bool,
688
-
689
- /**
690
- * Timezone de l'utilisateur
691
- */
692
- timezoneName: PropTypes.string,
693
-
694
- /**
695
- * Date de fin sélectionnée
696
- */
697
- to: PropTypes.instanceOf(Date),
698
-
699
- /**
700
- * Erreur sur date to
701
- */
702
- toError: PropTypes.bool,
703
-
704
- /**
705
- * Traductions
706
- */
707
- translations: PropTypes.object
708
- } : {};
709
- export default withStyles(styles, {
635
+ });
636
+
637
+ var _default = (0, _styles.withStyles)(_stylesheet.default, {
710
638
  name: 'HmuiHiDateRangePicker'
711
- })(HiDateRangePicker);
639
+ })(HiDateRangePicker);
640
+
641
+ exports.default = _default;