@mtes-mct/monitor-ui 1.7.2 → 1.7.3

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 (200) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/index.js +3424 -0
  3. package/index.js.map +1 -0
  4. package/package.json +3 -3
  5. package/.yarn/cache/date-fns-npm-2.29.3-fef7e3c72c-e01cf5b62a.zip/node_modules/date-fns/esm/locale/_lib/buildFormatLongFn/index.js +0 -12
  6. package/.yarn/cache/date-fns-npm-2.29.3-fef7e3c72c-e01cf5b62a.zip/node_modules/date-fns/esm/locale/_lib/buildFormatLongFn/index.js.map +0 -1
  7. package/.yarn/cache/date-fns-npm-2.29.3-fef7e3c72c-e01cf5b62a.zip/node_modules/date-fns/esm/locale/_lib/buildLocalizeFn/index.js +0 -25
  8. package/.yarn/cache/date-fns-npm-2.29.3-fef7e3c72c-e01cf5b62a.zip/node_modules/date-fns/esm/locale/_lib/buildLocalizeFn/index.js.map +0 -1
  9. package/.yarn/cache/date-fns-npm-2.29.3-fef7e3c72c-e01cf5b62a.zip/node_modules/date-fns/esm/locale/_lib/buildMatchFn/index.js +0 -51
  10. package/.yarn/cache/date-fns-npm-2.29.3-fef7e3c72c-e01cf5b62a.zip/node_modules/date-fns/esm/locale/_lib/buildMatchFn/index.js.map +0 -1
  11. package/.yarn/cache/date-fns-npm-2.29.3-fef7e3c72c-e01cf5b62a.zip/node_modules/date-fns/esm/locale/_lib/buildMatchPatternFn/index.js +0 -20
  12. package/.yarn/cache/date-fns-npm-2.29.3-fef7e3c72c-e01cf5b62a.zip/node_modules/date-fns/esm/locale/_lib/buildMatchPatternFn/index.js.map +0 -1
  13. package/.yarn/cache/date-fns-npm-2.29.3-fef7e3c72c-e01cf5b62a.zip/node_modules/date-fns/esm/locale/fr/_lib/formatDistance/index.js +0 -89
  14. package/.yarn/cache/date-fns-npm-2.29.3-fef7e3c72c-e01cf5b62a.zip/node_modules/date-fns/esm/locale/fr/_lib/formatDistance/index.js.map +0 -1
  15. package/.yarn/cache/date-fns-npm-2.29.3-fef7e3c72c-e01cf5b62a.zip/node_modules/date-fns/esm/locale/fr/_lib/formatLong/index.js +0 -37
  16. package/.yarn/cache/date-fns-npm-2.29.3-fef7e3c72c-e01cf5b62a.zip/node_modules/date-fns/esm/locale/fr/_lib/formatLong/index.js.map +0 -1
  17. package/.yarn/cache/date-fns-npm-2.29.3-fef7e3c72c-e01cf5b62a.zip/node_modules/date-fns/esm/locale/fr/_lib/formatRelative/index.js +0 -15
  18. package/.yarn/cache/date-fns-npm-2.29.3-fef7e3c72c-e01cf5b62a.zip/node_modules/date-fns/esm/locale/fr/_lib/formatRelative/index.js.map +0 -1
  19. package/.yarn/cache/date-fns-npm-2.29.3-fef7e3c72c-e01cf5b62a.zip/node_modules/date-fns/esm/locale/fr/_lib/localize/index.js +0 -101
  20. package/.yarn/cache/date-fns-npm-2.29.3-fef7e3c72c-e01cf5b62a.zip/node_modules/date-fns/esm/locale/fr/_lib/localize/index.js.map +0 -1
  21. package/.yarn/cache/date-fns-npm-2.29.3-fef7e3c72c-e01cf5b62a.zip/node_modules/date-fns/esm/locale/fr/_lib/match/index.js +0 -101
  22. package/.yarn/cache/date-fns-npm-2.29.3-fef7e3c72c-e01cf5b62a.zip/node_modules/date-fns/esm/locale/fr/_lib/match/index.js.map +0 -1
  23. package/.yarn/cache/date-fns-npm-2.29.3-fef7e3c72c-e01cf5b62a.zip/node_modules/date-fns/esm/locale/fr/index.js +0 -34
  24. package/.yarn/cache/date-fns-npm-2.29.3-fef7e3c72c-e01cf5b62a.zip/node_modules/date-fns/esm/locale/fr/index.js.map +0 -1
  25. package/.yarn/cache/dayjs-npm-1.11.5-a825142dc5-e3bbaa7b48.zip/node_modules/dayjs/dayjs.min.js +0 -16
  26. package/.yarn/cache/dayjs-npm-1.11.5-a825142dc5-e3bbaa7b48.zip/node_modules/dayjs/dayjs.min.js.map +0 -1
  27. package/.yarn/cache/dayjs-npm-1.11.5-a825142dc5-e3bbaa7b48.zip/node_modules/dayjs/locale/fr.js +0 -8
  28. package/.yarn/cache/dayjs-npm-1.11.5-a825142dc5-e3bbaa7b48.zip/node_modules/dayjs/locale/fr.js.map +0 -1
  29. package/.yarn/cache/dayjs-npm-1.11.5-a825142dc5-e3bbaa7b48.zip/node_modules/dayjs/plugin/timezone.js +0 -11
  30. package/.yarn/cache/dayjs-npm-1.11.5-a825142dc5-e3bbaa7b48.zip/node_modules/dayjs/plugin/timezone.js.map +0 -1
  31. package/.yarn/cache/dayjs-npm-1.11.5-a825142dc5-e3bbaa7b48.zip/node_modules/dayjs/plugin/utc.js +0 -11
  32. package/.yarn/cache/dayjs-npm-1.11.5-a825142dc5-e3bbaa7b48.zip/node_modules/dayjs/plugin/utc.js.map +0 -1
  33. package/.yarn/cache/lodash.throttle-npm-4.1.1-856641af92-129c0a28ce.zip/node_modules/lodash.throttle/index.js +0 -444
  34. package/.yarn/cache/lodash.throttle-npm-4.1.1-856641af92-129c0a28ce.zip/node_modules/lodash.throttle/index.js.map +0 -1
  35. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/bind.js +0 -36
  36. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/bind.js.map +0 -1
  37. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/equals.js +0 -37
  38. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/equals.js.map +0 -1
  39. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/filter.js +0 -53
  40. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/filter.js.map +0 -1
  41. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_arity.js +0 -65
  42. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_arity.js.map +0 -1
  43. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_arrayFromIterator.js +0 -13
  44. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_arrayFromIterator.js.map +0 -1
  45. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_complement.js +0 -8
  46. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_complement.js.map +0 -1
  47. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_curry1.js +0 -23
  48. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_curry1.js.map +0 -1
  49. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_curry2.js +0 -35
  50. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_curry2.js.map +0 -1
  51. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_curry3.js +0 -53
  52. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_curry3.js.map +0 -1
  53. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_dispatchable.js +0 -50
  54. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_dispatchable.js.map +0 -1
  55. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_equals.js +0 -166
  56. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_equals.js.map +0 -1
  57. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_filter.js +0 -18
  58. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_filter.js.map +0 -1
  59. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_functionName.js +0 -8
  60. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_functionName.js.map +0 -1
  61. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_has.js +0 -6
  62. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_has.js.map +0 -1
  63. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_includesWith.js +0 -17
  64. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_includesWith.js.map +0 -1
  65. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_isArguments.js +0 -16
  66. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_isArguments.js.map +0 -1
  67. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_isArray.js +0 -18
  68. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_isArray.js.map +0 -1
  69. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_isArrayLike.js +0 -55
  70. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_isArrayLike.js.map +0 -1
  71. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_isObject.js +0 -6
  72. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_isObject.js.map +0 -1
  73. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_isPlaceholder.js +0 -6
  74. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_isPlaceholder.js.map +0 -1
  75. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_isString.js +0 -6
  76. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_isString.js.map +0 -1
  77. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_isTransformer.js +0 -6
  78. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_isTransformer.js.map +0 -1
  79. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_objectIs.js +0 -17
  80. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_objectIs.js.map +0 -1
  81. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_reduce.js +0 -74
  82. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_reduce.js.map +0 -1
  83. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_xfBase.js +0 -11
  84. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_xfBase.js.map +0 -1
  85. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_xfilter.js +0 -29
  86. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_xfilter.js.map +0 -1
  87. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_xwrap.js +0 -28
  88. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/internal/_xwrap.js.map +0 -1
  89. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/keys.js +0 -92
  90. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/keys.js.map +0 -1
  91. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/mergeDeepRight.js +0 -35
  92. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/mergeDeepRight.js.map +0 -1
  93. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/mergeDeepWithKey.js +0 -47
  94. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/mergeDeepWithKey.js.map +0 -1
  95. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/mergeWithKey.js +0 -52
  96. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/mergeWithKey.js.map +0 -1
  97. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/reject.js +0 -37
  98. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/reject.js.map +0 -1
  99. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/type.js +0 -36
  100. package/.yarn/cache/ramda-npm-0.28.0-6a5fe8f6cc-44ea6e5010.zip/node_modules/ramda/es/type.js.map +0 -1
  101. package/_virtual/_commonjsHelpers.js +0 -4
  102. package/_virtual/_commonjsHelpers.js.map +0 -1
  103. package/_virtual/dayjs.min.js +0 -4
  104. package/_virtual/dayjs.min.js.map +0 -1
  105. package/_virtual/dayjs.min2.js +0 -6
  106. package/_virtual/dayjs.min2.js.map +0 -1
  107. package/_virtual/fr.js +0 -4
  108. package/_virtual/fr.js.map +0 -1
  109. package/_virtual/timezone.js +0 -4
  110. package/_virtual/timezone.js.map +0 -1
  111. package/_virtual/utc.js +0 -4
  112. package/_virtual/utc.js.map +0 -1
  113. package/src/ThemeProvider.js +0 -13
  114. package/src/ThemeProvider.js.map +0 -1
  115. package/src/constants.js +0 -2
  116. package/src/constants.js.map +0 -1
  117. package/src/elements/Field.js +0 -9
  118. package/src/elements/Field.js.map +0 -1
  119. package/src/elements/Fieldset.js +0 -15
  120. package/src/elements/Fieldset.js.map +0 -1
  121. package/src/elements/Label.js +0 -12
  122. package/src/elements/Label.js.map +0 -1
  123. package/src/elements/Legend.js +0 -9
  124. package/src/elements/Legend.js.map +0 -1
  125. package/src/fields/Checkbox.js +0 -17
  126. package/src/fields/Checkbox.js.map +0 -1
  127. package/src/fields/DatePicker/CalendarPicker.js +0 -137
  128. package/src/fields/DatePicker/CalendarPicker.js.map +0 -1
  129. package/src/fields/DatePicker/index.js +0 -126
  130. package/src/fields/DatePicker/index.js.map +0 -1
  131. package/src/fields/DateRangePicker/DateInput.js +0 -84
  132. package/src/fields/DateRangePicker/DateInput.js.map +0 -1
  133. package/src/fields/DateRangePicker/NumberInput.js +0 -82
  134. package/src/fields/DateRangePicker/NumberInput.js.map +0 -1
  135. package/src/fields/DateRangePicker/RangeCalendarPicker.js +0 -147
  136. package/src/fields/DateRangePicker/RangeCalendarPicker.js.map +0 -1
  137. package/src/fields/DateRangePicker/RangedTimePicker.js +0 -90
  138. package/src/fields/DateRangePicker/RangedTimePicker.js.map +0 -1
  139. package/src/fields/DateRangePicker/TimeInput.js +0 -116
  140. package/src/fields/DateRangePicker/TimeInput.js.map +0 -1
  141. package/src/fields/DateRangePicker/constants.js +0 -34
  142. package/src/fields/DateRangePicker/constants.js.map +0 -1
  143. package/src/fields/DateRangePicker/index.js +0 -187
  144. package/src/fields/DateRangePicker/index.js.map +0 -1
  145. package/src/fields/DateRangePicker/types.js +0 -8
  146. package/src/fields/DateRangePicker/types.js.map +0 -1
  147. package/src/fields/DateRangePicker/utils.js +0 -73
  148. package/src/fields/DateRangePicker/utils.js.map +0 -1
  149. package/src/fields/MultiCheckbox.js +0 -52
  150. package/src/fields/MultiCheckbox.js.map +0 -1
  151. package/src/fields/MultiRadio.js +0 -54
  152. package/src/fields/MultiRadio.js.map +0 -1
  153. package/src/fields/MultiSelect.js +0 -33
  154. package/src/fields/MultiSelect.js.map +0 -1
  155. package/src/fields/Select.js +0 -27
  156. package/src/fields/Select.js.map +0 -1
  157. package/src/fields/TextInput.js +0 -25
  158. package/src/fields/TextInput.js.map +0 -1
  159. package/src/fields/Textarea.js +0 -28
  160. package/src/fields/Textarea.js.map +0 -1
  161. package/src/formiks/FormikCheckbox.js +0 -22
  162. package/src/formiks/FormikCheckbox.js.map +0 -1
  163. package/src/formiks/FormikDatePicker.js +0 -17
  164. package/src/formiks/FormikDatePicker.js.map +0 -1
  165. package/src/formiks/FormikDateRangePicker.js +0 -17
  166. package/src/formiks/FormikDateRangePicker.js.map +0 -1
  167. package/src/formiks/FormikEffect.js +0 -14
  168. package/src/formiks/FormikEffect.js.map +0 -1
  169. package/src/formiks/FormikMultiCheckbox.js +0 -21
  170. package/src/formiks/FormikMultiCheckbox.js.map +0 -1
  171. package/src/formiks/FormikMultiRadio.js +0 -21
  172. package/src/formiks/FormikMultiRadio.js.map +0 -1
  173. package/src/formiks/FormikMultiSelect.js +0 -21
  174. package/src/formiks/FormikMultiSelect.js.map +0 -1
  175. package/src/formiks/FormikSelect.js +0 -21
  176. package/src/formiks/FormikSelect.js.map +0 -1
  177. package/src/formiks/FormikTextInput.js +0 -21
  178. package/src/formiks/FormikTextInput.js.map +0 -1
  179. package/src/formiks/FormikTextarea.js +0 -21
  180. package/src/formiks/FormikTextarea.js.map +0 -1
  181. package/src/hooks/useForceUpdate.js +0 -17
  182. package/src/hooks/useForceUpdate.js.map +0 -1
  183. package/src/index.js +0 -28
  184. package/src/index.js.map +0 -1
  185. package/src/theme.js +0 -68
  186. package/src/theme.js.map +0 -1
  187. package/src/utils/capitalizeFirstLetter.js +0 -9
  188. package/src/utils/capitalizeFirstLetter.js.map +0 -1
  189. package/src/utils/dayjs.js +0 -11
  190. package/src/utils/dayjs.js.map +0 -1
  191. package/src/utils/getLocalizedDayjs.js +0 -19
  192. package/src/utils/getLocalizedDayjs.js.map +0 -1
  193. package/src/utils/getUtcDayjs.js +0 -9
  194. package/src/utils/getUtcDayjs.js.map +0 -1
  195. package/src/utils/getUtcizedDayjs.js +0 -20
  196. package/src/utils/getUtcizedDayjs.js.map +0 -1
  197. package/src/utils/sortDates.js +0 -12
  198. package/src/utils/sortDates.js.map +0 -1
  199. package/src/utils/stopMouseEventPropagation.js +0 -6
  200. package/src/utils/stopMouseEventPropagation.js.map +0 -1
package/index.js ADDED
@@ -0,0 +1,3424 @@
1
+ import styled, { createGlobalStyle, css, ThemeProvider as ThemeProvider$1 } from 'styled-components';
2
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
+ import { useMemo, useCallback, useReducer, forwardRef, useRef, useImperativeHandle, useState, useEffect } from 'react';
4
+ import { Checkbox as Checkbox$1, DateRangePicker as DateRangePicker$1, DatePicker as DatePicker$1, TagPicker, Radio, SelectPicker, Input } from 'rsuite';
5
+ import { useField, useFormikContext } from 'formik';
6
+
7
+ /* eslint-disable sort-keys-fix/sort-keys-fix, typescript-sort-keys/string-enum */
8
+
9
+ var constants = /*#__PURE__*/Object.freeze({
10
+ __proto__: null
11
+ });
12
+
13
+ /* eslint-disable sort-keys-fix/sort-keys-fix, typescript-sort-keys/interface */
14
+ const THEME = {
15
+ // https://xd.adobe.com/view/b6d4c472-3fbe-4dec-9f14-38fe03872a3e-e387/screen/b9bdc1ba-5f07-4c4f-bd44-2d38b2c6f663/specs/
16
+ color: {
17
+ /** INTERFACE COLORS */
18
+ // Neutral Colors
19
+ gunMetal: '#282F3E',
20
+ // TODO Make that charcoal object 100 & 50
21
+ charcoal: '#3B4559',
22
+ charcoalShadow: 'rgba(59, 69, 89, 0.5)',
23
+ slateGray: '#707785',
24
+ lightGray: '#CCCFD6',
25
+ gainsboro: '#E5E5EB',
26
+ cultured: '#F7F7FA',
27
+ white: '#FFFFFF',
28
+ // Accentuation Colors
29
+ blueYonder: {
30
+ 25: '#D4DDE7',
31
+ 100: '#567A9E'
32
+ },
33
+ blueGray: {
34
+ 100: '#5697D2',
35
+ 25: '#D4E5F4'
36
+ },
37
+ babyBlueEyes: '#99C9FF',
38
+ // Notification Colors
39
+ mediumSeaGreen: '#29B361',
40
+ goldenPoppy: '#FAC11A',
41
+ maximumRed: '#E1000F',
42
+ /** CONTEXTUAL COLORS */
43
+ // Risk Factor
44
+ cadetGray: '#8E9A9F',
45
+ grullo: '#B89B8C',
46
+ copperRed: '#CF6A4E',
47
+ chineseRed: '#A13112',
48
+ // Vessel Track
49
+ darkCornflowerBlue: '#2A4670',
50
+ jungleGreen: '#1C9B7B',
51
+ // Beacon Malfunction
52
+ powderBlue: '#9ED7D9',
53
+ wheat: '#EDD6A4',
54
+ // goldenPoppy: '#FAC11A',
55
+ // maximumRed: '#E1000F',
56
+ // charcoal: '#3B4559',
57
+ // mediumSeaGreen: '#29B361',
58
+ opal: '#A5BCC0',
59
+ // Regulation Areas
60
+ yaleBlue: '#295375',
61
+ glaucous: '#6284A6',
62
+ blueNcs: '#3690C0',
63
+ iceberg: '#67A9CF',
64
+ lightSteelBlue: '#9AB4D6',
65
+ lightPeriwinkle: '#CDCFEA',
66
+ aliceBlue: '#EBF0F4',
67
+ lightCyan: '#C7EAE5',
68
+ middleBlueGreen: '#91CFC9',
69
+ verdigris: '#56B3AB',
70
+ viridianGreen: '#01A29D',
71
+ paoloVeroneseGreen: '#21977F',
72
+ skobeloff: '#01686B',
73
+ blueSapphire: '#01536A',
74
+ indigoDye: '#033E54',
75
+ lightCoral: '#FA8282'
76
+ }
77
+ };
78
+
79
+ const Field$2 = styled.div `
80
+ display: flex;
81
+ flex-direction: column;
82
+ `;
83
+
84
+ function Fieldset(nativeProps) {
85
+ return jsx(StyledField, { as: "fieldset", ...nativeProps });
86
+ }
87
+ const StyledField = styled(Field$2) `
88
+ border: 0;
89
+ margin: 0;
90
+ padding: 0;
91
+ `;
92
+
93
+ const Label = styled.label `
94
+ color: ${p => p.theme.color.slateGray};
95
+ display: ${p => (p.isHidden ? 'none' : 'table')};
96
+ font-size: 13px;
97
+ line-height: 1.4;
98
+ margin-bottom: 0.5rem;
99
+ `;
100
+
101
+ function Legend({ isHidden = false, ...nativeProps }) {
102
+ return jsx(Label, { as: "legend", isHidden: isHidden, ...nativeProps });
103
+ }
104
+
105
+ function Checkbox({ label, onChange, ...originalProps }) {
106
+ const key = useMemo(() => `${originalProps.name}-${String(originalProps.defaultChecked)}`, [originalProps.defaultChecked, originalProps.name]);
107
+ const handleChange = useCallback((_, isChecked) => {
108
+ if (!onChange) {
109
+ return;
110
+ }
111
+ onChange(isChecked);
112
+ }, [onChange]);
113
+ return (jsx(Checkbox$1, { id: originalProps.name, onChange: handleChange, ...originalProps, children: label }, key));
114
+ }
115
+
116
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
117
+
118
+ /**
119
+ * lodash (Custom Build) <https://lodash.com/>
120
+ * Build: `lodash modularize exports="npm" -o ./`
121
+ * Copyright jQuery Foundation and other contributors <https://jquery.org/>
122
+ * Released under MIT license <https://lodash.com/license>
123
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
124
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
125
+ */
126
+
127
+ /** Used as the `TypeError` message for "Functions" methods. */
128
+ var FUNC_ERROR_TEXT = 'Expected a function';
129
+
130
+ /** Used as references for various `Number` constants. */
131
+ var NAN = 0 / 0;
132
+
133
+ /** `Object#toString` result references. */
134
+ var symbolTag = '[object Symbol]';
135
+
136
+ /** Used to match leading and trailing whitespace. */
137
+ var reTrim = /^\s+|\s+$/g;
138
+
139
+ /** Used to detect bad signed hexadecimal string values. */
140
+ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
141
+
142
+ /** Used to detect binary string values. */
143
+ var reIsBinary = /^0b[01]+$/i;
144
+
145
+ /** Used to detect octal string values. */
146
+ var reIsOctal = /^0o[0-7]+$/i;
147
+
148
+ /** Built-in method references without a dependency on `root`. */
149
+ var freeParseInt = parseInt;
150
+
151
+ /** Detect free variable `global` from Node.js. */
152
+ var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
153
+
154
+ /** Detect free variable `self`. */
155
+ var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
156
+
157
+ /** Used as a reference to the global object. */
158
+ var root = freeGlobal || freeSelf || Function('return this')();
159
+
160
+ /** Used for built-in method references. */
161
+ var objectProto = Object.prototype;
162
+
163
+ /**
164
+ * Used to resolve the
165
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
166
+ * of values.
167
+ */
168
+ var objectToString = objectProto.toString;
169
+
170
+ /* Built-in method references for those with the same name as other `lodash` methods. */
171
+ var nativeMax = Math.max,
172
+ nativeMin = Math.min;
173
+
174
+ /**
175
+ * Gets the timestamp of the number of milliseconds that have elapsed since
176
+ * the Unix epoch (1 January 1970 00:00:00 UTC).
177
+ *
178
+ * @static
179
+ * @memberOf _
180
+ * @since 2.4.0
181
+ * @category Date
182
+ * @returns {number} Returns the timestamp.
183
+ * @example
184
+ *
185
+ * _.defer(function(stamp) {
186
+ * console.log(_.now() - stamp);
187
+ * }, _.now());
188
+ * // => Logs the number of milliseconds it took for the deferred invocation.
189
+ */
190
+ var now = function() {
191
+ return root.Date.now();
192
+ };
193
+
194
+ /**
195
+ * Creates a debounced function that delays invoking `func` until after `wait`
196
+ * milliseconds have elapsed since the last time the debounced function was
197
+ * invoked. The debounced function comes with a `cancel` method to cancel
198
+ * delayed `func` invocations and a `flush` method to immediately invoke them.
199
+ * Provide `options` to indicate whether `func` should be invoked on the
200
+ * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
201
+ * with the last arguments provided to the debounced function. Subsequent
202
+ * calls to the debounced function return the result of the last `func`
203
+ * invocation.
204
+ *
205
+ * **Note:** If `leading` and `trailing` options are `true`, `func` is
206
+ * invoked on the trailing edge of the timeout only if the debounced function
207
+ * is invoked more than once during the `wait` timeout.
208
+ *
209
+ * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
210
+ * until to the next tick, similar to `setTimeout` with a timeout of `0`.
211
+ *
212
+ * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
213
+ * for details over the differences between `_.debounce` and `_.throttle`.
214
+ *
215
+ * @static
216
+ * @memberOf _
217
+ * @since 0.1.0
218
+ * @category Function
219
+ * @param {Function} func The function to debounce.
220
+ * @param {number} [wait=0] The number of milliseconds to delay.
221
+ * @param {Object} [options={}] The options object.
222
+ * @param {boolean} [options.leading=false]
223
+ * Specify invoking on the leading edge of the timeout.
224
+ * @param {number} [options.maxWait]
225
+ * The maximum time `func` is allowed to be delayed before it's invoked.
226
+ * @param {boolean} [options.trailing=true]
227
+ * Specify invoking on the trailing edge of the timeout.
228
+ * @returns {Function} Returns the new debounced function.
229
+ * @example
230
+ *
231
+ * // Avoid costly calculations while the window size is in flux.
232
+ * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
233
+ *
234
+ * // Invoke `sendMail` when clicked, debouncing subsequent calls.
235
+ * jQuery(element).on('click', _.debounce(sendMail, 300, {
236
+ * 'leading': true,
237
+ * 'trailing': false
238
+ * }));
239
+ *
240
+ * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
241
+ * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
242
+ * var source = new EventSource('/stream');
243
+ * jQuery(source).on('message', debounced);
244
+ *
245
+ * // Cancel the trailing debounced invocation.
246
+ * jQuery(window).on('popstate', debounced.cancel);
247
+ */
248
+ function debounce(func, wait, options) {
249
+ var lastArgs,
250
+ lastThis,
251
+ maxWait,
252
+ result,
253
+ timerId,
254
+ lastCallTime,
255
+ lastInvokeTime = 0,
256
+ leading = false,
257
+ maxing = false,
258
+ trailing = true;
259
+
260
+ if (typeof func != 'function') {
261
+ throw new TypeError(FUNC_ERROR_TEXT);
262
+ }
263
+ wait = toNumber(wait) || 0;
264
+ if (isObject(options)) {
265
+ leading = !!options.leading;
266
+ maxing = 'maxWait' in options;
267
+ maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
268
+ trailing = 'trailing' in options ? !!options.trailing : trailing;
269
+ }
270
+
271
+ function invokeFunc(time) {
272
+ var args = lastArgs,
273
+ thisArg = lastThis;
274
+
275
+ lastArgs = lastThis = undefined;
276
+ lastInvokeTime = time;
277
+ result = func.apply(thisArg, args);
278
+ return result;
279
+ }
280
+
281
+ function leadingEdge(time) {
282
+ // Reset any `maxWait` timer.
283
+ lastInvokeTime = time;
284
+ // Start the timer for the trailing edge.
285
+ timerId = setTimeout(timerExpired, wait);
286
+ // Invoke the leading edge.
287
+ return leading ? invokeFunc(time) : result;
288
+ }
289
+
290
+ function remainingWait(time) {
291
+ var timeSinceLastCall = time - lastCallTime,
292
+ timeSinceLastInvoke = time - lastInvokeTime,
293
+ result = wait - timeSinceLastCall;
294
+
295
+ return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
296
+ }
297
+
298
+ function shouldInvoke(time) {
299
+ var timeSinceLastCall = time - lastCallTime,
300
+ timeSinceLastInvoke = time - lastInvokeTime;
301
+
302
+ // Either this is the first call, activity has stopped and we're at the
303
+ // trailing edge, the system time has gone backwards and we're treating
304
+ // it as the trailing edge, or we've hit the `maxWait` limit.
305
+ return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
306
+ (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
307
+ }
308
+
309
+ function timerExpired() {
310
+ var time = now();
311
+ if (shouldInvoke(time)) {
312
+ return trailingEdge(time);
313
+ }
314
+ // Restart the timer.
315
+ timerId = setTimeout(timerExpired, remainingWait(time));
316
+ }
317
+
318
+ function trailingEdge(time) {
319
+ timerId = undefined;
320
+
321
+ // Only invoke if we have `lastArgs` which means `func` has been
322
+ // debounced at least once.
323
+ if (trailing && lastArgs) {
324
+ return invokeFunc(time);
325
+ }
326
+ lastArgs = lastThis = undefined;
327
+ return result;
328
+ }
329
+
330
+ function cancel() {
331
+ if (timerId !== undefined) {
332
+ clearTimeout(timerId);
333
+ }
334
+ lastInvokeTime = 0;
335
+ lastArgs = lastCallTime = lastThis = timerId = undefined;
336
+ }
337
+
338
+ function flush() {
339
+ return timerId === undefined ? result : trailingEdge(now());
340
+ }
341
+
342
+ function debounced() {
343
+ var time = now(),
344
+ isInvoking = shouldInvoke(time);
345
+
346
+ lastArgs = arguments;
347
+ lastThis = this;
348
+ lastCallTime = time;
349
+
350
+ if (isInvoking) {
351
+ if (timerId === undefined) {
352
+ return leadingEdge(lastCallTime);
353
+ }
354
+ if (maxing) {
355
+ // Handle invocations in a tight loop.
356
+ timerId = setTimeout(timerExpired, wait);
357
+ return invokeFunc(lastCallTime);
358
+ }
359
+ }
360
+ if (timerId === undefined) {
361
+ timerId = setTimeout(timerExpired, wait);
362
+ }
363
+ return result;
364
+ }
365
+ debounced.cancel = cancel;
366
+ debounced.flush = flush;
367
+ return debounced;
368
+ }
369
+
370
+ /**
371
+ * Creates a throttled function that only invokes `func` at most once per
372
+ * every `wait` milliseconds. The throttled function comes with a `cancel`
373
+ * method to cancel delayed `func` invocations and a `flush` method to
374
+ * immediately invoke them. Provide `options` to indicate whether `func`
375
+ * should be invoked on the leading and/or trailing edge of the `wait`
376
+ * timeout. The `func` is invoked with the last arguments provided to the
377
+ * throttled function. Subsequent calls to the throttled function return the
378
+ * result of the last `func` invocation.
379
+ *
380
+ * **Note:** If `leading` and `trailing` options are `true`, `func` is
381
+ * invoked on the trailing edge of the timeout only if the throttled function
382
+ * is invoked more than once during the `wait` timeout.
383
+ *
384
+ * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
385
+ * until to the next tick, similar to `setTimeout` with a timeout of `0`.
386
+ *
387
+ * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
388
+ * for details over the differences between `_.throttle` and `_.debounce`.
389
+ *
390
+ * @static
391
+ * @memberOf _
392
+ * @since 0.1.0
393
+ * @category Function
394
+ * @param {Function} func The function to throttle.
395
+ * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
396
+ * @param {Object} [options={}] The options object.
397
+ * @param {boolean} [options.leading=true]
398
+ * Specify invoking on the leading edge of the timeout.
399
+ * @param {boolean} [options.trailing=true]
400
+ * Specify invoking on the trailing edge of the timeout.
401
+ * @returns {Function} Returns the new throttled function.
402
+ * @example
403
+ *
404
+ * // Avoid excessively updating the position while scrolling.
405
+ * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
406
+ *
407
+ * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
408
+ * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
409
+ * jQuery(element).on('click', throttled);
410
+ *
411
+ * // Cancel the trailing throttled invocation.
412
+ * jQuery(window).on('popstate', throttled.cancel);
413
+ */
414
+ function throttle(func, wait, options) {
415
+ var leading = true,
416
+ trailing = true;
417
+
418
+ if (typeof func != 'function') {
419
+ throw new TypeError(FUNC_ERROR_TEXT);
420
+ }
421
+ if (isObject(options)) {
422
+ leading = 'leading' in options ? !!options.leading : leading;
423
+ trailing = 'trailing' in options ? !!options.trailing : trailing;
424
+ }
425
+ return debounce(func, wait, {
426
+ 'leading': leading,
427
+ 'maxWait': wait,
428
+ 'trailing': trailing
429
+ });
430
+ }
431
+
432
+ /**
433
+ * Checks if `value` is the
434
+ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
435
+ * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
436
+ *
437
+ * @static
438
+ * @memberOf _
439
+ * @since 0.1.0
440
+ * @category Lang
441
+ * @param {*} value The value to check.
442
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
443
+ * @example
444
+ *
445
+ * _.isObject({});
446
+ * // => true
447
+ *
448
+ * _.isObject([1, 2, 3]);
449
+ * // => true
450
+ *
451
+ * _.isObject(_.noop);
452
+ * // => true
453
+ *
454
+ * _.isObject(null);
455
+ * // => false
456
+ */
457
+ function isObject(value) {
458
+ var type = typeof value;
459
+ return !!value && (type == 'object' || type == 'function');
460
+ }
461
+
462
+ /**
463
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
464
+ * and has a `typeof` result of "object".
465
+ *
466
+ * @static
467
+ * @memberOf _
468
+ * @since 4.0.0
469
+ * @category Lang
470
+ * @param {*} value The value to check.
471
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
472
+ * @example
473
+ *
474
+ * _.isObjectLike({});
475
+ * // => true
476
+ *
477
+ * _.isObjectLike([1, 2, 3]);
478
+ * // => true
479
+ *
480
+ * _.isObjectLike(_.noop);
481
+ * // => false
482
+ *
483
+ * _.isObjectLike(null);
484
+ * // => false
485
+ */
486
+ function isObjectLike(value) {
487
+ return !!value && typeof value == 'object';
488
+ }
489
+
490
+ /**
491
+ * Checks if `value` is classified as a `Symbol` primitive or object.
492
+ *
493
+ * @static
494
+ * @memberOf _
495
+ * @since 4.0.0
496
+ * @category Lang
497
+ * @param {*} value The value to check.
498
+ * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
499
+ * @example
500
+ *
501
+ * _.isSymbol(Symbol.iterator);
502
+ * // => true
503
+ *
504
+ * _.isSymbol('abc');
505
+ * // => false
506
+ */
507
+ function isSymbol(value) {
508
+ return typeof value == 'symbol' ||
509
+ (isObjectLike(value) && objectToString.call(value) == symbolTag);
510
+ }
511
+
512
+ /**
513
+ * Converts `value` to a number.
514
+ *
515
+ * @static
516
+ * @memberOf _
517
+ * @since 4.0.0
518
+ * @category Lang
519
+ * @param {*} value The value to process.
520
+ * @returns {number} Returns the number.
521
+ * @example
522
+ *
523
+ * _.toNumber(3.2);
524
+ * // => 3.2
525
+ *
526
+ * _.toNumber(Number.MIN_VALUE);
527
+ * // => 5e-324
528
+ *
529
+ * _.toNumber(Infinity);
530
+ * // => Infinity
531
+ *
532
+ * _.toNumber('3.2');
533
+ * // => 3.2
534
+ */
535
+ function toNumber(value) {
536
+ if (typeof value == 'number') {
537
+ return value;
538
+ }
539
+ if (isSymbol(value)) {
540
+ return NAN;
541
+ }
542
+ if (isObject(value)) {
543
+ var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
544
+ value = isObject(other) ? (other + '') : other;
545
+ }
546
+ if (typeof value != 'string') {
547
+ return value === 0 ? value : +value;
548
+ }
549
+ value = value.replace(reTrim, '');
550
+ var isBinary = reIsBinary.test(value);
551
+ return (isBinary || reIsOctal.test(value))
552
+ ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
553
+ : (reIsBadHex.test(value) ? NAN : +value);
554
+ }
555
+
556
+ var lodash_throttle = throttle;
557
+
558
+ /**
559
+ * Force component re-rendering
560
+ *
561
+ * @see https://reactjs.org/docs/hooks-faq.html#is-there-something-like-forceupdate
562
+ */
563
+ function useForceUpdate() {
564
+ // eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-unused-vars
565
+ const [_, forceUpdate] = useReducer(x => x + 1, 0);
566
+ const forceDebouncedUpdate = useMemo(() => lodash_throttle(forceUpdate, 500), [forceUpdate]);
567
+ return { forceDebouncedUpdate, forceUpdate };
568
+ }
569
+
570
+ var dayjs_min = {exports: {}};
571
+
572
+ var hasRequiredDayjs_min;
573
+
574
+ function requireDayjs_min () {
575
+ if (hasRequiredDayjs_min) return dayjs_min.exports;
576
+ hasRequiredDayjs_min = 1;
577
+ (function (module, exports) {
578
+ !function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",f="month",h="quarter",c="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,f),s=n-i<0,u=e.clone().add(r+(s?-1:1),f);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:f,y:c,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:h}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p=function(t){return t instanceof _},S=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},w=function(t,e){if(p(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},O=v;O.l=S,O.i=p,O.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=S(t.locale,null,!0),this.parse(t);}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(O.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return O},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return w(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<w(t)},m.$g=function(t,e,n){return O.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!O.u(e)||e,h=O.p(t),l=function(t,e){var i=O.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return O.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(h){case c:return r?l(1,0):l(31,11);case f:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=O.p(t),h="set"+(this.$u?"UTC":""),l=(n={},n[a]=h+"Date",n[d]=h+"Date",n[f]=h+"Month",n[c]=h+"FullYear",n[u]=h+"Hours",n[s]=h+"Minutes",n[i]=h+"Seconds",n[r]=h+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===f||o===c){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[O.p(t)]()},m.add=function(r,h){var d,l=this;r=Number(r);var $=O.p(h),y=function(t){var e=w(l);return O.w(e.date(e.date()+Math.round(t*r)),l)};if($===f)return this.set(f,this.$M+r);if($===c)return this.set(c,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return O.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=O.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,f=n.months,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},c=function(t){return O.s(s%12||12,t,"0")},d=n.meridiem||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r},$={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:O.s(a+1,2,"0"),MMM:h(n.monthsShort,a,f,3),MMMM:h(f,a),D:this.$D,DD:O.s(this.$D,2,"0"),d:String(this.$W),dd:h(n.weekdaysMin,this.$W,o,2),ddd:h(n.weekdaysShort,this.$W,o,3),dddd:o[this.$W],H:String(s),HH:O.s(s,2,"0"),h:c(1),hh:c(2),a:d(s,u,!0),A:d(s,u,!1),m:String(u),mm:O.s(u,2,"0"),s:String(this.$s),ss:O.s(this.$s,2,"0"),SSS:O.s(this.$ms,3,"0"),Z:i};return r.replace(y,(function(t,e){return e||$[t]||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=O.p(d),M=w(r),m=(M.utcOffset()-this.utcOffset())*e,v=this-M,g=O.m(this,M);return g=($={},$[c]=g/12,$[f]=g,$[h]=g/3,$[o]=(v-m)/6048e5,$[a]=(v-m)/864e5,$[u]=v/n,$[s]=v/e,$[i]=v/t,$)[y]||v,l?g:O.a(g)},m.daysInMonth=function(){return this.endOf(f).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=S(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return O.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),T=_.prototype;return w.prototype=T,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",f],["$y",c],["$D",d]].forEach((function(t){T[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),w.extend=function(t,e){return t.$i||(t(e,_,w),t.$i=!0),w},w.locale=S,w.isDayjs=p,w.unix=function(t){return w(1e3*t)},w.en=D[g],w.Ls=D,w.p={},w}));
579
+ } (dayjs_min));
580
+ return dayjs_min.exports;
581
+ }
582
+
583
+ var dayjs_minExports = requireDayjs_min();
584
+
585
+ var timezone$1 = {exports: {}};
586
+
587
+ (function (module, exports) {
588
+ !function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t={year:0,month:1,day:2,hour:3,minute:4,second:5},e={};return function(n,i,o){var r,a=function(t,n,i){void 0===i&&(i={});var o=new Date(t),r=function(t,n){void 0===n&&(n={});var i=n.timeZoneName||"short",o=t+"|"+i,r=e[o];return r||(r=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:i}),e[o]=r),r}(n,i);return r.formatToParts(o)},u=function(e,n){for(var i=a(e,n),r=[],u=0;u<i.length;u+=1){var f=i[u],s=f.type,m=f.value,c=t[s];c>=0&&(r[c]=parseInt(m,10));}var d=r[3],l=24===d?0:d,v=r[0]+"-"+r[1]+"-"+r[2]+" "+l+":"+r[4]+":"+r[5]+":000",h=+e;return (o.utc(v).valueOf()-(h-=h%1e3))/6e4},f=i.prototype;f.tz=function(t,e){void 0===t&&(t=r);var n=this.utcOffset(),i=this.toDate(),a=i.toLocaleString("en-US",{timeZone:t}),u=Math.round((i-new Date(a))/1e3/60),f=o(a).$set("millisecond",this.$ms).utcOffset(15*-Math.round(i.getTimezoneOffset()/15)-u,!0);if(e){var s=f.utcOffset();f=f.add(n-s,"minute");}return f.$x.$timezone=t,f},f.offsetName=function(t){var e=this.$x.$timezone||o.tz.guess(),n=a(this.valueOf(),e,{timeZoneName:t}).find((function(t){return "timezonename"===t.type.toLowerCase()}));return n&&n.value};var s=f.startOf;f.startOf=function(t,e){if(!this.$x||!this.$x.$timezone)return s.call(this,t,e);var n=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"));return s.call(n,t,e).tz(this.$x.$timezone,!0)},o.tz=function(t,e,n){var i=n&&e,a=n||e||r,f=u(+o(),a);if("string"!=typeof t)return o(t).tz(a);var s=function(t,e,n){var i=t-60*e*1e3,o=u(i,n);if(e===o)return [i,e];var r=u(i-=60*(o-e)*1e3,n);return o===r?[i,o]:[t-60*Math.min(o,r)*1e3,Math.max(o,r)]}(o.utc(t,i).valueOf(),f,a),m=s[0],c=s[1],d=o(m).utcOffset(c);return d.$x.$timezone=a,d},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(t){r=t;};}}));
589
+ } (timezone$1));
590
+
591
+ var timezone = timezone$1.exports;
592
+
593
+ var utc$1 = {exports: {}};
594
+
595
+ (function (module, exports) {
596
+ !function(t,i){module.exports=i();}(commonjsGlobal,(function(){var t="minute",i=/[+-]\d\d(?::?\d\d)?/g,e=/([+-]|\d\d)/g;return function(s,f,n){var u=f.prototype;n.utc=function(t){var i={date:t,utc:!0,args:arguments};return new f(i)},u.utc=function(i){var e=n(this.toDate(),{locale:this.$L,utc:!0});return i?e.add(this.utcOffset(),t):e},u.local=function(){return n(this.toDate(),{locale:this.$L,utc:!1})};var o=u.parse;u.parse=function(t){t.utc&&(this.$u=!0),this.$utils().u(t.$offset)||(this.$offset=t.$offset),o.call(this,t);};var r=u.init;u.init=function(){if(this.$u){var t=this.$d;this.$y=t.getUTCFullYear(),this.$M=t.getUTCMonth(),this.$D=t.getUTCDate(),this.$W=t.getUTCDay(),this.$H=t.getUTCHours(),this.$m=t.getUTCMinutes(),this.$s=t.getUTCSeconds(),this.$ms=t.getUTCMilliseconds();}else r.call(this);};var a=u.utcOffset;u.utcOffset=function(s,f){var n=this.$utils().u;if(n(s))return this.$u?0:n(this.$offset)?a.call(this):this.$offset;if("string"==typeof s&&(s=function(t){void 0===t&&(t="");var s=t.match(i);if(!s)return null;var f=(""+s[0]).match(e)||["-",0,0],n=f[0],u=60*+f[1]+ +f[2];return 0===u?0:"+"===n?u:-u}(s),null===s))return this;var u=Math.abs(s)<=16?60*s:s,o=this;if(f)return o.$offset=u,o.$u=0===s,o;if(0!==s){var r=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(o=this.local().add(u+r,t)).$offset=u,o.$x.$localOffset=r;}else o=this.utc();return o};var h=u.format;u.format=function(t){var i=t||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return h.call(this,i)},u.valueOf=function(){var t=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*t},u.isUTC=function(){return !!this.$u},u.toISOString=function(){return this.toDate().toISOString()},u.toString=function(){return this.toDate().toUTCString()};var l=u.toDate;u.toDate=function(t){return "s"===t&&this.$offset?n(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():l.call(this)};var c=u.diff;u.diff=function(t,i,e){if(t&&this.$u===t.$u)return c.call(this,t,i,e);var s=this.local(),f=n(t).local();return c.call(s,f,i,e)};}}));
597
+ } (utc$1));
598
+
599
+ var utc = utc$1.exports;
600
+
601
+ var fr$1 = {exports: {}};
602
+
603
+ (function (module, exports) {
604
+ !function(e,n){module.exports=n(requireDayjs_min());}(commonjsGlobal,(function(e){function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=n(e),i={name:"fr",weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"di_lu_ma_me_je_ve_sa".split("_"),months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},ordinal:function(e){return ""+e+(1===e?"er":"")}};return t.default.locale(i,null,!0),i}));
605
+ } (fr$1));
606
+
607
+ dayjs_minExports.extend(timezone);
608
+ dayjs_minExports.extend(utc);
609
+ dayjs_minExports.locale('fr');
610
+ dayjs_minExports.tz.setDefault('UTC');
611
+
612
+ // TODO Use `date-fns` instead of `dayjs`.
613
+ /**
614
+ * Get a Dayjs instance of a UTC date treated as if it was a locally timezoned one
615
+ *
616
+ * @example
617
+ * `2022-01-02T03:04:05.006Z` => `2022-01-02T03:04:05.006+01:00` (or `+02:00` during DST) in Europe/Paris timezone.
618
+ */
619
+ function getLocalizedDayjs(utcDate) {
620
+ // The number of minutes returned by getTimezoneOffset() is positive if the local time zone is behind UTC,
621
+ // and negative if the local time zone is ahead of UTC. For example, for UTC+10, -600 will be returned.
622
+ const timezoneOffsetInMinutes = utcDate.getTimezoneOffset();
623
+ return dayjs_minExports(utcDate).add(timezoneOffsetInMinutes, 'minutes');
624
+ }
625
+
626
+ // TODO Use `date-fns` instead of `dayjs`.
627
+ /**
628
+ * Get a Dayjs instance of a locally timezoned date treated as if it was a UTC one
629
+ *
630
+ * @example
631
+ * `2022-01-02T03:04:05.006+01:00` => `2022-01-02T03:04:05.006Z`.
632
+ */
633
+ function getUtcizedDayjs(localDate) {
634
+ const definedLocalDate = localDate || new Date();
635
+ // The number of minutes returned by getTimezoneOffset() is positive if the local time zone is behind UTC,
636
+ // and negative if the local time zone is ahead of UTC. For example, for UTC+10, -600 will be returned.
637
+ const timezoneOffsetInMinutes = definedLocalDate.getTimezoneOffset();
638
+ return dayjs_minExports(definedLocalDate).subtract(timezoneOffsetInMinutes, 'minutes');
639
+ }
640
+
641
+ function NumberInputWithRef({ defaultValue, max, min, onBack, onClick, onFilled, onFocus, onFormatError, onInput, onNext, onPrevious, size, ...nativeProps }, ref) {
642
+ const inputRef = useRef();
643
+ const placeholder = useMemo(() => '-'.repeat(size), [size]);
644
+ useImperativeHandle(ref, () => inputRef.current);
645
+ const handleClick = useCallback((event) => {
646
+ // event.stopPropagation()
647
+ if (onClick) {
648
+ onClick(event);
649
+ }
650
+ }, [onClick]);
651
+ const handleFocus = useCallback((event) => {
652
+ inputRef.current.select();
653
+ if (onFocus) {
654
+ onFocus(event);
655
+ }
656
+ }, [onFocus]);
657
+ const handleInput = useCallback(() => {
658
+ onFormatError(false);
659
+ const { value } = inputRef.current;
660
+ if (onInput) {
661
+ onInput(value);
662
+ }
663
+ if (value.length !== size) {
664
+ return;
665
+ }
666
+ const valueAsNumber = Number(inputRef.current.value);
667
+ if (Number.isNaN(valueAsNumber) || valueAsNumber < min || valueAsNumber > max) {
668
+ onFormatError(true);
669
+ return;
670
+ }
671
+ if (onFilled && value.length === size) {
672
+ onFilled();
673
+ }
674
+ }, [max, min, onFilled, onFormatError, onInput, size]);
675
+ const handleKeyDown = useCallback((event) => {
676
+ if (onPrevious &&
677
+ event.key === 'ArrowLeft' &&
678
+ inputRef.current.selectionStart === 0 &&
679
+ // We don't want to call that function when the user is selecting the input text
680
+ inputRef.current.selectionEnd === inputRef.current.selectionStart) {
681
+ event.preventDefault();
682
+ onPrevious();
683
+ return;
684
+ }
685
+ if (onNext &&
686
+ event.key === 'ArrowRight' &&
687
+ inputRef.current.selectionStart === inputRef.current.value.length &&
688
+ // We don't want to call that function when the user is selecting the input text
689
+ inputRef.current.selectionEnd === inputRef.current.selectionStart) {
690
+ event.preventDefault();
691
+ onNext();
692
+ return;
693
+ }
694
+ if (onBack && event.key === 'Backspace' && !inputRef.current.value.length) {
695
+ event.preventDefault();
696
+ onBack();
697
+ }
698
+ }, [onBack, onNext, onPrevious]);
699
+ return (jsx(StyledNumberInput, { ref: inputRef, defaultValue: defaultValue, maxLength: size, onClick: handleClick, onFocus: handleFocus, onInput: handleInput, onKeyDown: handleKeyDown, pattern: "\\d*", placeholder: placeholder, size: size, type: "text", ...nativeProps }, String(defaultValue)));
700
+ }
701
+ const NumberInput = forwardRef(NumberInputWithRef);
702
+ const StyledNumberInput = styled.input `
703
+ background-color: transparent;
704
+ border: 0;
705
+ font-size: inherit;
706
+ outline: none;
707
+ padding: 0;
708
+ text-align: center;
709
+ /* 1 digit = 0.5rem */
710
+ width: ${p => p.size * 0.5}rem;
711
+
712
+ ::placeholder {
713
+ color: ${p => p.theme.color.slateGray};
714
+ }
715
+ `;
716
+
717
+ // TODO Use `date-fns` instead of `dayjs`.
718
+ function formatNumberAsDoubleDigit(numberLike) {
719
+ return String(numberLike).padStart(2, '0');
720
+ }
721
+ function getDateFromDateAndTimeTuple(dateTuple, timeTuple, isEnd = false) {
722
+ const [year, month, day] = dateTuple;
723
+ const [hour, minute] = timeTuple;
724
+ const rawDateAsDayjs = dayjs_minExports()
725
+ .year(Number(year))
726
+ .month(Number(month) - 1)
727
+ .date(Number(day))
728
+ .hour(Number(hour))
729
+ .minute(Number(minute));
730
+ return isEnd
731
+ ? rawDateAsDayjs
732
+ .endOf('minute')
733
+ // TODO For some reason the API can't handle miliseconds in dates.
734
+ // That's why we set it to 0 (instead of 999)
735
+ .millisecond(0)
736
+ .toDate()
737
+ : rawDateAsDayjs.startOf('minute').toDate();
738
+ }
739
+ function getDateTupleFromDate(date) {
740
+ if (!date) {
741
+ return undefined;
742
+ }
743
+ return [
744
+ String(date.getFullYear()),
745
+ formatNumberAsDoubleDigit(date.getMonth() + 1),
746
+ formatNumberAsDoubleDigit(date.getDate())
747
+ ];
748
+ }
749
+ /**
750
+ * Generate a list of ranged time options.
751
+ *
752
+ * @example
753
+ * ```
754
+ * (minutesRange = 30) => ([
755
+ * { label: '00:00', value: ['00', '00'] },
756
+ * { label: '00:30', value: ['00', '30'] },
757
+ * { label: '01:00', value: ['01', '00'] },
758
+ * { label: '01:30', value: ['01', '30'] },
759
+ * { label: '02:00', value: ['02', '00'] },
760
+ * ...
761
+ * ])
762
+ * ```
763
+ */
764
+ const getRangedTimeOptions = (minutesRange) => {
765
+ const perHourOptionsLength = 60 / minutesRange;
766
+ const totalOptionsLength = 24 * perHourOptionsLength;
767
+ return new Array(totalOptionsLength).fill(undefined).map((_, index) => {
768
+ const hour = Math.floor(index / perHourOptionsLength);
769
+ const minute = minutesRange * (index % perHourOptionsLength);
770
+ const label = `${String(hour).padStart(2, '0')}:${String(minute).padStart(2, '0')}`;
771
+ const value = [formatNumberAsDoubleDigit(hour), formatNumberAsDoubleDigit(minute)];
772
+ return {
773
+ label,
774
+ value
775
+ };
776
+ });
777
+ };
778
+ function getTimeTupleFromDate(date) {
779
+ if (!date) {
780
+ return undefined;
781
+ }
782
+ return [formatNumberAsDoubleDigit(date.getHours()), formatNumberAsDoubleDigit(date.getMinutes())];
783
+ }
784
+
785
+ function DateInputWithRef({ defaultValue, isEndDate = false, isForcedFocused, isStartDate = false, onBack, onChange, onClick, onNext, onPrevious }, ref) {
786
+ const boxSpanRef = useRef();
787
+ const dayInputRef = useRef();
788
+ const monthInputRef = useRef();
789
+ const yearInputRef = useRef();
790
+ const [hasFormatError, setHasFormatError] = useState(false);
791
+ const [hasValidationError, setHasValidationError] = useState(false);
792
+ const [isFocused, setIsFocused] = useState(false);
793
+ useImperativeHandle(ref, () => ({
794
+ boxSpan: boxSpanRef.current,
795
+ focus: (isInLastInputOfTheGroup = false) => {
796
+ if (isInLastInputOfTheGroup) {
797
+ yearInputRef.current.focus();
798
+ }
799
+ else {
800
+ dayInputRef.current.focus();
801
+ }
802
+ }
803
+ }));
804
+ const currentUtcYear = useMemo(() => getUtcizedDayjs().year(), []);
805
+ const handleBlur = useCallback(() => {
806
+ setIsFocused(false);
807
+ }, []);
808
+ const handleFocus = useCallback(() => {
809
+ setIsFocused(true);
810
+ }, []);
811
+ const handleFormatError = useCallback((hasNextFormatError) => {
812
+ setHasFormatError(hasNextFormatError);
813
+ }, []);
814
+ const submit = useCallback(() => {
815
+ setHasValidationError(false);
816
+ switch (window.document.activeElement) {
817
+ case dayInputRef.current:
818
+ monthInputRef.current.focus();
819
+ break;
820
+ case monthInputRef.current:
821
+ yearInputRef.current.focus();
822
+ break;
823
+ }
824
+ if (!yearInputRef.current.value.length ||
825
+ !monthInputRef.current.value.length ||
826
+ !dayInputRef.current.value.length) {
827
+ if ((monthInputRef.current.value.length && !dayInputRef.current.value.length) ||
828
+ (yearInputRef.current.value.length &&
829
+ (!dayInputRef.current.value.length || !monthInputRef.current.value.length))) {
830
+ setHasValidationError(true);
831
+ }
832
+ return;
833
+ }
834
+ const nextDateTuple = [
835
+ String(yearInputRef.current.value),
836
+ formatNumberAsDoubleDigit(monthInputRef.current.value),
837
+ formatNumberAsDoubleDigit(dayInputRef.current.value)
838
+ ];
839
+ onChange(nextDateTuple);
840
+ }, [onChange]);
841
+ return (jsxs(Box$6, { ref: boxSpanRef, hasError: hasFormatError || hasValidationError, isFocused: isForcedFocused || isFocused, children: [isStartDate && 'Du ', isEndDate && 'Au ', jsx(NumberInput, { ref: dayInputRef, "data-cy": `date-range-picker-${isStartDate ? 'start' : 'end'}-day`, defaultValue: defaultValue && formatNumberAsDoubleDigit(defaultValue[2]), max: 31, min: 1, onBack: onBack, onBlur: handleBlur, onClick: onClick, onFilled: submit, onFocus: handleFocus, onFormatError: handleFormatError, onNext: () => monthInputRef.current.focus(), onPrevious: onPrevious, size: 2 }), "/", jsx(NumberInput, { ref: monthInputRef, "data-cy": `date-range-picker-${isStartDate ? 'start' : 'end'}-month`, defaultValue: defaultValue && formatNumberAsDoubleDigit(defaultValue[1]), max: 12, min: 1, onBack: () => dayInputRef.current.focus(), onBlur: handleBlur, onClick: onClick, onFilled: submit, onFocus: handleFocus, onFormatError: handleFormatError, onNext: () => yearInputRef.current.focus(), onPrevious: () => dayInputRef.current.focus(), size: 2 }), "/", jsx(NumberInput, { ref: yearInputRef, "data-cy": `date-range-picker-${isStartDate ? 'start' : 'end'}-year`, defaultValue: defaultValue && defaultValue[0], max: currentUtcYear, min: 2020, onBack: () => monthInputRef.current.focus(), onBlur: handleBlur, onClick: onClick, onFilled: submit, onFocus: handleFocus, onFormatError: handleFormatError, onNext: onNext, onPrevious: () => monthInputRef.current.focus(), size: 4 })] }));
842
+ }
843
+ const DateInput = forwardRef(DateInputWithRef);
844
+ const Box$6 = styled.span `
845
+ background-color: ${p => p.theme.color.gainsboro};
846
+ box-shadow: ${p => p.hasError || p.isFocused
847
+ ? `inset 0px 0px 0px 1px ${p.hasError ? p.theme.color.maximumRed : p.theme.color.blueGray[100]}`
848
+ : 'none'};
849
+ color: ${p => p.theme.color.slateGray};
850
+ display: inline-block;
851
+ font-size: inherit;
852
+ padding: 0.3125rem 0.5rem 0.4375rem;
853
+ user-select: none;
854
+
855
+ :hover {
856
+ box-shadow: ${p => `inset 0px 0px 0px 1px ${p.theme.color.blueYonder[100]}`};
857
+ }
858
+ `;
859
+
860
+ /**
861
+ * Capitalize the first letter of a string
862
+ */
863
+ function capitalizeFirstLetter(text) {
864
+ return text.charAt(0).toUpperCase() + text.slice(1);
865
+ }
866
+
867
+ function getUtcDayjs() {
868
+ return dayjs_minExports().utc();
869
+ }
870
+
871
+ function sortDates(dates) {
872
+ return dates
873
+ .map(date => date.toISOString())
874
+ .sort()
875
+ .map(dateAsIsoString => dayjs_minExports(dateAsIsoString).toDate());
876
+ }
877
+
878
+ function stopMouseEventPropagation(event) {
879
+ event.stopPropagation();
880
+ }
881
+
882
+ var formatDistanceLocale = {
883
+ lessThanXSeconds: {
884
+ one: 'moins d’une seconde',
885
+ other: 'moins de {{count}} secondes'
886
+ },
887
+ xSeconds: {
888
+ one: '1 seconde',
889
+ other: '{{count}} secondes'
890
+ },
891
+ halfAMinute: '30 secondes',
892
+ lessThanXMinutes: {
893
+ one: 'moins d’une minute',
894
+ other: 'moins de {{count}} minutes'
895
+ },
896
+ xMinutes: {
897
+ one: '1 minute',
898
+ other: '{{count}} minutes'
899
+ },
900
+ aboutXHours: {
901
+ one: 'environ 1 heure',
902
+ other: 'environ {{count}} heures'
903
+ },
904
+ xHours: {
905
+ one: '1 heure',
906
+ other: '{{count}} heures'
907
+ },
908
+ xDays: {
909
+ one: '1 jour',
910
+ other: '{{count}} jours'
911
+ },
912
+ aboutXWeeks: {
913
+ one: 'environ 1 semaine',
914
+ other: 'environ {{count}} semaines'
915
+ },
916
+ xWeeks: {
917
+ one: '1 semaine',
918
+ other: '{{count}} semaines'
919
+ },
920
+ aboutXMonths: {
921
+ one: 'environ 1 mois',
922
+ other: 'environ {{count}} mois'
923
+ },
924
+ xMonths: {
925
+ one: '1 mois',
926
+ other: '{{count}} mois'
927
+ },
928
+ aboutXYears: {
929
+ one: 'environ 1 an',
930
+ other: 'environ {{count}} ans'
931
+ },
932
+ xYears: {
933
+ one: '1 an',
934
+ other: '{{count}} ans'
935
+ },
936
+ overXYears: {
937
+ one: 'plus d’un an',
938
+ other: 'plus de {{count}} ans'
939
+ },
940
+ almostXYears: {
941
+ one: 'presqu’un an',
942
+ other: 'presque {{count}} ans'
943
+ }
944
+ };
945
+
946
+ var formatDistance = function formatDistance(token, count, options) {
947
+ var result;
948
+ var form = formatDistanceLocale[token];
949
+
950
+ if (typeof form === 'string') {
951
+ result = form;
952
+ } else if (count === 1) {
953
+ result = form.one;
954
+ } else {
955
+ result = form.other.replace('{{count}}', String(count));
956
+ }
957
+
958
+ if (options !== null && options !== void 0 && options.addSuffix) {
959
+ if (options.comparison && options.comparison > 0) {
960
+ return 'dans ' + result;
961
+ } else {
962
+ return 'il y a ' + result;
963
+ }
964
+ }
965
+
966
+ return result;
967
+ };
968
+
969
+ function buildFormatLongFn(args) {
970
+ return function () {
971
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
972
+ // TODO: Remove String()
973
+ var width = options.width ? String(options.width) : args.defaultWidth;
974
+ var format = args.formats[width] || args.formats[args.defaultWidth];
975
+ return format;
976
+ };
977
+ }
978
+
979
+ var dateFormats = {
980
+ full: 'EEEE d MMMM y',
981
+ long: 'd MMMM y',
982
+ medium: 'd MMM y',
983
+ short: 'dd/MM/y'
984
+ };
985
+ var timeFormats = {
986
+ full: 'HH:mm:ss zzzz',
987
+ long: 'HH:mm:ss z',
988
+ medium: 'HH:mm:ss',
989
+ short: 'HH:mm'
990
+ };
991
+ var dateTimeFormats = {
992
+ full: "{{date}} 'à' {{time}}",
993
+ long: "{{date}} 'à' {{time}}",
994
+ medium: '{{date}}, {{time}}',
995
+ short: '{{date}}, {{time}}'
996
+ };
997
+ var formatLong = {
998
+ date: buildFormatLongFn({
999
+ formats: dateFormats,
1000
+ defaultWidth: 'full'
1001
+ }),
1002
+ time: buildFormatLongFn({
1003
+ formats: timeFormats,
1004
+ defaultWidth: 'full'
1005
+ }),
1006
+ dateTime: buildFormatLongFn({
1007
+ formats: dateTimeFormats,
1008
+ defaultWidth: 'full'
1009
+ })
1010
+ };
1011
+
1012
+ var formatRelativeLocale = {
1013
+ lastWeek: "eeee 'dernier à' p",
1014
+ yesterday: "'hier à' p",
1015
+ today: "'aujourd’hui à' p",
1016
+ tomorrow: "'demain à' p'",
1017
+ nextWeek: "eeee 'prochain à' p",
1018
+ other: 'P'
1019
+ };
1020
+
1021
+ var formatRelative = function formatRelative(token, _date, _baseDate, _options) {
1022
+ return formatRelativeLocale[token];
1023
+ };
1024
+
1025
+ function buildLocalizeFn(args) {
1026
+ return function (dirtyIndex, options) {
1027
+ var context = options !== null && options !== void 0 && options.context ? String(options.context) : 'standalone';
1028
+ var valuesArray;
1029
+
1030
+ if (context === 'formatting' && args.formattingValues) {
1031
+ var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
1032
+ var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
1033
+ valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
1034
+ } else {
1035
+ var _defaultWidth = args.defaultWidth;
1036
+
1037
+ var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
1038
+
1039
+ valuesArray = args.values[_width] || args.values[_defaultWidth];
1040
+ }
1041
+
1042
+ var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex; // @ts-ignore: For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!
1043
+
1044
+ return valuesArray[index];
1045
+ };
1046
+ }
1047
+
1048
+ var eraValues = {
1049
+ narrow: ['av. J.-C', 'ap. J.-C'],
1050
+ abbreviated: ['av. J.-C', 'ap. J.-C'],
1051
+ wide: ['avant Jésus-Christ', 'après Jésus-Christ']
1052
+ };
1053
+ var quarterValues = {
1054
+ narrow: ['T1', 'T2', 'T3', 'T4'],
1055
+ abbreviated: ['1er trim.', '2ème trim.', '3ème trim.', '4ème trim.'],
1056
+ wide: ['1er trimestre', '2ème trimestre', '3ème trimestre', '4ème trimestre']
1057
+ };
1058
+ var monthValues = {
1059
+ narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
1060
+ abbreviated: ['janv.', 'févr.', 'mars', 'avr.', 'mai', 'juin', 'juil.', 'août', 'sept.', 'oct.', 'nov.', 'déc.'],
1061
+ wide: ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre']
1062
+ };
1063
+ var dayValues = {
1064
+ narrow: ['D', 'L', 'M', 'M', 'J', 'V', 'S'],
1065
+ short: ['di', 'lu', 'ma', 'me', 'je', 've', 'sa'],
1066
+ abbreviated: ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'],
1067
+ wide: ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi']
1068
+ };
1069
+ var dayPeriodValues = {
1070
+ narrow: {
1071
+ am: 'AM',
1072
+ pm: 'PM',
1073
+ midnight: 'minuit',
1074
+ noon: 'midi',
1075
+ morning: 'mat.',
1076
+ afternoon: 'ap.m.',
1077
+ evening: 'soir',
1078
+ night: 'mat.'
1079
+ },
1080
+ abbreviated: {
1081
+ am: 'AM',
1082
+ pm: 'PM',
1083
+ midnight: 'minuit',
1084
+ noon: 'midi',
1085
+ morning: 'matin',
1086
+ afternoon: 'après-midi',
1087
+ evening: 'soir',
1088
+ night: 'matin'
1089
+ },
1090
+ wide: {
1091
+ am: 'AM',
1092
+ pm: 'PM',
1093
+ midnight: 'minuit',
1094
+ noon: 'midi',
1095
+ morning: 'du matin',
1096
+ afternoon: 'de l’après-midi',
1097
+ evening: 'du soir',
1098
+ night: 'du matin'
1099
+ }
1100
+ };
1101
+
1102
+ var ordinalNumber = function ordinalNumber(dirtyNumber, options) {
1103
+ var number = Number(dirtyNumber);
1104
+ var unit = options === null || options === void 0 ? void 0 : options.unit;
1105
+ if (number === 0) return '0';
1106
+ var feminineUnits = ['year', 'week', 'hour', 'minute', 'second'];
1107
+ var suffix;
1108
+
1109
+ if (number === 1) {
1110
+ suffix = unit && feminineUnits.includes(unit) ? 'ère' : 'er';
1111
+ } else {
1112
+ suffix = 'ème';
1113
+ }
1114
+
1115
+ return number + suffix;
1116
+ };
1117
+
1118
+ var localize = {
1119
+ ordinalNumber: ordinalNumber,
1120
+ era: buildLocalizeFn({
1121
+ values: eraValues,
1122
+ defaultWidth: 'wide'
1123
+ }),
1124
+ quarter: buildLocalizeFn({
1125
+ values: quarterValues,
1126
+ defaultWidth: 'wide',
1127
+ argumentCallback: function argumentCallback(quarter) {
1128
+ return quarter - 1;
1129
+ }
1130
+ }),
1131
+ month: buildLocalizeFn({
1132
+ values: monthValues,
1133
+ defaultWidth: 'wide'
1134
+ }),
1135
+ day: buildLocalizeFn({
1136
+ values: dayValues,
1137
+ defaultWidth: 'wide'
1138
+ }),
1139
+ dayPeriod: buildLocalizeFn({
1140
+ values: dayPeriodValues,
1141
+ defaultWidth: 'wide'
1142
+ })
1143
+ };
1144
+
1145
+ function buildMatchFn(args) {
1146
+ return function (string) {
1147
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1148
+ var width = options.width;
1149
+ var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
1150
+ var matchResult = string.match(matchPattern);
1151
+
1152
+ if (!matchResult) {
1153
+ return null;
1154
+ }
1155
+
1156
+ var matchedString = matchResult[0];
1157
+ var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
1158
+ var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {
1159
+ return pattern.test(matchedString);
1160
+ }) : findKey(parsePatterns, function (pattern) {
1161
+ return pattern.test(matchedString);
1162
+ });
1163
+ var value;
1164
+ value = args.valueCallback ? args.valueCallback(key) : key;
1165
+ value = options.valueCallback ? options.valueCallback(value) : value;
1166
+ var rest = string.slice(matchedString.length);
1167
+ return {
1168
+ value: value,
1169
+ rest: rest
1170
+ };
1171
+ };
1172
+ }
1173
+
1174
+ function findKey(object, predicate) {
1175
+ for (var key in object) {
1176
+ if (object.hasOwnProperty(key) && predicate(object[key])) {
1177
+ return key;
1178
+ }
1179
+ }
1180
+
1181
+ return undefined;
1182
+ }
1183
+
1184
+ function findIndex(array, predicate) {
1185
+ for (var key = 0; key < array.length; key++) {
1186
+ if (predicate(array[key])) {
1187
+ return key;
1188
+ }
1189
+ }
1190
+
1191
+ return undefined;
1192
+ }
1193
+
1194
+ function buildMatchPatternFn(args) {
1195
+ return function (string) {
1196
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1197
+ var matchResult = string.match(args.matchPattern);
1198
+ if (!matchResult) return null;
1199
+ var matchedString = matchResult[0];
1200
+ var parseResult = string.match(args.parsePattern);
1201
+ if (!parseResult) return null;
1202
+ var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
1203
+ value = options.valueCallback ? options.valueCallback(value) : value;
1204
+ var rest = string.slice(matchedString.length);
1205
+ return {
1206
+ value: value,
1207
+ rest: rest
1208
+ };
1209
+ };
1210
+ }
1211
+
1212
+ var matchOrdinalNumberPattern = /^(\d+)(ième|ère|ème|er|e)?/i;
1213
+ var parseOrdinalNumberPattern = /\d+/i;
1214
+ var matchEraPatterns = {
1215
+ narrow: /^(av\.J\.C|ap\.J\.C|ap\.J\.-C)/i,
1216
+ abbreviated: /^(av\.J\.-C|av\.J-C|apr\.J\.-C|apr\.J-C|ap\.J-C)/i,
1217
+ wide: /^(avant Jésus-Christ|après Jésus-Christ)/i
1218
+ };
1219
+ var parseEraPatterns = {
1220
+ any: [/^av/i, /^ap/i]
1221
+ };
1222
+ var matchQuarterPatterns = {
1223
+ narrow: /^T?[1234]/i,
1224
+ abbreviated: /^[1234](er|ème|e)? trim\.?/i,
1225
+ wide: /^[1234](er|ème|e)? trimestre/i
1226
+ };
1227
+ var parseQuarterPatterns = {
1228
+ any: [/1/i, /2/i, /3/i, /4/i]
1229
+ };
1230
+ var matchMonthPatterns = {
1231
+ narrow: /^[jfmasond]/i,
1232
+ abbreviated: /^(janv|févr|mars|avr|mai|juin|juill|juil|août|sept|oct|nov|déc)\.?/i,
1233
+ wide: /^(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i
1234
+ };
1235
+ var parseMonthPatterns = {
1236
+ narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],
1237
+ any: [/^ja/i, /^f/i, /^mar/i, /^av/i, /^ma/i, /^juin/i, /^juil/i, /^ao/i, /^s/i, /^o/i, /^n/i, /^d/i]
1238
+ };
1239
+ var matchDayPatterns = {
1240
+ narrow: /^[lmjvsd]/i,
1241
+ short: /^(di|lu|ma|me|je|ve|sa)/i,
1242
+ abbreviated: /^(dim|lun|mar|mer|jeu|ven|sam)\.?/i,
1243
+ wide: /^(dimanche|lundi|mardi|mercredi|jeudi|vendredi|samedi)/i
1244
+ };
1245
+ var parseDayPatterns = {
1246
+ narrow: [/^d/i, /^l/i, /^m/i, /^m/i, /^j/i, /^v/i, /^s/i],
1247
+ any: [/^di/i, /^lu/i, /^ma/i, /^me/i, /^je/i, /^ve/i, /^sa/i]
1248
+ };
1249
+ var matchDayPeriodPatterns = {
1250
+ narrow: /^(a|p|minuit|midi|mat\.?|ap\.?m\.?|soir|nuit)/i,
1251
+ any: /^([ap]\.?\s?m\.?|du matin|de l'après[-\s]midi|du soir|de la nuit)/i
1252
+ };
1253
+ var parseDayPeriodPatterns = {
1254
+ any: {
1255
+ am: /^a/i,
1256
+ pm: /^p/i,
1257
+ midnight: /^min/i,
1258
+ noon: /^mid/i,
1259
+ morning: /mat/i,
1260
+ afternoon: /ap/i,
1261
+ evening: /soir/i,
1262
+ night: /nuit/i
1263
+ }
1264
+ };
1265
+ var match = {
1266
+ ordinalNumber: buildMatchPatternFn({
1267
+ matchPattern: matchOrdinalNumberPattern,
1268
+ parsePattern: parseOrdinalNumberPattern,
1269
+ valueCallback: function valueCallback(value) {
1270
+ return parseInt(value);
1271
+ }
1272
+ }),
1273
+ era: buildMatchFn({
1274
+ matchPatterns: matchEraPatterns,
1275
+ defaultMatchWidth: 'wide',
1276
+ parsePatterns: parseEraPatterns,
1277
+ defaultParseWidth: 'any'
1278
+ }),
1279
+ quarter: buildMatchFn({
1280
+ matchPatterns: matchQuarterPatterns,
1281
+ defaultMatchWidth: 'wide',
1282
+ parsePatterns: parseQuarterPatterns,
1283
+ defaultParseWidth: 'any',
1284
+ valueCallback: function valueCallback(index) {
1285
+ return index + 1;
1286
+ }
1287
+ }),
1288
+ month: buildMatchFn({
1289
+ matchPatterns: matchMonthPatterns,
1290
+ defaultMatchWidth: 'wide',
1291
+ parsePatterns: parseMonthPatterns,
1292
+ defaultParseWidth: 'any'
1293
+ }),
1294
+ day: buildMatchFn({
1295
+ matchPatterns: matchDayPatterns,
1296
+ defaultMatchWidth: 'wide',
1297
+ parsePatterns: parseDayPatterns,
1298
+ defaultParseWidth: 'any'
1299
+ }),
1300
+ dayPeriod: buildMatchFn({
1301
+ matchPatterns: matchDayPeriodPatterns,
1302
+ defaultMatchWidth: 'any',
1303
+ parsePatterns: parseDayPeriodPatterns,
1304
+ defaultParseWidth: 'any'
1305
+ })
1306
+ };
1307
+
1308
+ /**
1309
+ * @type {Locale}
1310
+ * @category Locales
1311
+ * @summary French locale.
1312
+ * @language French
1313
+ * @iso-639-2 fra
1314
+ * @author Jean Dupouy [@izeau]{@link https://github.com/izeau}
1315
+ * @author François B [@fbonzon]{@link https://github.com/fbonzon}
1316
+ */
1317
+
1318
+ var locale = {
1319
+ code: 'fr',
1320
+ formatDistance: formatDistance,
1321
+ formatLong: formatLong,
1322
+ formatRelative: formatRelative,
1323
+ localize: localize,
1324
+ match: match,
1325
+ options: {
1326
+ weekStartsOn: 1
1327
+ /* Monday */
1328
+ ,
1329
+ firstWeekContainsDate: 4
1330
+ }
1331
+ };
1332
+ var fr = locale;
1333
+
1334
+ new Array(24).fill(undefined).map((_, index) => ({
1335
+ label: String(index).padStart(2, '0'),
1336
+ value: index
1337
+ }));
1338
+ const RSUITE_CALENDAR_LOCALE = {
1339
+ // TODO Why this doesn't work?
1340
+ dateLocale: fr,
1341
+ formattedDayPattern: 'dd/MM/yyyy',
1342
+ formattedMonthPattern: 'MM/yyyy',
1343
+ friday: 'V',
1344
+ hours: 'Heures',
1345
+ minutes: 'Minutes',
1346
+ monday: 'L',
1347
+ ok: 'Valider',
1348
+ saturday: 'S',
1349
+ seconds: 'Secondes',
1350
+ sunday: 'D',
1351
+ thursday: 'J',
1352
+ today: 'Aujourd’hui',
1353
+ tuesday: 'M',
1354
+ wednesday: 'M',
1355
+ yesterday: 'Hier'
1356
+ };
1357
+ var STATUS;
1358
+ (function (STATUS) {
1359
+ STATUS["END_DATE"] = "END_DATE";
1360
+ STATUS["NO_DATE"] = "NO_DATE";
1361
+ STATUS["START_DATE"] = "START_DATE";
1362
+ })(STATUS || (STATUS = {}));
1363
+
1364
+ function RangeCalendarPicker({ defaultValue, isHistorical, onChange }) {
1365
+ const boxRef = useRef();
1366
+ const selectedFirstDate = useRef();
1367
+ const calendarRef = useRef();
1368
+ const [isFirstLoad, setIsFirstLoad] = useState(true);
1369
+ const controlledValue = useMemo(() => (defaultValue ? sortDates(defaultValue) : undefined), [defaultValue]);
1370
+ const utcTodayAsDayjs = useMemo(() => getUtcDayjs().endOf('day'), []);
1371
+ const disabledDate = useMemo(() => (date) => isHistorical ? getUtcizedDayjs(date).isAfter(utcTodayAsDayjs) : false, [isHistorical, utcTodayAsDayjs]);
1372
+ const handleSelect = useCallback((nextDate) => {
1373
+ if (!selectedFirstDate.current) {
1374
+ selectedFirstDate.current = nextDate;
1375
+ return;
1376
+ }
1377
+ const sortedDateRange = sortDates([selectedFirstDate.current, nextDate]);
1378
+ const [startDate, endDate] = sortedDateRange;
1379
+ const startDateTuple = getDateTupleFromDate(startDate);
1380
+ const endDateTuple = getDateTupleFromDate(endDate);
1381
+ const nextDateTupleRange = [startDateTuple, endDateTuple];
1382
+ onChange(nextDateTupleRange);
1383
+ }, [onChange]);
1384
+ const renderTitle = useCallback((date) => capitalizeFirstLetter(dayjs_minExports(date).format('MMMM YYYY')), []);
1385
+ useEffect(() => {
1386
+ // We wait for the <Box /> to render so that `boxRef` is defined
1387
+ // and can be used as a container for <RsuiteDateRangePicker />
1388
+ setIsFirstLoad(false);
1389
+ }, []);
1390
+ return (jsx(Box$5, { ref: boxRef, onClick: stopMouseEventPropagation, children: !isFirstLoad && (jsx(DateRangePicker$1, { ref: calendarRef, container: boxRef.current, disabledDate: disabledDate, format: "yyyy-MM-dd", locale: RSUITE_CALENDAR_LOCALE, onSelect: handleSelect, open: true, ranges: [], renderTitle: renderTitle,
1391
+ // `defaultValue` seems to be immediatly cancelled so we come down to using a controlled `value`
1392
+ value: controlledValue })) }));
1393
+ }
1394
+ const Box$5 = styled.div `
1395
+ height: 0;
1396
+ position: relative;
1397
+ user-select: none;
1398
+
1399
+ .rs-picker-toggle {
1400
+ display: none;
1401
+ }
1402
+
1403
+ .rs-picker-daterange-panel {
1404
+ height: 290px;
1405
+ }
1406
+
1407
+ .rs-picker-daterange-menu {
1408
+ border: solid 1px ${p => p.theme.color.lightGray};
1409
+ border-radius: 0;
1410
+ margin-top: 0.25rem;
1411
+
1412
+ .rs-picker-daterange-header,
1413
+ .rs-calendar-header-time-toolbar,
1414
+ .rs-picker-toolbar {
1415
+ display: none;
1416
+ }
1417
+
1418
+ .rs-calendar {
1419
+ height: auto !important;
1420
+ padding: 0;
1421
+
1422
+ :first-child {
1423
+ border-right: solid 1px ${p => p.theme.color.lightGray};
1424
+ }
1425
+
1426
+ .rs-calendar-header {
1427
+ border-bottom: solid 1px ${p => p.theme.color.lightGray};
1428
+ padding: 0.5rem;
1429
+
1430
+ .rs-calendar-header-month-toolbar {
1431
+ align-items: center;
1432
+ color: ${p => p.theme.color.slateGray};
1433
+ display: flex;
1434
+ justify-content: space-between;
1435
+
1436
+ .rs-calendar-header-title {
1437
+ font-size: inherit;
1438
+ text-transform: uppercase;
1439
+
1440
+ &.rs-calendar-header-error {
1441
+ color: ${p => p.theme.color.slateGray};
1442
+
1443
+ :hover {
1444
+ color: ${p => p.theme.color.slateGray};
1445
+ }
1446
+ }
1447
+ }
1448
+ }
1449
+ }
1450
+
1451
+ .rs-calendar-view {
1452
+ padding: 0.75rem 0.5rem 0;
1453
+
1454
+ .rs-calendar-table-cell {
1455
+ padding: 0 0 0.25rem 0;
1456
+ width: 33px;
1457
+
1458
+ &.rs-calendar-table-cell-in-range:before {
1459
+ background-color: ${p => p.theme.color.blueGray[25]};
1460
+ height: 33px;
1461
+ margin-top: 0;
1462
+ }
1463
+
1464
+ > .rs-calendar-table-cell-content {
1465
+ align-items: center;
1466
+ border-radius: 0 !important;
1467
+ display: inline-flex;
1468
+ height: 33px;
1469
+ justify-content: center;
1470
+ padding-bottom: 3px;
1471
+ width: 33px;
1472
+ }
1473
+ :hover .rs-calendar-table-cell-content {
1474
+ background-color: ${p => p.theme.color.blueYonder[25]};
1475
+ color: ${p => p.theme.color.blueYonder[100]};
1476
+ }
1477
+ &[role='columnheader'] .rs-calendar-table-cell-content,
1478
+ &[role='columnheader']:hover .rs-calendar-table-cell-content {
1479
+ background-color: transparent;
1480
+ color: ${p => p.theme.color.slateGray};
1481
+ }
1482
+ &.rs-calendar-table-cell-disabled .rs-calendar-table-cell-content {
1483
+ background-color: transparent;
1484
+ color: ${p => p.theme.color.lightGray};
1485
+ }
1486
+ &.rs-calendar-table-cell-selected > .rs-calendar-table-cell-content {
1487
+ background-color: ${p => p.theme.color.blueGray[100]};
1488
+ }
1489
+ }
1490
+ }
1491
+ }
1492
+ }
1493
+ `;
1494
+
1495
+ function RangedTimePicker({ filter, minutesRange, onChange }) {
1496
+ const rangedTimeOptions = useMemo(() => getRangedTimeOptions(minutesRange), [minutesRange]);
1497
+ const filteredRangedTimeOptions = useMemo(() => rangedTimeOptions.filter(({ label }) => filter.test(label)), [filter, rangedTimeOptions]);
1498
+ const [selectedOptionIndex, setSelectedOptionIndex] = useState(0);
1499
+ const handleBoxKeyDown = useCallback((event) => {
1500
+ if (event.key === 'ArrowDown') {
1501
+ event.preventDefault();
1502
+ const nextSelectedOptionIndex = selectedOptionIndex < filteredRangedTimeOptions.length - 1 ? selectedOptionIndex + 1 : 0;
1503
+ setSelectedOptionIndex(nextSelectedOptionIndex);
1504
+ window.document.querySelectorAll('.js-ranged-time-picker-option')[nextSelectedOptionIndex]?.scrollIntoView();
1505
+ }
1506
+ if (event.key === 'ArrowUp') {
1507
+ event.preventDefault();
1508
+ const nextSelectedOptionIndex = selectedOptionIndex > 0 ? selectedOptionIndex - 1 : filteredRangedTimeOptions.length - 1;
1509
+ setSelectedOptionIndex(nextSelectedOptionIndex);
1510
+ window.document.querySelectorAll('.js-ranged-time-picker-option')[nextSelectedOptionIndex]?.scrollIntoView();
1511
+ }
1512
+ if (['Enter', 'Space', 'Tab'].includes(event.key)) {
1513
+ const selectedRangedTimeOption = filteredRangedTimeOptions[selectedOptionIndex];
1514
+ if (!selectedRangedTimeOption) {
1515
+ return;
1516
+ }
1517
+ onChange(selectedRangedTimeOption.value);
1518
+ }
1519
+ }, [filteredRangedTimeOptions, selectedOptionIndex, onChange]);
1520
+ useEffect(() => {
1521
+ window.addEventListener('keydown', handleBoxKeyDown, {
1522
+ // eslint-disable-next-line @typescript-eslint/naming-convention
1523
+ once: true
1524
+ });
1525
+ return () => {
1526
+ window.removeEventListener('keydown', handleBoxKeyDown);
1527
+ };
1528
+ }, [handleBoxKeyDown]);
1529
+ useEffect(() => {
1530
+ setSelectedOptionIndex(0);
1531
+ }, [filteredRangedTimeOptions]);
1532
+ if (!filteredRangedTimeOptions.length) {
1533
+ return jsx(Fragment, {});
1534
+ }
1535
+ return (jsx(Box$4, { onClick: stopMouseEventPropagation, role: "listbox", children: filteredRangedTimeOptions.map(({ label, value }, index) => (jsx(Option, { "aria-selected": false, className: "js-ranged-time-picker-option", isSelected: index === selectedOptionIndex, onClick: () => onChange(value), role: "option", tabIndex: -1, children: label }, label))) }));
1536
+ }
1537
+ const Box$4 = styled.div `
1538
+ background-color: ${p => p.theme.color.gainsboro};
1539
+ display: flex;
1540
+ flex-direction: column;
1541
+ left: -1px;
1542
+ max-height: 10rem;
1543
+ overflow: auto;
1544
+ position: absolute;
1545
+ /* Non-WebKit Firefox Compatibility */
1546
+ scrollbar-color: ${p => p.theme.color.lightGray};
1547
+ scrollbar-width: thin;
1548
+ top: 2.25rem;
1549
+ z-index: 9999;
1550
+
1551
+ ::-webkit-scrollbar {
1552
+ -webkit-appearance: none;
1553
+ }
1554
+ ::-webkit-scrollbar:vertical {
1555
+ width: 0.33rem;
1556
+ }
1557
+ ::-webkit-scrollbar-thumb {
1558
+ border: 0;
1559
+ background-color: ${p => p.theme.color.lightGray};
1560
+ }
1561
+ ::-webkit-scrollbar-track {
1562
+ background-color: ${p => p.theme.color.gainsboro};
1563
+ }
1564
+ `;
1565
+ const Option = styled.div `
1566
+ background-color: ${p => (p.isSelected ? p.theme.color.blueGray[100] : 'transparent')};
1567
+ cursor: pointer;
1568
+ line-height: 1;
1569
+ padding: 5px 9px 7px 8px;
1570
+ text-align: center;
1571
+
1572
+ :hover {
1573
+ background-color: ${p => (p.isSelected ? p.theme.color.blueGray[100] : p.theme.color.blueYonder[25])};
1574
+ }
1575
+ `;
1576
+
1577
+ function TimeInputWithRef({ defaultValue, isStartDate = false, minutesRange = 15, onBack, onChange, onFocus, onNext, onPrevious }, ref) {
1578
+ const boxSpanRef = useRef();
1579
+ const hourInputRef = useRef();
1580
+ const minuteInputRef = useRef();
1581
+ const [controlledDefaultValue, setControlledDefaultValue] = useState(defaultValue);
1582
+ const [hasFormatError, setHasFormatError] = useState(false);
1583
+ const [hasValidationError, setHasValidationError] = useState(false);
1584
+ const [isFocused, setIsFocused] = useState(false);
1585
+ useImperativeHandle(ref, () => ({
1586
+ boxSpan: boxSpanRef.current,
1587
+ focus: (isInLastInputOfTheGroup = false) => {
1588
+ if (isInLastInputOfTheGroup) {
1589
+ minuteInputRef.current.focus();
1590
+ }
1591
+ else {
1592
+ hourInputRef.current.focus();
1593
+ }
1594
+ }
1595
+ }));
1596
+ const isRangedTimePickerOpenRef = useRef(false);
1597
+ const [rangedTimePickerFilter, setRangedTimePickerFilter] = useState(/.*/);
1598
+ const { forceUpdate } = useForceUpdate();
1599
+ const closeRangedTimePicker = useCallback(() => {
1600
+ isRangedTimePickerOpenRef.current = false;
1601
+ forceUpdate();
1602
+ }, [forceUpdate]);
1603
+ const handleBack = useCallback(() => {
1604
+ if (!onBack) {
1605
+ return;
1606
+ }
1607
+ closeRangedTimePicker();
1608
+ onBack();
1609
+ }, [closeRangedTimePicker, onBack]);
1610
+ const handleBlur = useCallback(() => {
1611
+ setIsFocused(false);
1612
+ }, []);
1613
+ const handleClickOutside = useCallback((event) => {
1614
+ const target = event.target;
1615
+ if (hourInputRef.current.contains(target) || minuteInputRef.current.contains(target)) {
1616
+ return;
1617
+ }
1618
+ closeRangedTimePicker();
1619
+ }, [closeRangedTimePicker]);
1620
+ const handleFocus = useCallback(() => {
1621
+ setIsFocused(true);
1622
+ if (onFocus) {
1623
+ onFocus();
1624
+ }
1625
+ }, [onFocus]);
1626
+ const handleFormatError = useCallback((hasNextFormatError) => {
1627
+ setHasFormatError(hasNextFormatError);
1628
+ }, []);
1629
+ const handleRangedTimePickedChange = useCallback((nextTimeTuple) => {
1630
+ closeRangedTimePicker();
1631
+ setControlledDefaultValue(nextTimeTuple);
1632
+ onChange(nextTimeTuple);
1633
+ }, [closeRangedTimePicker, onChange]);
1634
+ const handleHourInput = useCallback((nextValue) => {
1635
+ // eslint-disable-next-line no-nested-ternary
1636
+ const nextRangedTimePickerFilter = nextValue.length ? new RegExp(`^${nextValue}`) : /.*/;
1637
+ setRangedTimePickerFilter(nextRangedTimePickerFilter);
1638
+ }, []);
1639
+ const openRangedTimePicker = useCallback(() => {
1640
+ isRangedTimePickerOpenRef.current = true;
1641
+ forceUpdate();
1642
+ }, [forceUpdate]);
1643
+ useEffect(() => {
1644
+ window.document.addEventListener('click', handleClickOutside);
1645
+ return () => {
1646
+ window.document.removeEventListener('click', handleClickOutside);
1647
+ };
1648
+ }, [handleClickOutside]);
1649
+ const submit = useCallback(() => {
1650
+ setHasValidationError(false);
1651
+ if (window.document.activeElement === hourInputRef.current) {
1652
+ minuteInputRef.current.focus();
1653
+ }
1654
+ if (!hourInputRef.current.value.length || !minuteInputRef.current.value.length) {
1655
+ if (minuteInputRef.current.value.length && !hourInputRef.current.value.length) {
1656
+ setHasValidationError(true);
1657
+ }
1658
+ return;
1659
+ }
1660
+ closeRangedTimePicker();
1661
+ const nextTimeTuple = [hourInputRef.current.value, minuteInputRef.current.value];
1662
+ onChange(nextTimeTuple);
1663
+ }, [closeRangedTimePicker, onChange]);
1664
+ return (jsxs(Box$3, { ref: boxSpanRef, hasError: hasFormatError || hasValidationError, isFocused: isFocused, children: [jsxs(Fragment, { children: [jsx(NumberInput, { ref: hourInputRef, "data-cy": `date-range-picker-${isStartDate ? 'start' : 'end'}-hour`, defaultValue: controlledDefaultValue && controlledDefaultValue[0], max: 23, min: 0, onBack: handleBack, onBlur: handleBlur, onClick: openRangedTimePicker, onFilled: submit, onFocus: handleFocus, onFormatError: handleFormatError, onInput: handleHourInput, onNext: () => minuteInputRef.current.focus(), onPrevious: onPrevious, size: 2 }), ":", jsx(NumberInput, { ref: minuteInputRef, "data-cy": `date-range-picker-${isStartDate ? 'start' : 'end'}-minute`, defaultValue: controlledDefaultValue && controlledDefaultValue[1], max: 59, min: 0, onBack: () => hourInputRef.current.focus(), onBlur: handleBlur, onClick: openRangedTimePicker, onFilled: submit, onFocus: handleFocus, onFormatError: handleFormatError, onNext: onNext, onPrevious: () => hourInputRef.current.focus(), size: 2 })] }), isRangedTimePickerOpenRef.current && (jsx(RangedTimePicker, { filter: rangedTimePickerFilter, minutesRange: minutesRange, onChange: handleRangedTimePickedChange }))] }));
1665
+ }
1666
+ const TimeInput = forwardRef(TimeInputWithRef);
1667
+ const Box$3 = styled.span `
1668
+ background-color: ${p => p.theme.color.gainsboro};
1669
+ box-shadow: ${p => p.hasError || p.isFocused
1670
+ ? `inset 0px 0px 0px 1px ${p.hasError ? p.theme.color.maximumRed : p.theme.color.blueGray[100]}`
1671
+ : 'none'};
1672
+ color: ${p => p.theme.color.slateGray};
1673
+ display: inline-block;
1674
+ font-size: inherit;
1675
+ padding: 0.3125rem 0.5rem 0.4375rem;
1676
+ position: relative;
1677
+ user-select: none;
1678
+
1679
+ :hover {
1680
+ box-shadow: ${p => `inset 0px 0px 0px 1px ${p.theme.color.blueYonder[100]}`};
1681
+ }
1682
+ `;
1683
+
1684
+ var DateRangePosition;
1685
+ (function (DateRangePosition) {
1686
+ DateRangePosition["END"] = "END";
1687
+ DateRangePosition["START"] = "START";
1688
+ })(DateRangePosition || (DateRangePosition = {}));
1689
+
1690
+ function DateRangePicker({ defaultValue, isHistorical = false, isLabelHidden = false, label, minutesRange = 15, onChange, withTime = false }) {
1691
+ const startDateInputRef = useRef();
1692
+ const startTimeInputRef = useRef();
1693
+ const endDateInputRef = useRef();
1694
+ const endTimeInputRef = useRef();
1695
+ const isRangeCalendarPickerOpenRef = useRef(false);
1696
+ const selectedStartDateRef = useRef(defaultValue ? getLocalizedDayjs(defaultValue[0]).toDate() : undefined);
1697
+ const selectedEndDateRef = useRef(defaultValue ? getLocalizedDayjs(defaultValue[1]).toDate() : undefined);
1698
+ const selectedStartDateTupleRef = useRef(getDateTupleFromDate(selectedStartDateRef.current));
1699
+ const selectedEndDateTupleRef = useRef(getDateTupleFromDate(selectedEndDateRef.current));
1700
+ const selectedStartTimeTupleRef = useRef(getTimeTupleFromDate(selectedStartDateRef.current));
1701
+ const selectedEndTimeTupleRef = useRef(getTimeTupleFromDate(selectedEndDateRef.current));
1702
+ const { forceUpdate } = useForceUpdate();
1703
+ const rangeCalendarPickerDefaultValue = useMemo(() => selectedStartDateTupleRef.current && selectedEndDateTupleRef.current
1704
+ ? [
1705
+ getDateFromDateAndTimeTuple(selectedStartDateTupleRef.current, ['00', '00']),
1706
+ getDateFromDateAndTimeTuple(selectedEndDateTupleRef.current, ['00', '00'], true)
1707
+ ]
1708
+ : undefined,
1709
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1710
+ [selectedEndDateTupleRef.current, selectedStartDateTupleRef.current]);
1711
+ const submit = useCallback(() => {
1712
+ if (!onChange || !selectedStartDateRef.current || !selectedEndDateRef.current) {
1713
+ return;
1714
+ }
1715
+ const utcizedStartDate = getUtcizedDayjs(selectedStartDateRef.current).toDate();
1716
+ const utcizedEndDate = getUtcizedDayjs(selectedEndDateRef.current).toDate();
1717
+ const nextDateRange = [utcizedStartDate, utcizedEndDate];
1718
+ onChange(nextDateRange);
1719
+ }, [onChange]);
1720
+ const closeRangeCalendarPicker = useCallback(() => {
1721
+ isRangeCalendarPickerOpenRef.current = false;
1722
+ forceUpdate();
1723
+ }, [forceUpdate]);
1724
+ const handleClickOutside = useCallback((event) => {
1725
+ const target = event.target;
1726
+ if (startDateInputRef.current.boxSpan.contains(target) || endDateInputRef.current.boxSpan.contains(target)) {
1727
+ return;
1728
+ }
1729
+ closeRangeCalendarPicker();
1730
+ }, [closeRangeCalendarPicker]);
1731
+ const handleEndDateInputNext = useCallback(() => {
1732
+ if (!withTime) {
1733
+ return;
1734
+ }
1735
+ endTimeInputRef.current.focus();
1736
+ }, [withTime]);
1737
+ const handleEndDateInputPrevious = useCallback(() => {
1738
+ if (withTime) {
1739
+ startTimeInputRef.current.focus(true);
1740
+ return;
1741
+ }
1742
+ startDateInputRef.current.focus(true);
1743
+ }, [withTime]);
1744
+ const handleStartDateInputNext = useCallback(() => {
1745
+ if (withTime) {
1746
+ startTimeInputRef.current.focus();
1747
+ return;
1748
+ }
1749
+ endDateInputRef.current.focus();
1750
+ }, [withTime]);
1751
+ const handleDateInputFilled = useCallback((position, nextDateTuple) => {
1752
+ if (position === DateRangePosition.START) {
1753
+ selectedStartDateTupleRef.current = nextDateTuple;
1754
+ // If there is no time input or a start time has already been selected,
1755
+ if (!withTime || selectedStartTimeTupleRef.current) {
1756
+ // we must update the selected start date and call onChange()
1757
+ const startTimeTuple = (withTime ? selectedStartTimeTupleRef.current : ['00', '00']);
1758
+ const nextStartDate = getDateFromDateAndTimeTuple(nextDateTuple, startTimeTuple);
1759
+ selectedStartDateRef.current = nextStartDate;
1760
+ submit();
1761
+ }
1762
+ handleStartDateInputNext();
1763
+ }
1764
+ else {
1765
+ selectedEndDateTupleRef.current = nextDateTuple;
1766
+ // If there is no time input or an end time has already been selected,
1767
+ if (!withTime || selectedEndTimeTupleRef.current) {
1768
+ // we must update the selected end date and call onChange()
1769
+ const endTimeTuple = (withTime ? selectedEndTimeTupleRef.current : ['23', '59']);
1770
+ const nextEndDate = getDateFromDateAndTimeTuple(nextDateTuple, endTimeTuple, true);
1771
+ selectedEndDateRef.current = nextEndDate;
1772
+ submit();
1773
+ }
1774
+ handleEndDateInputNext();
1775
+ }
1776
+ }, [handleEndDateInputNext, handleStartDateInputNext, submit, withTime]);
1777
+ const handleRangeCalendarPickerChange = useCallback((nextDateTupleRange) => {
1778
+ const [nextStartDateTuple, nextEndDateTuple] = nextDateTupleRange;
1779
+ // If this is a date picker without a time input,
1780
+ if (!withTime) {
1781
+ // we have to fix the start date at the beginning of the day
1782
+ const nextStartDate = getDateFromDateAndTimeTuple(nextStartDateTuple, ['00', '00']);
1783
+ // and the end date at the end of the day
1784
+ const nextEndDate = getDateFromDateAndTimeTuple(nextEndDateTuple, ['23', '59'], true);
1785
+ selectedStartDateRef.current = nextStartDate;
1786
+ selectedEndDateRef.current = nextEndDate;
1787
+ }
1788
+ // If this is a date picker with a time input,
1789
+ else {
1790
+ // we include the selected start time if it exists, set it at the beginning of the day if not
1791
+ const nextStartDate = getDateFromDateAndTimeTuple(nextStartDateTuple, selectedStartTimeTupleRef.current || ['00', '00']);
1792
+ selectedStartDateRef.current = nextStartDate;
1793
+ // we include the selected end time if it exists, set it at the end of the day if not
1794
+ const nextEndDate = getDateFromDateAndTimeTuple(nextEndDateTuple, selectedEndTimeTupleRef.current || ['23', '59'], true);
1795
+ selectedEndDateRef.current = nextEndDate;
1796
+ }
1797
+ selectedStartDateTupleRef.current = nextStartDateTuple;
1798
+ selectedStartTimeTupleRef.current = getTimeTupleFromDate(selectedStartDateRef.current);
1799
+ selectedEndDateTupleRef.current = nextEndDateTuple;
1800
+ selectedEndTimeTupleRef.current = getTimeTupleFromDate(selectedEndDateRef.current);
1801
+ closeRangeCalendarPicker();
1802
+ forceUpdate();
1803
+ submit();
1804
+ }, [closeRangeCalendarPicker, forceUpdate, submit, withTime]);
1805
+ const handleTimeInputFilled = useCallback((position, nextTimeTuple) => {
1806
+ if (position === DateRangePosition.START) {
1807
+ // If a start date has already been selected
1808
+ if (selectedStartDateTupleRef.current) {
1809
+ // we must update the selected start date accordingly and submit it
1810
+ const nextStartDate = getDateFromDateAndTimeTuple(selectedStartDateTupleRef.current, nextTimeTuple);
1811
+ selectedStartDateRef.current = nextStartDate;
1812
+ submit();
1813
+ }
1814
+ selectedStartTimeTupleRef.current = nextTimeTuple;
1815
+ endDateInputRef.current.focus();
1816
+ }
1817
+ else {
1818
+ // If an end date has already been selected
1819
+ if (selectedEndDateTupleRef.current) {
1820
+ // we must update the selected end date accordingly and submit it
1821
+ const nextEndDate = getDateFromDateAndTimeTuple(selectedEndDateTupleRef.current, nextTimeTuple, true);
1822
+ selectedEndDateRef.current = nextEndDate;
1823
+ submit();
1824
+ }
1825
+ selectedEndTimeTupleRef.current = nextTimeTuple;
1826
+ }
1827
+ submit();
1828
+ }, [submit]);
1829
+ const openRangeCalendarPicker = useCallback(() => {
1830
+ isRangeCalendarPickerOpenRef.current = true;
1831
+ forceUpdate();
1832
+ }, [forceUpdate]);
1833
+ useEffect(() => {
1834
+ window.document.addEventListener('click', handleClickOutside);
1835
+ return () => {
1836
+ window.document.removeEventListener('click', handleClickOutside);
1837
+ };
1838
+ }, [handleClickOutside]);
1839
+ return (jsxs(Fieldset, { className: "DateRangePicker", children: [jsx(Legend, { isHidden: isLabelHidden, children: label }), jsxs(Box$2, { children: [jsx(Field$1, { children: jsx(DateInput, { ref: startDateInputRef, defaultValue: selectedStartDateTupleRef.current, isForcedFocused: isRangeCalendarPickerOpenRef.current, isStartDate: true, onChange: nextDateTuple => handleDateInputFilled(DateRangePosition.START, nextDateTuple), onClick: openRangeCalendarPicker, onNext: handleStartDateInputNext }) }), withTime && (jsx(Field$1, { isTimeField: true, children: jsx(TimeInput, { ref: startTimeInputRef, defaultValue: selectedStartTimeTupleRef.current, isStartDate: true, minutesRange: minutesRange, onBack: () => startDateInputRef.current.focus(true), onChange: nextTimeTuple => handleTimeInputFilled(DateRangePosition.START, nextTimeTuple), onFocus: closeRangeCalendarPicker, onNext: () => endDateInputRef.current.focus(), onPrevious: () => startDateInputRef.current.focus(true) }) })), jsx(Field$1, { isEndDateField: true, children: jsx(DateInput, { ref: endDateInputRef, defaultValue: selectedEndDateTupleRef.current, isEndDate: true, isForcedFocused: isRangeCalendarPickerOpenRef.current, onBack: handleEndDateInputPrevious, onChange: nextDateTuple => handleDateInputFilled(DateRangePosition.END, nextDateTuple), onClick: openRangeCalendarPicker, onNext: handleEndDateInputNext, onPrevious: handleEndDateInputPrevious }) }), withTime && (jsx(Field$1, { isTimeField: true, children: jsx(TimeInput, { ref: endTimeInputRef, defaultValue: selectedEndTimeTupleRef.current, minutesRange: minutesRange, onBack: () => endDateInputRef.current.focus(true), onChange: nextTimeTuple => handleTimeInputFilled(DateRangePosition.END, nextTimeTuple), onFocus: closeRangeCalendarPicker, onPrevious: () => endDateInputRef.current.focus(true) }) }))] }), isRangeCalendarPickerOpenRef.current && (jsx(RangeCalendarPicker, { defaultValue: rangeCalendarPickerDefaultValue, isHistorical: isHistorical, onChange: handleRangeCalendarPickerChange }))] }));
1840
+ }
1841
+ const Box$2 = styled.div `
1842
+ * {
1843
+ font-weight: 500;
1844
+ line-height: 1;
1845
+ }
1846
+
1847
+ color: ${p => p.theme.color.gunMetal};
1848
+ font-size: 13px;
1849
+ position: relative;
1850
+ `;
1851
+ const Field$1 = styled.span `
1852
+ font-size: inherit;
1853
+ margin-left: ${p => {
1854
+ if (p.isEndDateField) {
1855
+ return '0.625rem';
1856
+ }
1857
+ return p.isTimeField ? '0.125rem' : 0;
1858
+ }};
1859
+ `;
1860
+
1861
+ function CalendarPicker({ defaultValue, isHistorical, onChange }) {
1862
+ const boxRef = useRef();
1863
+ const calendarRef = useRef();
1864
+ const [isFirstLoad, setIsFirstLoad] = useState(true);
1865
+ const utcTodayAsDayjs = useMemo(() => getUtcDayjs().endOf('day'), []);
1866
+ const disabledDate = useMemo(() => (date) => date && isHistorical ? getUtcizedDayjs(date).isAfter(utcTodayAsDayjs) : false, [isHistorical, utcTodayAsDayjs]);
1867
+ const handleSelect = useCallback((nextDate) => {
1868
+ const nextDateTuple = getDateTupleFromDate(nextDate);
1869
+ onChange(nextDateTuple);
1870
+ }, [onChange]);
1871
+ useEffect(() => {
1872
+ // We wait for the <Box /> to render so that `boxRef` is defined
1873
+ // and can be used as a container for <RsuiteDateRangePicker />
1874
+ setIsFirstLoad(false);
1875
+ }, []);
1876
+ return (jsxs(Fragment, { children: [jsx(GlobalStyleToHideBodyDialog, {}), jsx(Box$1, { ref: boxRef, onClick: stopMouseEventPropagation, children: !isFirstLoad && (jsx(DatePicker$1, { ref: calendarRef, container: boxRef.current, disabledDate: disabledDate, format: "yyyy-MM-dd", locale: RSUITE_CALENDAR_LOCALE, oneTap: true, onSelect: handleSelect, open: true, ranges: [],
1877
+ // `defaultValue` seems to be immediatly cancelled so we come down to using a controlled `value`
1878
+ value: defaultValue })) })] }));
1879
+ }
1880
+ const GlobalStyleToHideBodyDialog = createGlobalStyle `
1881
+ body > div[role="dialog"].rs-picker-date-menu {
1882
+ display: none;
1883
+ }
1884
+ `;
1885
+ const Box$1 = styled.div `
1886
+ height: 0;
1887
+ position: relative;
1888
+ user-select: none;
1889
+
1890
+ .rs-picker-toggle {
1891
+ display: none;
1892
+ }
1893
+
1894
+ .rs-picker-date-panel {
1895
+ height: 290px;
1896
+ }
1897
+
1898
+ .rs-picker-date-menu {
1899
+ border: solid 1px ${p => p.theme.color.lightGray};
1900
+ border-radius: 0;
1901
+ margin-top: 0.25rem;
1902
+
1903
+ .rs-picker-date-header,
1904
+ .rs-calendar-header-time-toolbar,
1905
+ .rs-picker-toolbar {
1906
+ display: none;
1907
+ }
1908
+
1909
+ .rs-calendar {
1910
+ height: auto !important;
1911
+ padding: 0;
1912
+
1913
+ :first-child {
1914
+ border-right: solid 1px ${p => p.theme.color.lightGray};
1915
+ }
1916
+
1917
+ .rs-calendar-header {
1918
+ border-bottom: solid 1px ${p => p.theme.color.lightGray};
1919
+ padding: 0.5rem;
1920
+
1921
+ .rs-calendar-header-month-toolbar {
1922
+ align-items: center;
1923
+ color: ${p => p.theme.color.slateGray};
1924
+ display: flex;
1925
+ justify-content: space-between;
1926
+
1927
+ .rs-calendar-header-title {
1928
+ font-size: inherit;
1929
+ text-transform: uppercase;
1930
+
1931
+ &.rs-calendar-header-error {
1932
+ color: ${p => p.theme.color.slateGray};
1933
+
1934
+ :hover {
1935
+ color: ${p => p.theme.color.slateGray};
1936
+ }
1937
+ }
1938
+ }
1939
+ }
1940
+ }
1941
+
1942
+ .rs-calendar-view {
1943
+ padding: 0.75rem 0.5rem 0;
1944
+
1945
+ .rs-calendar-table-cell {
1946
+ padding: 0 0 0.25rem 0;
1947
+ width: 33px;
1948
+
1949
+ &.rs-calendar-table-cell-in-range:before {
1950
+ background-color: ${p => p.theme.color.blueGray[25]};
1951
+ height: 33px;
1952
+ margin-top: 0;
1953
+ }
1954
+
1955
+ > .rs-calendar-table-cell-content {
1956
+ align-items: center;
1957
+ border-radius: 0 !important;
1958
+ display: inline-flex;
1959
+ height: 33px;
1960
+ justify-content: center;
1961
+ padding-bottom: 3px;
1962
+ width: 33px;
1963
+ }
1964
+ :hover .rs-calendar-table-cell-content {
1965
+ background-color: ${p => p.theme.color.blueYonder[25]};
1966
+ color: ${p => p.theme.color.blueYonder[100]};
1967
+ }
1968
+ &[role='columnheader'] .rs-calendar-table-cell-content,
1969
+ &[role='columnheader']:hover .rs-calendar-table-cell-content {
1970
+ background-color: transparent;
1971
+ color: ${p => p.theme.color.slateGray};
1972
+ }
1973
+ &.rs-calendar-table-cell-disabled .rs-calendar-table-cell-content {
1974
+ background-color: transparent;
1975
+ color: ${p => p.theme.color.lightGray};
1976
+ }
1977
+ &.rs-calendar-table-cell-selected > .rs-calendar-table-cell-content {
1978
+ background-color: ${p => p.theme.color.blueGray[100]};
1979
+ }
1980
+ }
1981
+ }
1982
+ }
1983
+ }
1984
+ `;
1985
+
1986
+ function DatePicker({ defaultValue, isHistorical = false, isLabelHidden = false, label, minutesRange = 15, onChange, withTime = false }) {
1987
+ const dateInputRef = useRef();
1988
+ const timeInputRef = useRef();
1989
+ const isCalendarPickerOpenRef = useRef(false);
1990
+ const selectedDateRef = useRef(defaultValue ? getLocalizedDayjs(defaultValue).toDate() : undefined);
1991
+ const selectedDateTupleRef = useRef(getDateTupleFromDate(selectedDateRef.current));
1992
+ const selectedTimeTupleRef = useRef(getTimeTupleFromDate(selectedDateRef.current));
1993
+ const { forceUpdate } = useForceUpdate();
1994
+ const rangeCalendarPickerDefaultValue = useMemo(() => selectedDateTupleRef.current
1995
+ ? getDateFromDateAndTimeTuple(selectedDateTupleRef.current, ['00', '00'])
1996
+ : undefined,
1997
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1998
+ [selectedDateTupleRef.current]);
1999
+ const submit = useCallback(() => {
2000
+ if (!onChange || !selectedDateRef.current) {
2001
+ return;
2002
+ }
2003
+ const nextDate = getUtcizedDayjs(selectedDateRef.current).toDate();
2004
+ onChange(nextDate);
2005
+ }, [onChange]);
2006
+ const closeCalendarPicker = useCallback(() => {
2007
+ isCalendarPickerOpenRef.current = false;
2008
+ forceUpdate();
2009
+ }, [forceUpdate]);
2010
+ const handleClickOutside = useCallback((event) => {
2011
+ const target = event.target;
2012
+ if (dateInputRef.current.boxSpan.contains(target)) {
2013
+ return;
2014
+ }
2015
+ closeCalendarPicker();
2016
+ }, [closeCalendarPicker]);
2017
+ const handleDateInputNext = useCallback(() => {
2018
+ if (!withTime) {
2019
+ return;
2020
+ }
2021
+ timeInputRef.current.focus();
2022
+ }, [withTime]);
2023
+ const handleDateInputFilled = useCallback((nextDateTuple) => {
2024
+ selectedDateTupleRef.current = nextDateTuple;
2025
+ // If there is no time input or a time has already been selected,
2026
+ if (!withTime || selectedTimeTupleRef.current) {
2027
+ // we must update the selected date and call onChange()
2028
+ const timeTuple = (withTime ? selectedTimeTupleRef.current : ['00', '00']);
2029
+ const nextDate = getDateFromDateAndTimeTuple(nextDateTuple, timeTuple);
2030
+ selectedDateRef.current = nextDate;
2031
+ submit();
2032
+ }
2033
+ handleDateInputNext();
2034
+ }, [handleDateInputNext, submit, withTime]);
2035
+ const handleCalendarPickerChange = useCallback((nextDateTuple) => {
2036
+ // If this is a date picker without a time input,
2037
+ if (!withTime) {
2038
+ // we have to fix the date at the beginning of the day
2039
+ const nextDate = getDateFromDateAndTimeTuple(nextDateTuple, ['00', '00']);
2040
+ selectedDateRef.current = nextDate;
2041
+ }
2042
+ // If this is a date picker with a time input,
2043
+ else {
2044
+ // we include the selected time if it exists, set it at the beginning of the day if not
2045
+ const nextDate = getDateFromDateAndTimeTuple(nextDateTuple, selectedTimeTupleRef.current || ['00', '00']);
2046
+ selectedDateRef.current = nextDate;
2047
+ }
2048
+ selectedDateTupleRef.current = nextDateTuple;
2049
+ selectedTimeTupleRef.current = getTimeTupleFromDate(selectedDateRef.current);
2050
+ closeCalendarPicker();
2051
+ forceUpdate();
2052
+ submit();
2053
+ }, [closeCalendarPicker, forceUpdate, submit, withTime]);
2054
+ const handleTimeInputFilled = useCallback((nextTimeTuple) => {
2055
+ // If a date has already been selected
2056
+ if (selectedDateTupleRef.current) {
2057
+ // we must update the selected date accordingly and submit it
2058
+ const nextDate = getDateFromDateAndTimeTuple(selectedDateTupleRef.current, nextTimeTuple);
2059
+ selectedDateRef.current = nextDate;
2060
+ submit();
2061
+ }
2062
+ selectedTimeTupleRef.current = nextTimeTuple;
2063
+ submit();
2064
+ }, [submit]);
2065
+ const openCalendarPicker = useCallback(() => {
2066
+ isCalendarPickerOpenRef.current = true;
2067
+ forceUpdate();
2068
+ }, [forceUpdate]);
2069
+ useEffect(() => {
2070
+ window.document.addEventListener('click', handleClickOutside);
2071
+ return () => {
2072
+ window.document.removeEventListener('click', handleClickOutside);
2073
+ };
2074
+ }, [handleClickOutside]);
2075
+ return (jsxs(Fieldset, { className: "DateRangePicker", children: [jsx(Legend, { isHidden: isLabelHidden, children: label }), jsxs(Box, { children: [jsx(Field, { children: jsx(DateInput, { ref: dateInputRef, defaultValue: selectedDateTupleRef.current, isForcedFocused: isCalendarPickerOpenRef.current, onChange: handleDateInputFilled, onClick: openCalendarPicker, onNext: handleDateInputNext }) }), withTime && (jsx(Field, { isTimeField: true, children: jsx(TimeInput, { ref: timeInputRef, defaultValue: selectedTimeTupleRef.current, minutesRange: minutesRange, onBack: () => dateInputRef.current.focus(true), onChange: handleTimeInputFilled, onFocus: closeCalendarPicker, onPrevious: () => dateInputRef.current.focus(true) }) }))] }), isCalendarPickerOpenRef.current && (jsx(CalendarPicker, { defaultValue: rangeCalendarPickerDefaultValue, isHistorical: isHistorical, onChange: handleCalendarPickerChange }))] }));
2076
+ }
2077
+ const Box = styled.div `
2078
+ * {
2079
+ font-weight: 500;
2080
+ line-height: 1;
2081
+ }
2082
+
2083
+ color: ${p => p.theme.color.gunMetal};
2084
+ font-size: 13px;
2085
+ position: relative;
2086
+ `;
2087
+ const Field = styled.span `
2088
+ font-size: inherit;
2089
+ margin-left: ${p => {
2090
+ if (p.isEndDateField) {
2091
+ return '0.625rem';
2092
+ }
2093
+ return p.isTimeField ? '0.125rem' : 0;
2094
+ }};
2095
+ `;
2096
+
2097
+ function _isPlaceholder(a) {
2098
+ return a != null && typeof a === 'object' && a['@@functional/placeholder'] === true;
2099
+ }
2100
+
2101
+ /**
2102
+ * Optimized internal one-arity curry function.
2103
+ *
2104
+ * @private
2105
+ * @category Function
2106
+ * @param {Function} fn The function to curry.
2107
+ * @return {Function} The curried function.
2108
+ */
2109
+
2110
+ function _curry1(fn) {
2111
+ return function f1(a) {
2112
+ if (arguments.length === 0 || _isPlaceholder(a)) {
2113
+ return f1;
2114
+ } else {
2115
+ return fn.apply(this, arguments);
2116
+ }
2117
+ };
2118
+ }
2119
+
2120
+ /**
2121
+ * Optimized internal two-arity curry function.
2122
+ *
2123
+ * @private
2124
+ * @category Function
2125
+ * @param {Function} fn The function to curry.
2126
+ * @return {Function} The curried function.
2127
+ */
2128
+
2129
+ function _curry2(fn) {
2130
+ return function f2(a, b) {
2131
+ switch (arguments.length) {
2132
+ case 0:
2133
+ return f2;
2134
+
2135
+ case 1:
2136
+ return _isPlaceholder(a) ? f2 : _curry1(function (_b) {
2137
+ return fn(a, _b);
2138
+ });
2139
+
2140
+ default:
2141
+ return _isPlaceholder(a) && _isPlaceholder(b) ? f2 : _isPlaceholder(a) ? _curry1(function (_a) {
2142
+ return fn(_a, b);
2143
+ }) : _isPlaceholder(b) ? _curry1(function (_b) {
2144
+ return fn(a, _b);
2145
+ }) : fn(a, b);
2146
+ }
2147
+ };
2148
+ }
2149
+
2150
+ function _arity(n, fn) {
2151
+ /* eslint-disable no-unused-vars */
2152
+ switch (n) {
2153
+ case 0:
2154
+ return function () {
2155
+ return fn.apply(this, arguments);
2156
+ };
2157
+
2158
+ case 1:
2159
+ return function (a0) {
2160
+ return fn.apply(this, arguments);
2161
+ };
2162
+
2163
+ case 2:
2164
+ return function (a0, a1) {
2165
+ return fn.apply(this, arguments);
2166
+ };
2167
+
2168
+ case 3:
2169
+ return function (a0, a1, a2) {
2170
+ return fn.apply(this, arguments);
2171
+ };
2172
+
2173
+ case 4:
2174
+ return function (a0, a1, a2, a3) {
2175
+ return fn.apply(this, arguments);
2176
+ };
2177
+
2178
+ case 5:
2179
+ return function (a0, a1, a2, a3, a4) {
2180
+ return fn.apply(this, arguments);
2181
+ };
2182
+
2183
+ case 6:
2184
+ return function (a0, a1, a2, a3, a4, a5) {
2185
+ return fn.apply(this, arguments);
2186
+ };
2187
+
2188
+ case 7:
2189
+ return function (a0, a1, a2, a3, a4, a5, a6) {
2190
+ return fn.apply(this, arguments);
2191
+ };
2192
+
2193
+ case 8:
2194
+ return function (a0, a1, a2, a3, a4, a5, a6, a7) {
2195
+ return fn.apply(this, arguments);
2196
+ };
2197
+
2198
+ case 9:
2199
+ return function (a0, a1, a2, a3, a4, a5, a6, a7, a8) {
2200
+ return fn.apply(this, arguments);
2201
+ };
2202
+
2203
+ case 10:
2204
+ return function (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) {
2205
+ return fn.apply(this, arguments);
2206
+ };
2207
+
2208
+ default:
2209
+ throw new Error('First argument to _arity must be a non-negative integer no greater than ten');
2210
+ }
2211
+ }
2212
+
2213
+ /**
2214
+ * Optimized internal three-arity curry function.
2215
+ *
2216
+ * @private
2217
+ * @category Function
2218
+ * @param {Function} fn The function to curry.
2219
+ * @return {Function} The curried function.
2220
+ */
2221
+
2222
+ function _curry3(fn) {
2223
+ return function f3(a, b, c) {
2224
+ switch (arguments.length) {
2225
+ case 0:
2226
+ return f3;
2227
+
2228
+ case 1:
2229
+ return _isPlaceholder(a) ? f3 : _curry2(function (_b, _c) {
2230
+ return fn(a, _b, _c);
2231
+ });
2232
+
2233
+ case 2:
2234
+ return _isPlaceholder(a) && _isPlaceholder(b) ? f3 : _isPlaceholder(a) ? _curry2(function (_a, _c) {
2235
+ return fn(_a, b, _c);
2236
+ }) : _isPlaceholder(b) ? _curry2(function (_b, _c) {
2237
+ return fn(a, _b, _c);
2238
+ }) : _curry1(function (_c) {
2239
+ return fn(a, b, _c);
2240
+ });
2241
+
2242
+ default:
2243
+ return _isPlaceholder(a) && _isPlaceholder(b) && _isPlaceholder(c) ? f3 : _isPlaceholder(a) && _isPlaceholder(b) ? _curry2(function (_a, _b) {
2244
+ return fn(_a, _b, c);
2245
+ }) : _isPlaceholder(a) && _isPlaceholder(c) ? _curry2(function (_a, _c) {
2246
+ return fn(_a, b, _c);
2247
+ }) : _isPlaceholder(b) && _isPlaceholder(c) ? _curry2(function (_b, _c) {
2248
+ return fn(a, _b, _c);
2249
+ }) : _isPlaceholder(a) ? _curry1(function (_a) {
2250
+ return fn(_a, b, c);
2251
+ }) : _isPlaceholder(b) ? _curry1(function (_b) {
2252
+ return fn(a, _b, c);
2253
+ }) : _isPlaceholder(c) ? _curry1(function (_c) {
2254
+ return fn(a, b, _c);
2255
+ }) : fn(a, b, c);
2256
+ }
2257
+ };
2258
+ }
2259
+
2260
+ /**
2261
+ * Tests whether or not an object is an array.
2262
+ *
2263
+ * @private
2264
+ * @param {*} val The object to test.
2265
+ * @return {Boolean} `true` if `val` is an array, `false` otherwise.
2266
+ * @example
2267
+ *
2268
+ * _isArray([]); //=> true
2269
+ * _isArray(null); //=> false
2270
+ * _isArray({}); //=> false
2271
+ */
2272
+ var _isArray = Array.isArray || function _isArray(val) {
2273
+ return val != null && val.length >= 0 && Object.prototype.toString.call(val) === '[object Array]';
2274
+ };
2275
+
2276
+ function _isTransformer(obj) {
2277
+ return obj != null && typeof obj['@@transducer/step'] === 'function';
2278
+ }
2279
+
2280
+ /**
2281
+ * Returns a function that dispatches with different strategies based on the
2282
+ * object in list position (last argument). If it is an array, executes [fn].
2283
+ * Otherwise, if it has a function with one of the given method names, it will
2284
+ * execute that function (functor case). Otherwise, if it is a transformer,
2285
+ * uses transducer created by [transducerCreator] to return a new transformer
2286
+ * (transducer case).
2287
+ * Otherwise, it will default to executing [fn].
2288
+ *
2289
+ * @private
2290
+ * @param {Array} methodNames properties to check for a custom implementation
2291
+ * @param {Function} transducerCreator transducer factory if object is transformer
2292
+ * @param {Function} fn default ramda implementation
2293
+ * @return {Function} A function that dispatches on object in list position
2294
+ */
2295
+
2296
+ function _dispatchable(methodNames, transducerCreator, fn) {
2297
+ return function () {
2298
+ if (arguments.length === 0) {
2299
+ return fn();
2300
+ }
2301
+
2302
+ var obj = arguments[arguments.length - 1];
2303
+
2304
+ if (!_isArray(obj)) {
2305
+ var idx = 0;
2306
+
2307
+ while (idx < methodNames.length) {
2308
+ if (typeof obj[methodNames[idx]] === 'function') {
2309
+ return obj[methodNames[idx]].apply(obj, Array.prototype.slice.call(arguments, 0, -1));
2310
+ }
2311
+
2312
+ idx += 1;
2313
+ }
2314
+
2315
+ if (_isTransformer(obj)) {
2316
+ var transducer = transducerCreator.apply(null, Array.prototype.slice.call(arguments, 0, -1));
2317
+ return transducer(obj);
2318
+ }
2319
+ }
2320
+
2321
+ return fn.apply(this, arguments);
2322
+ };
2323
+ }
2324
+
2325
+ var _xfBase = {
2326
+ init: function () {
2327
+ return this.xf['@@transducer/init']();
2328
+ },
2329
+ result: function (result) {
2330
+ return this.xf['@@transducer/result'](result);
2331
+ }
2332
+ };
2333
+
2334
+ function _isString(x) {
2335
+ return Object.prototype.toString.call(x) === '[object String]';
2336
+ }
2337
+
2338
+ /**
2339
+ * Tests whether or not an object is similar to an array.
2340
+ *
2341
+ * @private
2342
+ * @category Type
2343
+ * @category List
2344
+ * @sig * -> Boolean
2345
+ * @param {*} x The object to test.
2346
+ * @return {Boolean} `true` if `x` has a numeric length property and extreme indices defined; `false` otherwise.
2347
+ * @example
2348
+ *
2349
+ * _isArrayLike([]); //=> true
2350
+ * _isArrayLike(true); //=> false
2351
+ * _isArrayLike({}); //=> false
2352
+ * _isArrayLike({length: 10}); //=> false
2353
+ * _isArrayLike({0: 'zero', 9: 'nine', length: 10}); //=> true
2354
+ * _isArrayLike({nodeType: 1, length: 1}) // => false
2355
+ */
2356
+
2357
+ var _isArrayLike =
2358
+ /*#__PURE__*/
2359
+ _curry1(function isArrayLike(x) {
2360
+ if (_isArray(x)) {
2361
+ return true;
2362
+ }
2363
+
2364
+ if (!x) {
2365
+ return false;
2366
+ }
2367
+
2368
+ if (typeof x !== 'object') {
2369
+ return false;
2370
+ }
2371
+
2372
+ if (_isString(x)) {
2373
+ return false;
2374
+ }
2375
+
2376
+ if (x.length === 0) {
2377
+ return true;
2378
+ }
2379
+
2380
+ if (x.length > 0) {
2381
+ return x.hasOwnProperty(0) && x.hasOwnProperty(x.length - 1);
2382
+ }
2383
+
2384
+ return false;
2385
+ });
2386
+
2387
+ var XWrap =
2388
+ /*#__PURE__*/
2389
+ function () {
2390
+ function XWrap(fn) {
2391
+ this.f = fn;
2392
+ }
2393
+
2394
+ XWrap.prototype['@@transducer/init'] = function () {
2395
+ throw new Error('init not implemented on XWrap');
2396
+ };
2397
+
2398
+ XWrap.prototype['@@transducer/result'] = function (acc) {
2399
+ return acc;
2400
+ };
2401
+
2402
+ XWrap.prototype['@@transducer/step'] = function (acc, x) {
2403
+ return this.f(acc, x);
2404
+ };
2405
+
2406
+ return XWrap;
2407
+ }();
2408
+
2409
+ function _xwrap(fn) {
2410
+ return new XWrap(fn);
2411
+ }
2412
+
2413
+ /**
2414
+ * Creates a function that is bound to a context.
2415
+ * Note: `R.bind` does not provide the additional argument-binding capabilities of
2416
+ * [Function.prototype.bind](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind).
2417
+ *
2418
+ * @func
2419
+ * @memberOf R
2420
+ * @since v0.6.0
2421
+ * @category Function
2422
+ * @category Object
2423
+ * @sig (* -> *) -> {*} -> (* -> *)
2424
+ * @param {Function} fn The function to bind to context
2425
+ * @param {Object} thisObj The context to bind `fn` to
2426
+ * @return {Function} A function that will execute in the context of `thisObj`.
2427
+ * @see R.partial
2428
+ * @example
2429
+ *
2430
+ * const log = R.bind(console.log, console);
2431
+ * R.pipe(R.assoc('a', 2), R.tap(log), R.assoc('a', 3))({a: 1}); //=> {a: 3}
2432
+ * // logs {a: 2}
2433
+ * @symb R.bind(f, o)(a, b) = f.call(o, a, b)
2434
+ */
2435
+
2436
+ var bind =
2437
+ /*#__PURE__*/
2438
+ _curry2(function bind(fn, thisObj) {
2439
+ return _arity(fn.length, function () {
2440
+ return fn.apply(thisObj, arguments);
2441
+ });
2442
+ });
2443
+
2444
+ function _arrayReduce(xf, acc, list) {
2445
+ var idx = 0;
2446
+ var len = list.length;
2447
+
2448
+ while (idx < len) {
2449
+ acc = xf['@@transducer/step'](acc, list[idx]);
2450
+
2451
+ if (acc && acc['@@transducer/reduced']) {
2452
+ acc = acc['@@transducer/value'];
2453
+ break;
2454
+ }
2455
+
2456
+ idx += 1;
2457
+ }
2458
+
2459
+ return xf['@@transducer/result'](acc);
2460
+ }
2461
+
2462
+ function _iterableReduce(xf, acc, iter) {
2463
+ var step = iter.next();
2464
+
2465
+ while (!step.done) {
2466
+ acc = xf['@@transducer/step'](acc, step.value);
2467
+
2468
+ if (acc && acc['@@transducer/reduced']) {
2469
+ acc = acc['@@transducer/value'];
2470
+ break;
2471
+ }
2472
+
2473
+ step = iter.next();
2474
+ }
2475
+
2476
+ return xf['@@transducer/result'](acc);
2477
+ }
2478
+
2479
+ function _methodReduce(xf, acc, obj, methodName) {
2480
+ return xf['@@transducer/result'](obj[methodName](bind(xf['@@transducer/step'], xf), acc));
2481
+ }
2482
+
2483
+ var symIterator = typeof Symbol !== 'undefined' ? Symbol.iterator : '@@iterator';
2484
+ function _reduce(fn, acc, list) {
2485
+ if (typeof fn === 'function') {
2486
+ fn = _xwrap(fn);
2487
+ }
2488
+
2489
+ if (_isArrayLike(list)) {
2490
+ return _arrayReduce(fn, acc, list);
2491
+ }
2492
+
2493
+ if (typeof list['fantasy-land/reduce'] === 'function') {
2494
+ return _methodReduce(fn, acc, list, 'fantasy-land/reduce');
2495
+ }
2496
+
2497
+ if (list[symIterator] != null) {
2498
+ return _iterableReduce(fn, acc, list[symIterator]());
2499
+ }
2500
+
2501
+ if (typeof list.next === 'function') {
2502
+ return _iterableReduce(fn, acc, list);
2503
+ }
2504
+
2505
+ if (typeof list.reduce === 'function') {
2506
+ return _methodReduce(fn, acc, list, 'reduce');
2507
+ }
2508
+
2509
+ throw new TypeError('reduce: list must be array or iterable');
2510
+ }
2511
+
2512
+ function _has(prop, obj) {
2513
+ return Object.prototype.hasOwnProperty.call(obj, prop);
2514
+ }
2515
+
2516
+ var toString = Object.prototype.toString;
2517
+
2518
+ var _isArguments =
2519
+ /*#__PURE__*/
2520
+ function () {
2521
+ return toString.call(arguments) === '[object Arguments]' ? function _isArguments(x) {
2522
+ return toString.call(x) === '[object Arguments]';
2523
+ } : function _isArguments(x) {
2524
+ return _has('callee', x);
2525
+ };
2526
+ }();
2527
+
2528
+ var hasEnumBug = !
2529
+ /*#__PURE__*/
2530
+ {
2531
+ toString: null
2532
+ }.propertyIsEnumerable('toString');
2533
+ var nonEnumerableProps = ['constructor', 'valueOf', 'isPrototypeOf', 'toString', 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString']; // Safari bug
2534
+
2535
+ var hasArgsEnumBug =
2536
+ /*#__PURE__*/
2537
+ function () {
2538
+
2539
+ return arguments.propertyIsEnumerable('length');
2540
+ }();
2541
+
2542
+ var contains = function contains(list, item) {
2543
+ var idx = 0;
2544
+
2545
+ while (idx < list.length) {
2546
+ if (list[idx] === item) {
2547
+ return true;
2548
+ }
2549
+
2550
+ idx += 1;
2551
+ }
2552
+
2553
+ return false;
2554
+ };
2555
+ /**
2556
+ * Returns a list containing the names of all the enumerable own properties of
2557
+ * the supplied object.
2558
+ * Note that the order of the output array is not guaranteed to be consistent
2559
+ * across different JS platforms.
2560
+ *
2561
+ * @func
2562
+ * @memberOf R
2563
+ * @since v0.1.0
2564
+ * @category Object
2565
+ * @sig {k: v} -> [k]
2566
+ * @param {Object} obj The object to extract properties from
2567
+ * @return {Array} An array of the object's own properties.
2568
+ * @see R.keysIn, R.values, R.toPairs
2569
+ * @example
2570
+ *
2571
+ * R.keys({a: 1, b: 2, c: 3}); //=> ['a', 'b', 'c']
2572
+ */
2573
+
2574
+
2575
+ var keys = typeof Object.keys === 'function' && !hasArgsEnumBug ?
2576
+ /*#__PURE__*/
2577
+ _curry1(function keys(obj) {
2578
+ return Object(obj) !== obj ? [] : Object.keys(obj);
2579
+ }) :
2580
+ /*#__PURE__*/
2581
+ _curry1(function keys(obj) {
2582
+ if (Object(obj) !== obj) {
2583
+ return [];
2584
+ }
2585
+
2586
+ var prop, nIdx;
2587
+ var ks = [];
2588
+
2589
+ var checkArgsLength = hasArgsEnumBug && _isArguments(obj);
2590
+
2591
+ for (prop in obj) {
2592
+ if (_has(prop, obj) && (!checkArgsLength || prop !== 'length')) {
2593
+ ks[ks.length] = prop;
2594
+ }
2595
+ }
2596
+
2597
+ if (hasEnumBug) {
2598
+ nIdx = nonEnumerableProps.length - 1;
2599
+
2600
+ while (nIdx >= 0) {
2601
+ prop = nonEnumerableProps[nIdx];
2602
+
2603
+ if (_has(prop, obj) && !contains(ks, prop)) {
2604
+ ks[ks.length] = prop;
2605
+ }
2606
+
2607
+ nIdx -= 1;
2608
+ }
2609
+ }
2610
+
2611
+ return ks;
2612
+ });
2613
+
2614
+ /**
2615
+ * Gives a single-word string description of the (native) type of a value,
2616
+ * returning such answers as 'Object', 'Number', 'Array', or 'Null'. Does not
2617
+ * attempt to distinguish user Object types any further, reporting them all as
2618
+ * 'Object'.
2619
+ *
2620
+ * @func
2621
+ * @memberOf R
2622
+ * @since v0.8.0
2623
+ * @category Type
2624
+ * @sig (* -> {*}) -> String
2625
+ * @param {*} val The value to test
2626
+ * @return {String}
2627
+ * @example
2628
+ *
2629
+ * R.type({}); //=> "Object"
2630
+ * R.type(1); //=> "Number"
2631
+ * R.type(false); //=> "Boolean"
2632
+ * R.type('s'); //=> "String"
2633
+ * R.type(null); //=> "Null"
2634
+ * R.type([]); //=> "Array"
2635
+ * R.type(/[A-z]/); //=> "RegExp"
2636
+ * R.type(() => {}); //=> "Function"
2637
+ * R.type(undefined); //=> "Undefined"
2638
+ */
2639
+
2640
+ var type =
2641
+ /*#__PURE__*/
2642
+ _curry1(function type(val) {
2643
+ return val === null ? 'Null' : val === undefined ? 'Undefined' : Object.prototype.toString.call(val).slice(8, -1);
2644
+ });
2645
+
2646
+ function _arrayFromIterator(iter) {
2647
+ var list = [];
2648
+ var next;
2649
+
2650
+ while (!(next = iter.next()).done) {
2651
+ list.push(next.value);
2652
+ }
2653
+
2654
+ return list;
2655
+ }
2656
+
2657
+ function _includesWith(pred, x, list) {
2658
+ var idx = 0;
2659
+ var len = list.length;
2660
+
2661
+ while (idx < len) {
2662
+ if (pred(x, list[idx])) {
2663
+ return true;
2664
+ }
2665
+
2666
+ idx += 1;
2667
+ }
2668
+
2669
+ return false;
2670
+ }
2671
+
2672
+ function _functionName(f) {
2673
+ // String(x => x) evaluates to "x => x", so the pattern may not match.
2674
+ var match = String(f).match(/^function (\w*)/);
2675
+ return match == null ? '' : match[1];
2676
+ }
2677
+
2678
+ // Based on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
2679
+ function _objectIs(a, b) {
2680
+ // SameValue algorithm
2681
+ if (a === b) {
2682
+ // Steps 1-5, 7-10
2683
+ // Steps 6.b-6.e: +0 != -0
2684
+ return a !== 0 || 1 / a === 1 / b;
2685
+ } else {
2686
+ // Step 6.a: NaN == NaN
2687
+ return a !== a && b !== b;
2688
+ }
2689
+ }
2690
+
2691
+ var _objectIs$1 = typeof Object.is === 'function' ? Object.is : _objectIs;
2692
+
2693
+ /**
2694
+ * private _uniqContentEquals function.
2695
+ * That function is checking equality of 2 iterator contents with 2 assumptions
2696
+ * - iterators lengths are the same
2697
+ * - iterators values are unique
2698
+ *
2699
+ * false-positive result will be returned for comparison of, e.g.
2700
+ * - [1,2,3] and [1,2,3,4]
2701
+ * - [1,1,1] and [1,2,3]
2702
+ * */
2703
+
2704
+ function _uniqContentEquals(aIterator, bIterator, stackA, stackB) {
2705
+ var a = _arrayFromIterator(aIterator);
2706
+
2707
+ var b = _arrayFromIterator(bIterator);
2708
+
2709
+ function eq(_a, _b) {
2710
+ return _equals(_a, _b, stackA.slice(), stackB.slice());
2711
+ } // if *a* array contains any element that is not included in *b*
2712
+
2713
+
2714
+ return !_includesWith(function (b, aItem) {
2715
+ return !_includesWith(eq, aItem, b);
2716
+ }, b, a);
2717
+ }
2718
+
2719
+ function _equals(a, b, stackA, stackB) {
2720
+ if (_objectIs$1(a, b)) {
2721
+ return true;
2722
+ }
2723
+
2724
+ var typeA = type(a);
2725
+
2726
+ if (typeA !== type(b)) {
2727
+ return false;
2728
+ }
2729
+
2730
+ if (typeof a['fantasy-land/equals'] === 'function' || typeof b['fantasy-land/equals'] === 'function') {
2731
+ return typeof a['fantasy-land/equals'] === 'function' && a['fantasy-land/equals'](b) && typeof b['fantasy-land/equals'] === 'function' && b['fantasy-land/equals'](a);
2732
+ }
2733
+
2734
+ if (typeof a.equals === 'function' || typeof b.equals === 'function') {
2735
+ return typeof a.equals === 'function' && a.equals(b) && typeof b.equals === 'function' && b.equals(a);
2736
+ }
2737
+
2738
+ switch (typeA) {
2739
+ case 'Arguments':
2740
+ case 'Array':
2741
+ case 'Object':
2742
+ if (typeof a.constructor === 'function' && _functionName(a.constructor) === 'Promise') {
2743
+ return a === b;
2744
+ }
2745
+
2746
+ break;
2747
+
2748
+ case 'Boolean':
2749
+ case 'Number':
2750
+ case 'String':
2751
+ if (!(typeof a === typeof b && _objectIs$1(a.valueOf(), b.valueOf()))) {
2752
+ return false;
2753
+ }
2754
+
2755
+ break;
2756
+
2757
+ case 'Date':
2758
+ if (!_objectIs$1(a.valueOf(), b.valueOf())) {
2759
+ return false;
2760
+ }
2761
+
2762
+ break;
2763
+
2764
+ case 'Error':
2765
+ return a.name === b.name && a.message === b.message;
2766
+
2767
+ case 'RegExp':
2768
+ if (!(a.source === b.source && a.global === b.global && a.ignoreCase === b.ignoreCase && a.multiline === b.multiline && a.sticky === b.sticky && a.unicode === b.unicode)) {
2769
+ return false;
2770
+ }
2771
+
2772
+ break;
2773
+ }
2774
+
2775
+ var idx = stackA.length - 1;
2776
+
2777
+ while (idx >= 0) {
2778
+ if (stackA[idx] === a) {
2779
+ return stackB[idx] === b;
2780
+ }
2781
+
2782
+ idx -= 1;
2783
+ }
2784
+
2785
+ switch (typeA) {
2786
+ case 'Map':
2787
+ if (a.size !== b.size) {
2788
+ return false;
2789
+ }
2790
+
2791
+ return _uniqContentEquals(a.entries(), b.entries(), stackA.concat([a]), stackB.concat([b]));
2792
+
2793
+ case 'Set':
2794
+ if (a.size !== b.size) {
2795
+ return false;
2796
+ }
2797
+
2798
+ return _uniqContentEquals(a.values(), b.values(), stackA.concat([a]), stackB.concat([b]));
2799
+
2800
+ case 'Arguments':
2801
+ case 'Array':
2802
+ case 'Object':
2803
+ case 'Boolean':
2804
+ case 'Number':
2805
+ case 'String':
2806
+ case 'Date':
2807
+ case 'Error':
2808
+ case 'RegExp':
2809
+ case 'Int8Array':
2810
+ case 'Uint8Array':
2811
+ case 'Uint8ClampedArray':
2812
+ case 'Int16Array':
2813
+ case 'Uint16Array':
2814
+ case 'Int32Array':
2815
+ case 'Uint32Array':
2816
+ case 'Float32Array':
2817
+ case 'Float64Array':
2818
+ case 'ArrayBuffer':
2819
+ break;
2820
+
2821
+ default:
2822
+ // Values of other types are only equal if identical.
2823
+ return false;
2824
+ }
2825
+
2826
+ var keysA = keys(a);
2827
+
2828
+ if (keysA.length !== keys(b).length) {
2829
+ return false;
2830
+ }
2831
+
2832
+ var extendedStackA = stackA.concat([a]);
2833
+ var extendedStackB = stackB.concat([b]);
2834
+ idx = keysA.length - 1;
2835
+
2836
+ while (idx >= 0) {
2837
+ var key = keysA[idx];
2838
+
2839
+ if (!(_has(key, b) && _equals(b[key], a[key], extendedStackA, extendedStackB))) {
2840
+ return false;
2841
+ }
2842
+
2843
+ idx -= 1;
2844
+ }
2845
+
2846
+ return true;
2847
+ }
2848
+
2849
+ /**
2850
+ * Returns `true` if its arguments are equivalent, `false` otherwise. Handles
2851
+ * cyclical data structures.
2852
+ *
2853
+ * Dispatches symmetrically to the `equals` methods of both arguments, if
2854
+ * present.
2855
+ *
2856
+ * @func
2857
+ * @memberOf R
2858
+ * @since v0.15.0
2859
+ * @category Relation
2860
+ * @sig a -> b -> Boolean
2861
+ * @param {*} a
2862
+ * @param {*} b
2863
+ * @return {Boolean}
2864
+ * @example
2865
+ *
2866
+ * R.equals(1, 1); //=> true
2867
+ * R.equals(1, '1'); //=> false
2868
+ * R.equals([1, 2, 3], [1, 2, 3]); //=> true
2869
+ *
2870
+ * const a = {}; a.v = a;
2871
+ * const b = {}; b.v = b;
2872
+ * R.equals(a, b); //=> true
2873
+ */
2874
+
2875
+ var equals =
2876
+ /*#__PURE__*/
2877
+ _curry2(function equals(a, b) {
2878
+ return _equals(a, b, [], []);
2879
+ });
2880
+
2881
+ function _complement(f) {
2882
+ return function () {
2883
+ return !f.apply(this, arguments);
2884
+ };
2885
+ }
2886
+
2887
+ function _filter(fn, list) {
2888
+ var idx = 0;
2889
+ var len = list.length;
2890
+ var result = [];
2891
+
2892
+ while (idx < len) {
2893
+ if (fn(list[idx])) {
2894
+ result[result.length] = list[idx];
2895
+ }
2896
+
2897
+ idx += 1;
2898
+ }
2899
+
2900
+ return result;
2901
+ }
2902
+
2903
+ function _isObject(x) {
2904
+ return Object.prototype.toString.call(x) === '[object Object]';
2905
+ }
2906
+
2907
+ var XFilter =
2908
+ /*#__PURE__*/
2909
+ function () {
2910
+ function XFilter(f, xf) {
2911
+ this.xf = xf;
2912
+ this.f = f;
2913
+ }
2914
+
2915
+ XFilter.prototype['@@transducer/init'] = _xfBase.init;
2916
+ XFilter.prototype['@@transducer/result'] = _xfBase.result;
2917
+
2918
+ XFilter.prototype['@@transducer/step'] = function (result, input) {
2919
+ return this.f(input) ? this.xf['@@transducer/step'](result, input) : result;
2920
+ };
2921
+
2922
+ return XFilter;
2923
+ }();
2924
+
2925
+ var _xfilter =
2926
+ /*#__PURE__*/
2927
+ _curry2(function _xfilter(f, xf) {
2928
+ return new XFilter(f, xf);
2929
+ });
2930
+
2931
+ /**
2932
+ * Takes a predicate and a `Filterable`, and returns a new filterable of the
2933
+ * same type containing the members of the given filterable which satisfy the
2934
+ * given predicate. Filterable objects include plain objects or any object
2935
+ * that has a filter method such as `Array`.
2936
+ *
2937
+ * Dispatches to the `filter` method of the second argument, if present.
2938
+ *
2939
+ * Acts as a transducer if a transformer is given in list position.
2940
+ *
2941
+ * @func
2942
+ * @memberOf R
2943
+ * @since v0.1.0
2944
+ * @category List
2945
+ * @sig Filterable f => (a -> Boolean) -> f a -> f a
2946
+ * @param {Function} pred
2947
+ * @param {Array} filterable
2948
+ * @return {Array} Filterable
2949
+ * @see R.reject, R.transduce, R.addIndex
2950
+ * @example
2951
+ *
2952
+ * const isEven = n => n % 2 === 0;
2953
+ *
2954
+ * R.filter(isEven, [1, 2, 3, 4]); //=> [2, 4]
2955
+ *
2956
+ * R.filter(isEven, {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, d: 4}
2957
+ */
2958
+
2959
+ var filter =
2960
+ /*#__PURE__*/
2961
+ _curry2(
2962
+ /*#__PURE__*/
2963
+ _dispatchable(['fantasy-land/filter', 'filter'], _xfilter, function (pred, filterable) {
2964
+ return _isObject(filterable) ? _reduce(function (acc, key) {
2965
+ if (pred(filterable[key])) {
2966
+ acc[key] = filterable[key];
2967
+ }
2968
+
2969
+ return acc;
2970
+ }, {}, keys(filterable)) : // else
2971
+ _filter(pred, filterable);
2972
+ }));
2973
+
2974
+ /**
2975
+ * The complement of [`filter`](#filter).
2976
+ *
2977
+ * Acts as a transducer if a transformer is given in list position. Filterable
2978
+ * objects include plain objects or any object that has a filter method such
2979
+ * as `Array`.
2980
+ *
2981
+ * @func
2982
+ * @memberOf R
2983
+ * @since v0.1.0
2984
+ * @category List
2985
+ * @sig Filterable f => (a -> Boolean) -> f a -> f a
2986
+ * @param {Function} pred
2987
+ * @param {Array} filterable
2988
+ * @return {Array}
2989
+ * @see R.filter, R.transduce, R.addIndex
2990
+ * @example
2991
+ *
2992
+ * const isOdd = (n) => n % 2 !== 0;
2993
+ *
2994
+ * R.reject(isOdd, [1, 2, 3, 4]); //=> [2, 4]
2995
+ *
2996
+ * R.reject(isOdd, {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, d: 4}
2997
+ */
2998
+
2999
+ var reject =
3000
+ /*#__PURE__*/
3001
+ _curry2(function reject(pred, filterable) {
3002
+ return filter(_complement(pred), filterable);
3003
+ });
3004
+
3005
+ /**
3006
+ * Creates a new object with the own properties of the two provided objects. If
3007
+ * a key exists in both objects, the provided function is applied to the key
3008
+ * and the values associated with the key in each object, with the result being
3009
+ * used as the value associated with the key in the returned object.
3010
+ *
3011
+ * @func
3012
+ * @memberOf R
3013
+ * @since v0.19.0
3014
+ * @category Object
3015
+ * @sig ((String, a, a) -> a) -> {a} -> {a} -> {a}
3016
+ * @param {Function} fn
3017
+ * @param {Object} l
3018
+ * @param {Object} r
3019
+ * @return {Object}
3020
+ * @see R.mergeDeepWithKey, R.merge, R.mergeWith
3021
+ * @example
3022
+ *
3023
+ * let concatValues = (k, l, r) => k == 'values' ? R.concat(l, r) : r
3024
+ * R.mergeWithKey(concatValues,
3025
+ * { a: true, thing: 'foo', values: [10, 20] },
3026
+ * { b: true, thing: 'bar', values: [15, 35] });
3027
+ * //=> { a: true, b: true, thing: 'bar', values: [10, 20, 15, 35] }
3028
+ * @symb R.mergeWithKey(f, { x: 1, y: 2 }, { y: 5, z: 3 }) = { x: 1, y: f('y', 2, 5), z: 3 }
3029
+ */
3030
+
3031
+ var mergeWithKey =
3032
+ /*#__PURE__*/
3033
+ _curry3(function mergeWithKey(fn, l, r) {
3034
+ var result = {};
3035
+ var k;
3036
+
3037
+ for (k in l) {
3038
+ if (_has(k, l)) {
3039
+ result[k] = _has(k, r) ? fn(k, l[k], r[k]) : l[k];
3040
+ }
3041
+ }
3042
+
3043
+ for (k in r) {
3044
+ if (_has(k, r) && !_has(k, result)) {
3045
+ result[k] = r[k];
3046
+ }
3047
+ }
3048
+
3049
+ return result;
3050
+ });
3051
+
3052
+ /**
3053
+ * Creates a new object with the own properties of the two provided objects.
3054
+ * If a key exists in both objects:
3055
+ * - and both associated values are also objects then the values will be
3056
+ * recursively merged.
3057
+ * - otherwise the provided function is applied to the key and associated values
3058
+ * using the resulting value as the new value associated with the key.
3059
+ * If a key only exists in one object, the value will be associated with the key
3060
+ * of the resulting object.
3061
+ *
3062
+ * @func
3063
+ * @memberOf R
3064
+ * @since v0.24.0
3065
+ * @category Object
3066
+ * @sig ((String, a, a) -> a) -> {a} -> {a} -> {a}
3067
+ * @param {Function} fn
3068
+ * @param {Object} lObj
3069
+ * @param {Object} rObj
3070
+ * @return {Object}
3071
+ * @see R.mergeWithKey, R.mergeDeepWith
3072
+ * @example
3073
+ *
3074
+ * let concatValues = (k, l, r) => k == 'values' ? R.concat(l, r) : r
3075
+ * R.mergeDeepWithKey(concatValues,
3076
+ * { a: true, c: { thing: 'foo', values: [10, 20] }},
3077
+ * { b: true, c: { thing: 'bar', values: [15, 35] }});
3078
+ * //=> { a: true, b: true, c: { thing: 'bar', values: [10, 20, 15, 35] }}
3079
+ */
3080
+
3081
+ var mergeDeepWithKey =
3082
+ /*#__PURE__*/
3083
+ _curry3(function mergeDeepWithKey(fn, lObj, rObj) {
3084
+ return mergeWithKey(function (k, lVal, rVal) {
3085
+ if (_isObject(lVal) && _isObject(rVal)) {
3086
+ return mergeDeepWithKey(fn, lVal, rVal);
3087
+ } else {
3088
+ return fn(k, lVal, rVal);
3089
+ }
3090
+ }, lObj, rObj);
3091
+ });
3092
+
3093
+ /**
3094
+ * Creates a new object with the own properties of the first object merged with
3095
+ * the own properties of the second object. If a key exists in both objects:
3096
+ * - and both values are objects, the two values will be recursively merged
3097
+ * - otherwise the value from the second object will be used.
3098
+ *
3099
+ * @func
3100
+ * @memberOf R
3101
+ * @since v0.24.0
3102
+ * @category Object
3103
+ * @sig {a} -> {a} -> {a}
3104
+ * @param {Object} lObj
3105
+ * @param {Object} rObj
3106
+ * @return {Object}
3107
+ * @see R.merge, R.mergeDeepLeft, R.mergeDeepWith, R.mergeDeepWithKey
3108
+ * @example
3109
+ *
3110
+ * R.mergeDeepRight({ name: 'fred', age: 10, contact: { email: 'moo@example.com' }},
3111
+ * { age: 40, contact: { email: 'baa@example.com' }});
3112
+ * //=> { name: 'fred', age: 40, contact: { email: 'baa@example.com' }}
3113
+ */
3114
+
3115
+ var mergeDeepRight =
3116
+ /*#__PURE__*/
3117
+ _curry2(function mergeDeepRight(lObj, rObj) {
3118
+ return mergeDeepWithKey(function (k, lVal, rVal) {
3119
+ return rVal;
3120
+ }, lObj, rObj);
3121
+ });
3122
+
3123
+ function MultiCheckbox({ defaultValue = [], isInline = false, isLabelHidden = false, label, name, onChange, options }) {
3124
+ const checkedOptionValues = useRef(defaultValue);
3125
+ const key = useMemo(() => `${name}-${JSON.stringify(defaultValue)}`, [defaultValue, name]);
3126
+ const handleChange = useCallback((nextOptionValue, isChecked) => {
3127
+ const nextCheckedOptionValues = isChecked
3128
+ ? [...checkedOptionValues.current, nextOptionValue]
3129
+ : reject(equals(nextOptionValue))(checkedOptionValues.current);
3130
+ checkedOptionValues.current = nextCheckedOptionValues;
3131
+ if (onChange) {
3132
+ const normalizedNextValue = nextCheckedOptionValues.length ? nextCheckedOptionValues : undefined;
3133
+ onChange(normalizedNextValue);
3134
+ }
3135
+ }, [onChange]);
3136
+ return (jsxs(Fieldset, { children: [jsx(Legend, { isHidden: isLabelHidden, children: label }), jsx(ChecboxesBox$1, { isInline: isInline, children: options.map((option, index) => (jsx(Checkbox
3137
+ // eslint-disable-next-line react/no-array-index-key
3138
+ , { defaultChecked: defaultValue.includes(option.value), label: option.label, name: `${name}${index}`, onChange: (isChecked) => handleChange(option.value, isChecked) }, `${name}-${index}`))) })] }, key));
3139
+ }
3140
+ const ChecboxesBox$1 = styled.div `
3141
+ color: ${p => p.theme.color.gunMetal};
3142
+ display: flex;
3143
+ flex-direction: ${p => (p.isInline ? 'row' : 'column')};
3144
+ font-weight: 500;
3145
+
3146
+ > .rs-checkbox {
3147
+ > .rs-checkbox-checker {
3148
+ padding-left: 28px;
3149
+ padding-top: 2px;
3150
+
3151
+ .rs-checkbox-wrapper {
3152
+ left: 2px;
3153
+ top: 0 !important;
3154
+ }
3155
+ }
3156
+ }
3157
+
3158
+ ${p => p.isInline &&
3159
+ css `
3160
+ > .rs-checkbox:not(:first-child) {
3161
+ margin-left: 0.75rem;
3162
+ }
3163
+ `}
3164
+ `;
3165
+
3166
+ function MultiSelect({ fixedWidth = 5, isLabelHidden = false, label, onChange, options,
3167
+ // eslint-disable-next-line @typescript-eslint/naming-convention
3168
+ searchable = false, ...originalProps }) {
3169
+ const key = useMemo(() => `${originalProps.name}-${JSON.stringify(originalProps.defaultValue)}`, [originalProps.defaultValue, originalProps.name]);
3170
+ const handleChange = useCallback((nextValue) => {
3171
+ if (!onChange) {
3172
+ return;
3173
+ }
3174
+ const normalizedNextValue = !nextValue || !nextValue.length ? undefined : nextValue;
3175
+ onChange(normalizedNextValue);
3176
+ }, [onChange]);
3177
+ return (jsxs(Field$2, { children: [jsx(Label, { htmlFor: originalProps.name, isHidden: isLabelHidden, children: label }), jsx(StyledTagPicker, { data: options, fixedWidth: fixedWidth, id: originalProps.name, onChange: handleChange, searchable: searchable, ...originalProps }, key)] }));
3178
+ }
3179
+ // TODO A width seems to be mandatory in rsuite which is a very dirty behavior.
3180
+ // We should hack that.
3181
+ const StyledTagPicker = styled(TagPicker) `
3182
+ cursor: pointer;
3183
+ width: ${p => p.fixedWidth}rem;
3184
+
3185
+ > .rs-picker-toggle {
3186
+ cursor: inherit;
3187
+ }
3188
+ `;
3189
+
3190
+ function MultiRadio({ defaultValue, isInline = false, isLabelHidden = false, label, name, onChange, options }) {
3191
+ const [checkedOptionValue, setCheckedOptionValue] = useState(undefined);
3192
+ const key = useMemo(() => `${name}-${String(checkedOptionValue)}}`, [checkedOptionValue, name]);
3193
+ const handleChange = useCallback((nextOptionValue, isChecked) => {
3194
+ const nextCheckedOptionValue = isChecked ? nextOptionValue : undefined;
3195
+ setCheckedOptionValue(nextCheckedOptionValue);
3196
+ if (onChange) {
3197
+ onChange(nextCheckedOptionValue);
3198
+ }
3199
+ }, [onChange]);
3200
+ // TODO There may be a better solution.
3201
+ // A key change is not enough to force radio checked check changes
3202
+ // on `defaultValue` property update (even when appending `defaultValue` to `key`),
3203
+ // we need to force a second re-render in order for the changes to be applied.
3204
+ useEffect(() => {
3205
+ setCheckedOptionValue(defaultValue);
3206
+ }, [defaultValue]);
3207
+ return (jsxs(Fieldset, { children: [jsx(Legend, { isHidden: isLabelHidden, children: label }), jsx(ChecboxesBox, { isInline: isInline, children: options.map((option, index) => (jsx(Radio
3208
+ // eslint-disable-next-line react/no-array-index-key
3209
+ , { defaultChecked: option.value === checkedOptionValue, name: name, onChange: (_, isChecked) => handleChange(option.value, isChecked), children: option.label }, `${name}-${index}`))) })] }, key));
3210
+ }
3211
+ const ChecboxesBox = styled.div `
3212
+ color: ${p => p.theme.color.gunMetal};
3213
+ display: flex;
3214
+ flex-direction: ${p => (p.isInline ? 'row' : 'column')};
3215
+ font-weight: 500;
3216
+
3217
+ > .rs-radio {
3218
+ > .rs-radio-checker {
3219
+ padding-left: 28px;
3220
+ padding-top: 2px;
3221
+
3222
+ .rs-radio-wrapper {
3223
+ left: 2px;
3224
+ top: 3px !important;
3225
+ }
3226
+ }
3227
+ }
3228
+
3229
+ ${p => p.isInline &&
3230
+ css `
3231
+ > .rs-radio:not(:first-child) {
3232
+ margin-left: 0.75rem;
3233
+ }
3234
+ `}
3235
+ `;
3236
+
3237
+ function Select({ isLabelHidden = false, label, onChange, options,
3238
+ // eslint-disable-next-line @typescript-eslint/naming-convention
3239
+ searchable = false, ...originalProps }) {
3240
+ const key = useMemo(() => `${originalProps.name}-${JSON.stringify(originalProps.defaultValue)}`, [originalProps.defaultValue, originalProps.name]);
3241
+ const handleChange = useCallback((nextValue) => {
3242
+ if (!onChange) {
3243
+ return;
3244
+ }
3245
+ const normalizedNextValue = nextValue ?? undefined;
3246
+ onChange(normalizedNextValue);
3247
+ }, [onChange]);
3248
+ return (jsxs(Field$2, { children: [jsx(Label, { htmlFor: originalProps.name, isHidden: isLabelHidden, children: label }), jsx(StyledSelectPicker, { data: options, id: originalProps.name,
3249
+ // The `unknown` type from Rsuite library is wrong. It should be inferred from `data` prop type.
3250
+ // `onChange: ((value: unknown, event: React.SyntheticEvent<Element, Event>) => void) | undefined`
3251
+ onChange: handleChange, searchable: searchable, ...originalProps }, key)] }));
3252
+ }
3253
+ const StyledSelectPicker = styled(SelectPicker) ``;
3254
+
3255
+ function Textarea({ isLabelHidden = false, label, onChange, rows = 3, ...originalProps }) {
3256
+ const inputRef = useRef();
3257
+ const key = useMemo(() => `${originalProps.name}-${JSON.stringify(originalProps.defaultValue)}`, [originalProps.defaultValue, originalProps.name]);
3258
+ const handleChange = useCallback(() => {
3259
+ if (!onChange) {
3260
+ return;
3261
+ }
3262
+ const nextValue = inputRef.current.value.trim();
3263
+ const normalizedNextValue = nextValue.length ? nextValue : undefined;
3264
+ onChange(normalizedNextValue);
3265
+ }, [onChange]);
3266
+ return (jsxs(Field$2, { children: [jsx(Label, { htmlFor: originalProps.name, isHidden: isLabelHidden, children: label }), jsx(StyledInput$1, { ref: inputRef, as: "textarea", id: originalProps.name, onChange: handleChange, rows: rows, ...originalProps }, key)] }));
3267
+ }
3268
+ const StyledInput$1 = styled(Input) `
3269
+ background-color: ${p => p.theme.color.gainsboro};
3270
+ border: 0;
3271
+ width: 100%;
3272
+ `;
3273
+
3274
+ function TextInput({ isLabelHidden = false, label, onChange, ...originalProps }) {
3275
+ const key = useMemo(() => `${originalProps.name}-${JSON.stringify(originalProps.defaultValue)}`, [originalProps.defaultValue, originalProps.name]);
3276
+ const handleChange = useCallback((nextValue) => {
3277
+ if (!onChange) {
3278
+ return;
3279
+ }
3280
+ const normalizedNextValue = nextValue && nextValue.trim().length ? nextValue : undefined;
3281
+ onChange(normalizedNextValue);
3282
+ }, [onChange]);
3283
+ return (jsxs(Field$2, { children: [jsx(Label, { htmlFor: originalProps.name, isHidden: isLabelHidden, children: label }), jsx(StyledInput, { id: originalProps.name, onChange: handleChange, ...originalProps }, key)] }));
3284
+ }
3285
+ const StyledInput = styled(Input) `
3286
+ background-color: ${p => p.theme.color.gainsboro};
3287
+ width: 100%;
3288
+ `;
3289
+
3290
+ function FormikCheckbox({ name, ...originalProps }) {
3291
+ const [field, , helpers] = useField(name);
3292
+ const value = useMemo(() => field.value, [field.value]);
3293
+ // We don't include `setValues` in `useCallback()` and `useEffect()` dependencies
3294
+ // both because it is useless and it will trigger infinite hook calls
3295
+ const setValue = useMemo(() => helpers.setValue, [helpers.setValue]);
3296
+ const handleChange = useCallback((isChecked) => {
3297
+ setValue(isChecked);
3298
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3299
+ }, []);
3300
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3301
+ useEffect(() => () => setValue(undefined), []);
3302
+ return jsx(Checkbox, { defaultChecked: value, name: name, onChange: handleChange, ...originalProps });
3303
+ }
3304
+
3305
+ function FormikDatePicker({ name, ...originalProps }) {
3306
+ const [, , helpers] = useField(name);
3307
+ const { setValue } = helpers;
3308
+ // We don't include `setValues` in `useEffect()` dependencies
3309
+ // both because it is useless and it will trigger infinite hook calls
3310
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3311
+ useEffect(() => () => setValue(undefined), []);
3312
+ return jsx(DatePicker, { onChange: setValue, ...originalProps });
3313
+ }
3314
+
3315
+ function FormikDateRangePicker({ name, ...originalProps }) {
3316
+ const [, , helpers] = useField(name);
3317
+ const { setValue } = helpers;
3318
+ // We don't include `setValues` in `useEffect()` dependencies
3319
+ // both because it is useless and it will trigger infinite hook calls
3320
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3321
+ useEffect(() => () => setValue(undefined), []);
3322
+ return jsx(DateRangePicker, { onChange: setValue, ...originalProps });
3323
+ }
3324
+
3325
+ function FormikEffect({ onChange }) {
3326
+ const { values } = useFormikContext();
3327
+ useEffect(() => {
3328
+ onChange(values);
3329
+ }, [onChange, values]);
3330
+ return jsx(Fragment, {});
3331
+ }
3332
+
3333
+ function FormikMultiCheckbox({ name, ...originalProps }) {
3334
+ const [, , helpers] = useField(name);
3335
+ // We don't include `setValues` in `useCallback()` and `useEffect()` dependencies
3336
+ // both because it is useless and it will trigger infinite hook calls
3337
+ const { setValue } = helpers;
3338
+ const handleChange = useCallback((nextValue) => {
3339
+ setValue(nextValue);
3340
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3341
+ }, []);
3342
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3343
+ useEffect(() => () => setValue(undefined), []);
3344
+ return jsx(MultiCheckbox, { name: name, onChange: handleChange, ...originalProps });
3345
+ }
3346
+
3347
+ function FormikMultiSelect({ name, ...originalProps }) {
3348
+ const [, , helpers] = useField(name);
3349
+ // We don't include `setValues` in `useCallback()` and `useEffect()` dependencies
3350
+ // both because it is useless and it will trigger infinite hook calls
3351
+ const { setValue } = helpers;
3352
+ const handleChange = useCallback((nextValue) => {
3353
+ setValue(nextValue);
3354
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3355
+ }, []);
3356
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3357
+ useEffect(() => () => setValue(undefined), []);
3358
+ return jsx(MultiSelect, { name: name, onChange: handleChange, ...originalProps });
3359
+ }
3360
+
3361
+ function FormikMultiRadio({ name, ...originalProps }) {
3362
+ const [, , helpers] = useField(name);
3363
+ // We don't include `setValues` in `useCallback()` and `useEffect()` dependencies
3364
+ // both because it is useless and it will trigger infinite hook calls
3365
+ const { setValue } = helpers;
3366
+ const handleChange = useCallback((nextValue) => {
3367
+ setValue(nextValue);
3368
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3369
+ }, []);
3370
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3371
+ useEffect(() => () => setValue(undefined), []);
3372
+ return jsx(MultiRadio, { name: name, onChange: handleChange, ...originalProps });
3373
+ }
3374
+
3375
+ function FormikSelect({ name, ...originalProps }) {
3376
+ const [, , helpers] = useField(name);
3377
+ // We don't include `setValues` in `useCallback()` and `useEffect()` dependencies
3378
+ // both because it is useless and it will trigger infinite hook calls
3379
+ const { setValue } = helpers;
3380
+ const handleChange = useCallback((nextValue) => {
3381
+ setValue(nextValue);
3382
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3383
+ }, []);
3384
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3385
+ useEffect(() => () => setValue(undefined), []);
3386
+ return jsx(Select, { name: name, onChange: handleChange, ...originalProps });
3387
+ }
3388
+
3389
+ function FormikTextarea({ name, ...originalProps }) {
3390
+ const [, , helpers] = useField(name);
3391
+ // We don't include `setValues` in `useCallback()` and `useEffect()` dependencies
3392
+ // both because it is useless and it will trigger infinite hook calls
3393
+ const { setValue } = helpers;
3394
+ const handleChange = useCallback((nextValue) => {
3395
+ setValue(nextValue);
3396
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3397
+ }, []);
3398
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3399
+ useEffect(() => () => setValue(undefined), []);
3400
+ return jsx(Textarea, { name: name, onChange: handleChange, ...originalProps });
3401
+ }
3402
+
3403
+ function FormikTextInput({ name, ...originalProps }) {
3404
+ const [, , helpers] = useField(name);
3405
+ // We don't include `setValues` in `useCallback()` and `useEffect()` dependencies
3406
+ // both because it is useless and it will trigger infinite hook calls
3407
+ const { setValue } = helpers;
3408
+ const handleChange = useCallback((nextValue) => {
3409
+ setValue(nextValue);
3410
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3411
+ }, []);
3412
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3413
+ useEffect(() => () => setValue(undefined), []);
3414
+ return jsx(TextInput, { name: name, onChange: handleChange, ...originalProps });
3415
+ }
3416
+
3417
+ const UntypedStyledComponentsThemeProvider = ThemeProvider$1;
3418
+ function ThemeProvider({ children, theme = {} }) {
3419
+ const finalTheme = mergeDeepRight(THEME, theme);
3420
+ return jsx(UntypedStyledComponentsThemeProvider, { theme: finalTheme, children: children });
3421
+ }
3422
+
3423
+ export { Checkbox, DatePicker, DateRangePicker, Field$2 as Field, Fieldset, FormikCheckbox, FormikDatePicker, FormikDateRangePicker, FormikEffect, FormikMultiCheckbox, FormikMultiRadio, FormikMultiSelect, FormikSelect, FormikTextInput, FormikTextarea, Label, Legend, constants as MUI, MultiCheckbox, MultiRadio, MultiSelect, Select, THEME, TextInput, Textarea, ThemeProvider };
3424
+ //# sourceMappingURL=index.js.map