@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
@@ -1,137 +0,0 @@
1
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
- import { useRef, useState, useMemo, useCallback, useEffect } from 'react';
3
- import { DatePicker } from 'rsuite';
4
- import styled, { createGlobalStyle } from 'styled-components';
5
- import { getUtcDayjs } from '../../utils/getUtcDayjs.js';
6
- import { getUtcizedDayjs } from '../../utils/getUtcizedDayjs.js';
7
- import { stopMouseEventPropagation } from '../../utils/stopMouseEventPropagation.js';
8
- import { RSUITE_CALENDAR_LOCALE } from '../DateRangePicker/constants.js';
9
- import { getDateTupleFromDate } from '../DateRangePicker/utils.js';
10
-
11
- function CalendarPicker({ defaultValue, isHistorical, onChange }) {
12
- const boxRef = useRef();
13
- const calendarRef = useRef();
14
- const [isFirstLoad, setIsFirstLoad] = useState(true);
15
- const utcTodayAsDayjs = useMemo(() => getUtcDayjs().endOf('day'), []);
16
- const disabledDate = useMemo(() => (date) => date && isHistorical ? getUtcizedDayjs(date).isAfter(utcTodayAsDayjs) : false, [isHistorical, utcTodayAsDayjs]);
17
- const handleSelect = useCallback((nextDate) => {
18
- const nextDateTuple = getDateTupleFromDate(nextDate);
19
- onChange(nextDateTuple);
20
- }, [onChange]);
21
- useEffect(() => {
22
- // We wait for the <Box /> to render so that `boxRef` is defined
23
- // and can be used as a container for <RsuiteDateRangePicker />
24
- setIsFirstLoad(false);
25
- }, []);
26
- return (jsxs(Fragment, { children: [jsx(GlobalStyleToHideBodyDialog, {}), jsx(Box, { ref: boxRef, onClick: stopMouseEventPropagation, children: !isFirstLoad && (jsx(DatePicker, { ref: calendarRef, container: boxRef.current, disabledDate: disabledDate, format: "yyyy-MM-dd", locale: RSUITE_CALENDAR_LOCALE, oneTap: true, onSelect: handleSelect, open: true, ranges: [],
27
- // `defaultValue` seems to be immediatly cancelled so we come down to using a controlled `value`
28
- value: defaultValue })) })] }));
29
- }
30
- const GlobalStyleToHideBodyDialog = createGlobalStyle `
31
- body > div[role="dialog"].rs-picker-date-menu {
32
- display: none;
33
- }
34
- `;
35
- const Box = styled.div `
36
- height: 0;
37
- position: relative;
38
- user-select: none;
39
-
40
- .rs-picker-toggle {
41
- display: none;
42
- }
43
-
44
- .rs-picker-date-panel {
45
- height: 290px;
46
- }
47
-
48
- .rs-picker-date-menu {
49
- border: solid 1px ${p => p.theme.color.lightGray};
50
- border-radius: 0;
51
- margin-top: 0.25rem;
52
-
53
- .rs-picker-date-header,
54
- .rs-calendar-header-time-toolbar,
55
- .rs-picker-toolbar {
56
- display: none;
57
- }
58
-
59
- .rs-calendar {
60
- height: auto !important;
61
- padding: 0;
62
-
63
- :first-child {
64
- border-right: solid 1px ${p => p.theme.color.lightGray};
65
- }
66
-
67
- .rs-calendar-header {
68
- border-bottom: solid 1px ${p => p.theme.color.lightGray};
69
- padding: 0.5rem;
70
-
71
- .rs-calendar-header-month-toolbar {
72
- align-items: center;
73
- color: ${p => p.theme.color.slateGray};
74
- display: flex;
75
- justify-content: space-between;
76
-
77
- .rs-calendar-header-title {
78
- font-size: inherit;
79
- text-transform: uppercase;
80
-
81
- &.rs-calendar-header-error {
82
- color: ${p => p.theme.color.slateGray};
83
-
84
- :hover {
85
- color: ${p => p.theme.color.slateGray};
86
- }
87
- }
88
- }
89
- }
90
- }
91
-
92
- .rs-calendar-view {
93
- padding: 0.75rem 0.5rem 0;
94
-
95
- .rs-calendar-table-cell {
96
- padding: 0 0 0.25rem 0;
97
- width: 33px;
98
-
99
- &.rs-calendar-table-cell-in-range:before {
100
- background-color: ${p => p.theme.color.blueGray[25]};
101
- height: 33px;
102
- margin-top: 0;
103
- }
104
-
105
- > .rs-calendar-table-cell-content {
106
- align-items: center;
107
- border-radius: 0 !important;
108
- display: inline-flex;
109
- height: 33px;
110
- justify-content: center;
111
- padding-bottom: 3px;
112
- width: 33px;
113
- }
114
- :hover .rs-calendar-table-cell-content {
115
- background-color: ${p => p.theme.color.blueYonder[25]};
116
- color: ${p => p.theme.color.blueYonder[100]};
117
- }
118
- &[role='columnheader'] .rs-calendar-table-cell-content,
119
- &[role='columnheader']:hover .rs-calendar-table-cell-content {
120
- background-color: transparent;
121
- color: ${p => p.theme.color.slateGray};
122
- }
123
- &.rs-calendar-table-cell-disabled .rs-calendar-table-cell-content {
124
- background-color: transparent;
125
- color: ${p => p.theme.color.lightGray};
126
- }
127
- &.rs-calendar-table-cell-selected > .rs-calendar-table-cell-content {
128
- background-color: ${p => p.theme.color.blueGray[100]};
129
- }
130
- }
131
- }
132
- }
133
- }
134
- `;
135
-
136
- export { CalendarPicker };
137
- //# sourceMappingURL=CalendarPicker.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CalendarPicker.js","sources":["../../../../src/fields/DatePicker/CalendarPicker.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport { DatePicker as RsuiteDatePicker } from 'rsuite'\nimport styled, { createGlobalStyle } from 'styled-components'\n\nimport { getUtcDayjs } from '../../utils/getUtcDayjs'\nimport { getUtcizedDayjs } from '../../utils/getUtcizedDayjs'\nimport { stopMouseEventPropagation } from '../../utils/stopMouseEventPropagation'\nimport { RSUITE_CALENDAR_LOCALE } from '../DateRangePicker/constants'\nimport { getDateTupleFromDate } from '../DateRangePicker/utils'\n\nimport type { DateTuple } from '../DateRangePicker/types'\nimport type { MutableRefObject } from 'react'\nimport type { Promisable } from 'type-fest'\n\ntype CalendarPickerProps = {\n defaultValue?: Date\n isHistorical?: boolean\n onChange: (nextDateTuple: DateTuple) => Promisable<void>\n}\nexport function CalendarPicker({ defaultValue, isHistorical, onChange }: CalendarPickerProps) {\n const boxRef = useRef() as MutableRefObject<HTMLDivElement>\n const calendarRef = useRef<any>()\n\n const [isFirstLoad, setIsFirstLoad] = useState(true)\n\n const utcTodayAsDayjs = useMemo(() => getUtcDayjs().endOf('day'), [])\n const disabledDate = useMemo(\n () => (date?: Date) => date && isHistorical ? getUtcizedDayjs(date).isAfter(utcTodayAsDayjs) : false,\n [isHistorical, utcTodayAsDayjs]\n )\n\n const handleSelect = useCallback(\n (nextDate: Date) => {\n const nextDateTuple = getDateTupleFromDate(nextDate)\n\n onChange(nextDateTuple)\n },\n [onChange]\n )\n\n useEffect(() => {\n // We wait for the <Box /> to render so that `boxRef` is defined\n // and can be used as a container for <RsuiteDateRangePicker />\n setIsFirstLoad(false)\n }, [])\n\n return (\n <>\n <GlobalStyleToHideBodyDialog />\n\n <Box ref={boxRef} onClick={stopMouseEventPropagation}>\n {!isFirstLoad && (\n <RsuiteDatePicker\n ref={calendarRef}\n container={boxRef.current}\n disabledDate={disabledDate}\n format=\"yyyy-MM-dd\"\n locale={RSUITE_CALENDAR_LOCALE}\n oneTap\n onSelect={handleSelect}\n open\n ranges={[]}\n // `defaultValue` seems to be immediatly cancelled so we come down to using a controlled `value`\n value={defaultValue}\n />\n )}\n </Box>\n </>\n )\n}\n\nconst GlobalStyleToHideBodyDialog: any = createGlobalStyle`\n body > div[role=\"dialog\"].rs-picker-date-menu {\n display: none;\n }\n`\n\nconst Box = styled.div`\n height: 0;\n position: relative;\n user-select: none;\n\n .rs-picker-toggle {\n display: none;\n }\n\n .rs-picker-date-panel {\n height: 290px;\n }\n\n .rs-picker-date-menu {\n border: solid 1px ${p => p.theme.color.lightGray};\n border-radius: 0;\n margin-top: 0.25rem;\n\n .rs-picker-date-header,\n .rs-calendar-header-time-toolbar,\n .rs-picker-toolbar {\n display: none;\n }\n\n .rs-calendar {\n height: auto !important;\n padding: 0;\n\n :first-child {\n border-right: solid 1px ${p => p.theme.color.lightGray};\n }\n\n .rs-calendar-header {\n border-bottom: solid 1px ${p => p.theme.color.lightGray};\n padding: 0.5rem;\n\n .rs-calendar-header-month-toolbar {\n align-items: center;\n color: ${p => p.theme.color.slateGray};\n display: flex;\n justify-content: space-between;\n\n .rs-calendar-header-title {\n font-size: inherit;\n text-transform: uppercase;\n\n &.rs-calendar-header-error {\n color: ${p => p.theme.color.slateGray};\n\n :hover {\n color: ${p => p.theme.color.slateGray};\n }\n }\n }\n }\n }\n\n .rs-calendar-view {\n padding: 0.75rem 0.5rem 0;\n\n .rs-calendar-table-cell {\n padding: 0 0 0.25rem 0;\n width: 33px;\n\n &.rs-calendar-table-cell-in-range:before {\n background-color: ${p => p.theme.color.blueGray[25]};\n height: 33px;\n margin-top: 0;\n }\n\n > .rs-calendar-table-cell-content {\n align-items: center;\n border-radius: 0 !important;\n display: inline-flex;\n height: 33px;\n justify-content: center;\n padding-bottom: 3px;\n width: 33px;\n }\n :hover .rs-calendar-table-cell-content {\n background-color: ${p => p.theme.color.blueYonder[25]};\n color: ${p => p.theme.color.blueYonder[100]};\n }\n &[role='columnheader'] .rs-calendar-table-cell-content,\n &[role='columnheader']:hover .rs-calendar-table-cell-content {\n background-color: transparent;\n color: ${p => p.theme.color.slateGray};\n }\n &.rs-calendar-table-cell-disabled .rs-calendar-table-cell-content {\n background-color: transparent;\n color: ${p => p.theme.color.lightGray};\n }\n &.rs-calendar-table-cell-selected > .rs-calendar-table-cell-content {\n background-color: ${p => p.theme.color.blueGray[100]};\n }\n }\n }\n }\n }\n`\n"],"names":["_jsxs","_Fragment","_jsx","RsuiteDatePicker"],"mappings":";;;;;;;;;;AAmBM,SAAU,cAAc,CAAC,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAuB,EAAA;AAC1F,IAAA,MAAM,MAAM,GAAG,MAAM,EAAsC,CAAA;AAC3D,IAAA,MAAM,WAAW,GAAG,MAAM,EAAO,CAAA;IAEjC,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAA;AAEpD,IAAA,MAAM,eAAe,GAAG,OAAO,CAAC,MAAM,WAAW,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAA;AACrE,IAAA,MAAM,YAAY,GAAG,OAAO,CAC1B,MAAM,CAAC,IAAW,KAAK,IAAI,IAAI,YAAY,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,KAAK,EACpG,CAAC,YAAY,EAAE,eAAe,CAAC,CAChC,CAAA;AAED,IAAA,MAAM,YAAY,GAAG,WAAW,CAC9B,CAAC,QAAc,KAAI;AACjB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AA;;;;;;;;;uBASxB,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAA;;;yBAG1B,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAA;;;;;;;;;;;;;;;AAerB,8BAAA,EAAA,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;;;;;;;;;;;;;;;AAe/B,8BAAA,EAAA,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,CAAA;AAC5C,mBAAA,EAAA,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;;;;;qBAKlC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAA;;;;qBAI5B,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAA;;;AAGjB,8BAAA,EAAA,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;;;;;;CAM/D;;;;"}
@@ -1,126 +0,0 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { useRef, useMemo, useCallback, useEffect } from 'react';
3
- import styled from 'styled-components';
4
- import { Fieldset } from '../../elements/Fieldset.js';
5
- import { Legend } from '../../elements/Legend.js';
6
- import { useForceUpdate } from '../../hooks/useForceUpdate.js';
7
- import { getLocalizedDayjs } from '../../utils/getLocalizedDayjs.js';
8
- import { getUtcizedDayjs } from '../../utils/getUtcizedDayjs.js';
9
- import { DateInput } from '../DateRangePicker/DateInput.js';
10
- import { TimeInput } from '../DateRangePicker/TimeInput.js';
11
- import { getDateTupleFromDate, getTimeTupleFromDate, getDateFromDateAndTimeTuple } from '../DateRangePicker/utils.js';
12
- import { CalendarPicker } from './CalendarPicker.js';
13
-
14
- function DatePicker({ defaultValue, isHistorical = false, isLabelHidden = false, label, minutesRange = 15, onChange, withTime = false }) {
15
- const dateInputRef = useRef();
16
- const timeInputRef = useRef();
17
- const isCalendarPickerOpenRef = useRef(false);
18
- const selectedDateRef = useRef(defaultValue ? getLocalizedDayjs(defaultValue).toDate() : undefined);
19
- const selectedDateTupleRef = useRef(getDateTupleFromDate(selectedDateRef.current));
20
- const selectedTimeTupleRef = useRef(getTimeTupleFromDate(selectedDateRef.current));
21
- const { forceUpdate } = useForceUpdate();
22
- const rangeCalendarPickerDefaultValue = useMemo(() => selectedDateTupleRef.current
23
- ? getDateFromDateAndTimeTuple(selectedDateTupleRef.current, ['00', '00'])
24
- : undefined,
25
- // eslint-disable-next-line react-hooks/exhaustive-deps
26
- [selectedDateTupleRef.current]);
27
- const submit = useCallback(() => {
28
- if (!onChange || !selectedDateRef.current) {
29
- return;
30
- }
31
- const nextDate = getUtcizedDayjs(selectedDateRef.current).toDate();
32
- onChange(nextDate);
33
- }, [onChange]);
34
- const closeCalendarPicker = useCallback(() => {
35
- isCalendarPickerOpenRef.current = false;
36
- forceUpdate();
37
- }, [forceUpdate]);
38
- const handleClickOutside = useCallback((event) => {
39
- const target = event.target;
40
- if (dateInputRef.current.boxSpan.contains(target)) {
41
- return;
42
- }
43
- closeCalendarPicker();
44
- }, [closeCalendarPicker]);
45
- const handleDateInputNext = useCallback(() => {
46
- if (!withTime) {
47
- return;
48
- }
49
- timeInputRef.current.focus();
50
- }, [withTime]);
51
- const handleDateInputFilled = useCallback((nextDateTuple) => {
52
- selectedDateTupleRef.current = nextDateTuple;
53
- // If there is no time input or a time has already been selected,
54
- if (!withTime || selectedTimeTupleRef.current) {
55
- // we must update the selected date and call onChange()
56
- const timeTuple = (withTime ? selectedTimeTupleRef.current : ['00', '00']);
57
- const nextDate = getDateFromDateAndTimeTuple(nextDateTuple, timeTuple);
58
- selectedDateRef.current = nextDate;
59
- submit();
60
- }
61
- handleDateInputNext();
62
- }, [handleDateInputNext, submit, withTime]);
63
- const handleCalendarPickerChange = useCallback((nextDateTuple) => {
64
- // If this is a date picker without a time input,
65
- if (!withTime) {
66
- // we have to fix the date at the beginning of the day
67
- const nextDate = getDateFromDateAndTimeTuple(nextDateTuple, ['00', '00']);
68
- selectedDateRef.current = nextDate;
69
- }
70
- // If this is a date picker with a time input,
71
- else {
72
- // we include the selected time if it exists, set it at the beginning of the day if not
73
- const nextDate = getDateFromDateAndTimeTuple(nextDateTuple, selectedTimeTupleRef.current || ['00', '00']);
74
- selectedDateRef.current = nextDate;
75
- }
76
- selectedDateTupleRef.current = nextDateTuple;
77
- selectedTimeTupleRef.current = getTimeTupleFromDate(selectedDateRef.current);
78
- closeCalendarPicker();
79
- forceUpdate();
80
- submit();
81
- }, [closeCalendarPicker, forceUpdate, submit, withTime]);
82
- const handleTimeInputFilled = useCallback((nextTimeTuple) => {
83
- // If a date has already been selected
84
- if (selectedDateTupleRef.current) {
85
- // we must update the selected date accordingly and submit it
86
- const nextDate = getDateFromDateAndTimeTuple(selectedDateTupleRef.current, nextTimeTuple);
87
- selectedDateRef.current = nextDate;
88
- submit();
89
- }
90
- selectedTimeTupleRef.current = nextTimeTuple;
91
- submit();
92
- }, [submit]);
93
- const openCalendarPicker = useCallback(() => {
94
- isCalendarPickerOpenRef.current = true;
95
- forceUpdate();
96
- }, [forceUpdate]);
97
- useEffect(() => {
98
- window.document.addEventListener('click', handleClickOutside);
99
- return () => {
100
- window.document.removeEventListener('click', handleClickOutside);
101
- };
102
- }, [handleClickOutside]);
103
- 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 }))] }));
104
- }
105
- const Box = styled.div `
106
- * {
107
- font-weight: 500;
108
- line-height: 1;
109
- }
110
-
111
- color: ${p => p.theme.color.gunMetal};
112
- font-size: 13px;
113
- position: relative;
114
- `;
115
- const Field = styled.span `
116
- font-size: inherit;
117
- margin-left: ${p => {
118
- if (p.isEndDateField) {
119
- return '0.625rem';
120
- }
121
- return p.isTimeField ? '0.125rem' : 0;
122
- }};
123
- `;
124
-
125
- export { DatePicker };
126
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/fields/DatePicker/index.tsx"],"sourcesContent":["// TODO We should make this component both form- & a11y-compliant with a `name` and proper (aria-)labels.\n\nimport { useCallback, useEffect, useMemo, useRef } from 'react'\nimport styled from 'styled-components'\n\nimport { Fieldset } from '../../elements/Fieldset'\nimport { Legend } from '../../elements/Legend'\nimport { useForceUpdate } from '../../hooks/useForceUpdate'\nimport { getLocalizedDayjs } from '../../utils/getLocalizedDayjs'\nimport { getUtcizedDayjs } from '../../utils/getUtcizedDayjs'\nimport { DateInput } from '../DateRangePicker/DateInput'\nimport { TimeInput } from '../DateRangePicker/TimeInput'\nimport { getDateFromDateAndTimeTuple, getDateTupleFromDate, getTimeTupleFromDate } from '../DateRangePicker/utils'\nimport { CalendarPicker } from './CalendarPicker'\n\nimport type { DateOrTimeInputRef, DateTuple, TimeTuple } from '../DateRangePicker/types'\nimport type { MutableRefObject } from 'react'\nimport type { Promisable } from 'type-fest'\n\nexport type DatePickerProps = {\n defaultValue?: Date\n /** Only allow past dates until today. */\n isHistorical?: boolean\n isLabelHidden?: boolean\n label: string\n /**\n * Range of minutes used to generate the time picker list.\n *\n * @example\n * `15` would produce a list with `..., 10:45, 11:00, 11:15, ...`.\n */\n minutesRange?: number\n /**\n * Called each time the date range picker is changed to a new valid value.\n *\n * @param nextUtcDateRange - A utcized date to be used as is to interact with the API.\n */\n onChange?: (nextUtcDate: Date) => Promisable<void>\n withTime?: boolean\n}\nexport function DatePicker({\n defaultValue,\n isHistorical = false,\n isLabelHidden = false,\n label,\n minutesRange = 15,\n onChange,\n withTime = false\n}: DatePickerProps) {\n const dateInputRef = useRef() as MutableRefObject<DateOrTimeInputRef>\n const timeInputRef = useRef() as MutableRefObject<DateOrTimeInputRef>\n\n const isCalendarPickerOpenRef = useRef(false)\n\n const selectedDateRef = useRef<Date | undefined>(defaultValue ? getLocalizedDayjs(defaultValue).toDate() : undefined)\n const selectedDateTupleRef = useRef<DateTuple | undefined>(getDateTupleFromDate(selectedDateRef.current))\n const selectedTimeTupleRef = useRef<TimeTuple | undefined>(getTimeTupleFromDate(selectedDateRef.current))\n\n const { forceUpdate } = useForceUpdate()\n\n const rangeCalendarPickerDefaultValue = useMemo(\n () =>\n selectedDateTupleRef.current\n ? getDateFromDateAndTimeTuple(selectedDateTupleRef.current, ['00', '00'])\n : undefined,\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [selectedDateTupleRef.current]\n )\n\n const submit = useCallback(() => {\n if (!onChange || !selectedDateRef.current) {\n return\n }\n\n const nextDate = getUtcizedDayjs(selectedDateRef.current).toDate()\n\n onChange(nextDate)\n }, [onChange])\n\n const closeCalendarPicker = useCallback(() => {\n isCalendarPickerOpenRef.current = false\n\n forceUpdate()\n }, [forceUpdate])\n\n const handleClickOutside = useCallback(\n (event: globalThis.MouseEvent) => {\n const target = event.target as Node | null\n\n if (dateInputRef.current.boxSpan.contains(target)) {\n return\n }\n\n closeCalendarPicker()\n },\n [closeCalendarPicker]\n )\n\n const handleDateInputNext = useCallback(() => {\n if (!withTime) {\n return\n }\n\n timeInputRef.current.focus()\n }, [withTime])\n\n const handleDateInputFilled = useCallback(\n (nextDateTuple: DateTuple) => {\n selectedDateTupleRef.current = nextDateTuple\n\n // If there is no time input or a time has already been selected,\n if (!withTime || selectedTimeTupleRef.current) {\n // we must update the selected date and call onChange()\n const timeTuple = (withTime ? selectedTimeTupleRef.current : ['00', '00']) as TimeTuple\n const nextDate = getDateFromDateAndTimeTuple(nextDateTuple, timeTuple)\n\n selectedDateRef.current = nextDate\n\n submit()\n }\n\n handleDateInputNext()\n },\n [handleDateInputNext, submit, withTime]\n )\n\n const handleCalendarPickerChange = useCallback(\n (nextDateTuple: DateTuple) => {\n // If this is a date picker without a time input,\n if (!withTime) {\n // we have to fix the date at the beginning of the day\n const nextDate = getDateFromDateAndTimeTuple(nextDateTuple, ['00', '00'])\n\n selectedDateRef.current = nextDate\n }\n\n // If this is a date picker with a time input,\n else {\n // we include the selected time if it exists, set it at the beginning of the day if not\n const nextDate = getDateFromDateAndTimeTuple(nextDateTuple, selectedTimeTupleRef.current || ['00', '00'])\n selectedDateRef.current = nextDate\n }\n\n selectedDateTupleRef.current = nextDateTuple\n selectedTimeTupleRef.current = getTimeTupleFromDate(selectedDateRef.current)\n\n closeCalendarPicker()\n forceUpdate()\n\n submit()\n },\n [closeCalendarPicker, forceUpdate, submit, withTime]\n )\n\n const handleTimeInputFilled = useCallback(\n (nextTimeTuple: TimeTuple) => {\n // If a date has already been selected\n if (selectedDateTupleRef.current) {\n // we must update the selected date accordingly and submit it\n const nextDate = getDateFromDateAndTimeTuple(selectedDateTupleRef.current, nextTimeTuple)\n\n selectedDateRef.current = nextDate\n\n submit()\n }\n\n selectedTimeTupleRef.current = nextTimeTuple\n\n submit()\n },\n [submit]\n )\n\n const openCalendarPicker = useCallback(() => {\n isCalendarPickerOpenRef.current = true\n\n forceUpdate()\n }, [forceUpdate])\n\n useEffect(() => {\n window.document.addEventListener('click', handleClickOutside)\n\n return () => {\n window.document.removeEventListener('click', handleClickOutside)\n }\n }, [handleClickOutside])\n\n return (\n <Fieldset className=\"DateRangePicker\">\n <Legend isHidden={isLabelHidden}>{label}</Legend>\n\n <Box>\n <Field>\n <DateInput\n ref={dateInputRef}\n defaultValue={selectedDateTupleRef.current}\n isForcedFocused={isCalendarPickerOpenRef.current}\n onChange={handleDateInputFilled}\n onClick={openCalendarPicker}\n onNext={handleDateInputNext}\n />\n </Field>\n\n {withTime && (\n <Field isTimeField>\n <TimeInput\n ref={timeInputRef}\n defaultValue={selectedTimeTupleRef.current}\n minutesRange={minutesRange}\n onBack={() => dateInputRef.current.focus(true)}\n onChange={handleTimeInputFilled}\n onFocus={closeCalendarPicker}\n onPrevious={() => dateInputRef.current.focus(true)}\n />\n </Field>\n )}\n </Box>\n\n {isCalendarPickerOpenRef.current && (\n <CalendarPicker\n defaultValue={rangeCalendarPickerDefaultValue}\n isHistorical={isHistorical}\n onChange={handleCalendarPickerChange}\n />\n )}\n </Fieldset>\n )\n}\n\nconst Box = styled.div`\n * {\n font-weight: 500;\n line-height: 1;\n }\n\n color: ${p => p.theme.color.gunMetal};\n font-size: 13px;\n position: relative;\n`\n\nconst Field = styled.span<{\n isEndDateField?: boolean\n isTimeField?: boolean\n}>`\n font-size: inherit;\n margin-left: ${p => {\n if (p.isEndDateField) {\n return '0.625rem'\n }\n\n return p.isTimeField ? '0.125rem' : 0\n }};\n`\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;AAwCM,SAAU,UAAU,CAAC,EACzB,YAAY,EACZ,YAAY,GAAG,KAAK,EACpB,aAAa,GAAG,KAAK,EACrB,KAAK,EACL,YAAY,GAAG,EAAE,EACjB,QAAQ,EACR,QAAQ,GAAG,KAAK,EACA,EAAA;AAChB,IAAA,MAAM,YAAY,GAAG,MAAM,EAA0C,CAAA;AACrE,IAAA,MAAM,YAAY,GAAG,MAAM,EAA0C,CAAA;AAErE,IAAA,MAAM,uBAAuB,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IAE7C,MAAM,eAAe,GAAG,MAAM,CAAmB,YAAY,G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AC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAA;;;CAGrC,CAAA;AAED,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAGvB,CAAA;;AAEe,eAAA,EAAA,CAAC,IAAG;IACjB,IAAI,CAAC,CAAC,cAAc,EAAE;AACpB,QAAA,OAAO,UAAU,CAAA;AAClB,KAAA;IAED,OAAO,CAAC,CAAC,WAAW,GAAG,UAAU,GAAG,CAAC,CAAA;AACvC,CAAC,CAAA;CACF;;;;"}
@@ -1,84 +0,0 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { forwardRef, useRef, useState, useImperativeHandle, useMemo, useCallback } from 'react';
3
- import styled from 'styled-components';
4
- import { getUtcizedDayjs } from '../../utils/getUtcizedDayjs.js';
5
- import { NumberInput } from './NumberInput.js';
6
- import { formatNumberAsDoubleDigit } from './utils.js';
7
-
8
- function DateInputWithRef({ defaultValue, isEndDate = false, isForcedFocused, isStartDate = false, onBack, onChange, onClick, onNext, onPrevious }, ref) {
9
- const boxSpanRef = useRef();
10
- const dayInputRef = useRef();
11
- const monthInputRef = useRef();
12
- const yearInputRef = useRef();
13
- const [hasFormatError, setHasFormatError] = useState(false);
14
- const [hasValidationError, setHasValidationError] = useState(false);
15
- const [isFocused, setIsFocused] = useState(false);
16
- useImperativeHandle(ref, () => ({
17
- boxSpan: boxSpanRef.current,
18
- focus: (isInLastInputOfTheGroup = false) => {
19
- if (isInLastInputOfTheGroup) {
20
- yearInputRef.current.focus();
21
- }
22
- else {
23
- dayInputRef.current.focus();
24
- }
25
- }
26
- }));
27
- const currentUtcYear = useMemo(() => getUtcizedDayjs().year(), []);
28
- const handleBlur = useCallback(() => {
29
- setIsFocused(false);
30
- }, []);
31
- const handleFocus = useCallback(() => {
32
- setIsFocused(true);
33
- }, []);
34
- const handleFormatError = useCallback((hasNextFormatError) => {
35
- setHasFormatError(hasNextFormatError);
36
- }, []);
37
- const submit = useCallback(() => {
38
- setHasValidationError(false);
39
- switch (window.document.activeElement) {
40
- case dayInputRef.current:
41
- monthInputRef.current.focus();
42
- break;
43
- case monthInputRef.current:
44
- yearInputRef.current.focus();
45
- break;
46
- }
47
- if (!yearInputRef.current.value.length ||
48
- !monthInputRef.current.value.length ||
49
- !dayInputRef.current.value.length) {
50
- if ((monthInputRef.current.value.length && !dayInputRef.current.value.length) ||
51
- (yearInputRef.current.value.length &&
52
- (!dayInputRef.current.value.length || !monthInputRef.current.value.length))) {
53
- setHasValidationError(true);
54
- }
55
- return;
56
- }
57
- const nextDateTuple = [
58
- String(yearInputRef.current.value),
59
- formatNumberAsDoubleDigit(monthInputRef.current.value),
60
- formatNumberAsDoubleDigit(dayInputRef.current.value)
61
- ];
62
- onChange(nextDateTuple);
63
- }, [onChange]);
64
- return (jsxs(Box, { 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 })] }));
65
- }
66
- const DateInput = forwardRef(DateInputWithRef);
67
- const Box = styled.span `
68
- background-color: ${p => p.theme.color.gainsboro};
69
- box-shadow: ${p => p.hasError || p.isFocused
70
- ? `inset 0px 0px 0px 1px ${p.hasError ? p.theme.color.maximumRed : p.theme.color.blueGray[100]}`
71
- : 'none'};
72
- color: ${p => p.theme.color.slateGray};
73
- display: inline-block;
74
- font-size: inherit;
75
- padding: 0.3125rem 0.5rem 0.4375rem;
76
- user-select: none;
77
-
78
- :hover {
79
- box-shadow: ${p => `inset 0px 0px 0px 1px ${p.theme.color.blueYonder[100]}`};
80
- }
81
- `;
82
-
83
- export { DateInput };
84
- //# sourceMappingURL=DateInput.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DateInput.js","sources":["../../../../src/fields/DateRangePicker/DateInput.tsx"],"sourcesContent":["import { forwardRef, useCallback, useImperativeHandle, useMemo, useRef, useState } from 'react'\nimport styled from 'styled-components'\n\nimport { getUtcizedDayjs } from '../../utils/getUtcizedDayjs'\nimport { NumberInput } from './NumberInput'\nimport { formatNumberAsDoubleDigit } from './utils'\n\nimport type { NumberInputProps } from './NumberInput'\nimport type { DateTuple, DateOrTimeInputRef } from './types'\nimport type { ForwardedRef, MutableRefObject } from 'react'\nimport type { Promisable } from 'type-fest'\n\nexport type DateInputProps = Pick<NumberInputProps, 'onBack' | 'onPrevious' | 'onNext'> & {\n defaultValue?: DateTuple\n isEndDate?: boolean\n isForcedFocused: boolean\n isStartDate?: boolean\n /** Called each time the date input is changed to a new valid value. */\n onChange: (nextDateTuple: DateTuple) => Promisable<void>\n onClick: () => Promisable<void>\n}\nfunction DateInputWithRef(\n {\n defaultValue,\n isEndDate = false,\n isForcedFocused,\n isStartDate = false,\n onBack,\n onChange,\n onClick,\n onNext,\n onPrevious\n }: DateInputProps,\n ref: ForwardedRef<DateOrTimeInputRef>\n) {\n const boxSpanRef = useRef() as MutableRefObject<HTMLSpanElement>\n const dayInputRef = useRef() as MutableRefObject<HTMLInputElement>\n const monthInputRef = useRef() as MutableRefObject<HTMLInputElement>\n const yearInputRef = useRef() as MutableRefObject<HTMLInputElement>\n\n const [hasFormatError, setHasFormatError] = useState(false)\n const [hasValidationError, setHasValidationError] = useState(false)\n const [isFocused, setIsFocused] = useState(false)\n\n useImperativeHandle<DateOrTimeInputRef, DateOrTimeInputRef>(ref, () => ({\n boxSpan: boxSpanRef.current,\n focus: (isInLastInputOfTheGroup = false) => {\n if (isInLastInputOfTheGroup) {\n yearInputRef.current.focus()\n } else {\n dayInputRef.current.focus()\n }\n }\n }))\n\n const currentUtcYear = useMemo(() => getUtcizedDayjs().year(), [])\n\n const handleBlur = useCallback(() => {\n setIsFocused(false)\n }, [])\n\n const handleFocus = useCallback(() => {\n setIsFocused(true)\n }, [])\n\n const handleFormatError = useCallback((hasNextFormatError: boolean) => {\n setHasFormatError(hasNextFormatError)\n }, [])\n\n const submit = useCallback(() => {\n setHasValidationError(false)\n\n switch (window.document.activeElement) {\n case dayInputRef.current:\n monthInputRef.current.focus()\n break\n\n case monthInputRef.current:\n yearInputRef.current.focus()\n break\n\n default:\n break\n }\n\n if (\n !yearInputRef.current.value.length ||\n !monthInputRef.current.value.length ||\n !dayInputRef.current.value.length\n ) {\n if (\n (monthInputRef.current.value.length && !dayInputRef.current.value.length) ||\n (yearInputRef.current.value.length &&\n (!dayInputRef.current.value.length || !monthInputRef.current.value.length))\n ) {\n setHasValidationError(true)\n }\n\n return\n }\n\n const nextDateTuple: DateTuple = [\n String(yearInputRef.current.value),\n formatNumberAsDoubleDigit(monthInputRef.current.value),\n formatNumberAsDoubleDigit(dayInputRef.current.value)\n ]\n\n onChange(nextDateTuple)\n }, [onChange])\n\n return (\n <Box ref={boxSpanRef} hasError={hasFormatError || hasValidationError} isFocused={isForcedFocused || isFocused}>\n {isStartDate && 'Du '}\n {isEndDate && 'Au '}\n <NumberInput\n ref={dayInputRef}\n data-cy={`date-range-picker-${isStartDate ? 'start' : 'end'}-day`}\n defaultValue={defaultValue && formatNumberAsDoubleDigit(defaultValue[2])}\n max={31}\n min={1}\n onBack={onBack}\n onBlur={handleBlur}\n onClick={onClick}\n onFilled={submit}\n onFocus={handleFocus}\n onFormatError={handleFormatError}\n onNext={() => monthInputRef.current.focus()}\n onPrevious={onPrevious}\n size={2}\n />\n /\n <NumberInput\n ref={monthInputRef}\n data-cy={`date-range-picker-${isStartDate ? 'start' : 'end'}-month`}\n defaultValue={defaultValue && formatNumberAsDoubleDigit(defaultValue[1])}\n max={12}\n min={1}\n onBack={() => dayInputRef.current.focus()}\n onBlur={handleBlur}\n onClick={onClick}\n onFilled={submit}\n onFocus={handleFocus}\n onFormatError={handleFormatError}\n onNext={() => yearInputRef.current.focus()}\n onPrevious={() => dayInputRef.current.focus()}\n size={2}\n />\n /\n <NumberInput\n ref={yearInputRef}\n data-cy={`date-range-picker-${isStartDate ? 'start' : 'end'}-year`}\n defaultValue={defaultValue && defaultValue[0]}\n max={currentUtcYear}\n min={2020}\n onBack={() => monthInputRef.current.focus()}\n onBlur={handleBlur}\n onClick={onClick}\n onFilled={submit}\n onFocus={handleFocus}\n onFormatError={handleFormatError}\n onNext={onNext}\n onPrevious={() => monthInputRef.current.focus()}\n size={4}\n />\n </Box>\n )\n}\n\nexport const DateInput = forwardRef(DateInputWithRef)\n\nconst Box = styled.span<{\n hasError: boolean\n isFocused: boolean\n}>`\n background-color: ${p => p.theme.color.gainsboro};\n box-shadow: ${p =>\n p.hasError || p.isFocused\n ? `inset 0px 0px 0px 1px ${p.hasError ? p.theme.color.maximumRed : p.theme.color.blueGray[100]}`\n : 'none'};\n color: ${p => p.theme.color.slateGray};\n display: inline-block;\n font-size: inherit;\n padding: 0.3125rem 0.5rem 0.4375rem;\n user-select: none;\n\n :hover {\n box-shadow: ${p => `inset 0px 0px 0px 1px ${p.theme.color.blueYonder[100]}`};\n }\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KAAK,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAE,CAAA;AAChG,MAAE,MAAM,CAAA;WACH,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAA;;;;;;;AAOrB,gBAAA,EAAA,CAAC,IAAI,CAAA,sBAAA,EAAyB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAE,CAAA,CAAA;;CAE9E;;;;"}
@@ -1,82 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { forwardRef, useRef, useMemo, useImperativeHandle, useCallback } from 'react';
3
- import styled from 'styled-components';
4
-
5
- function NumberInputWithRef({ defaultValue, max, min, onBack, onClick, onFilled, onFocus, onFormatError, onInput, onNext, onPrevious, size, ...nativeProps }, ref) {
6
- const inputRef = useRef();
7
- const placeholder = useMemo(() => '-'.repeat(size), [size]);
8
- useImperativeHandle(ref, () => inputRef.current);
9
- const handleClick = useCallback((event) => {
10
- // event.stopPropagation()
11
- if (onClick) {
12
- onClick(event);
13
- }
14
- }, [onClick]);
15
- const handleFocus = useCallback((event) => {
16
- inputRef.current.select();
17
- if (onFocus) {
18
- onFocus(event);
19
- }
20
- }, [onFocus]);
21
- const handleInput = useCallback(() => {
22
- onFormatError(false);
23
- const { value } = inputRef.current;
24
- if (onInput) {
25
- onInput(value);
26
- }
27
- if (value.length !== size) {
28
- return;
29
- }
30
- const valueAsNumber = Number(inputRef.current.value);
31
- if (Number.isNaN(valueAsNumber) || valueAsNumber < min || valueAsNumber > max) {
32
- onFormatError(true);
33
- return;
34
- }
35
- if (onFilled && value.length === size) {
36
- onFilled();
37
- }
38
- }, [max, min, onFilled, onFormatError, onInput, size]);
39
- const handleKeyDown = useCallback((event) => {
40
- if (onPrevious &&
41
- event.key === 'ArrowLeft' &&
42
- inputRef.current.selectionStart === 0 &&
43
- // We don't want to call that function when the user is selecting the input text
44
- inputRef.current.selectionEnd === inputRef.current.selectionStart) {
45
- event.preventDefault();
46
- onPrevious();
47
- return;
48
- }
49
- if (onNext &&
50
- event.key === 'ArrowRight' &&
51
- inputRef.current.selectionStart === inputRef.current.value.length &&
52
- // We don't want to call that function when the user is selecting the input text
53
- inputRef.current.selectionEnd === inputRef.current.selectionStart) {
54
- event.preventDefault();
55
- onNext();
56
- return;
57
- }
58
- if (onBack && event.key === 'Backspace' && !inputRef.current.value.length) {
59
- event.preventDefault();
60
- onBack();
61
- }
62
- }, [onBack, onNext, onPrevious]);
63
- 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)));
64
- }
65
- const NumberInput = forwardRef(NumberInputWithRef);
66
- const StyledNumberInput = styled.input `
67
- background-color: transparent;
68
- border: 0;
69
- font-size: inherit;
70
- outline: none;
71
- padding: 0;
72
- text-align: center;
73
- /* 1 digit = 0.5rem */
74
- width: ${p => p.size * 0.5}rem;
75
-
76
- ::placeholder {
77
- color: ${p => p.theme.color.slateGray};
78
- }
79
- `;
80
-
81
- export { NumberInput };
82
- //# sourceMappingURL=NumberInput.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NumberInput.js","sources":["../../../../src/fields/DateRangePicker/NumberInput.tsx"],"sourcesContent":["import { forwardRef, KeyboardEvent, useCallback, useImperativeHandle, useMemo, useRef } from 'react'\nimport styled from 'styled-components'\n\nimport type { FocusEvent, ForwardedRef, InputHTMLAttributes, MouseEvent, MutableRefObject } from 'react'\nimport type { Promisable } from 'type-fest'\n\nexport type NumberInputProps = Omit<\n InputHTMLAttributes<HTMLInputElement>,\n 'maxLength' | 'onInput' | 'pattern' | 'type'\n> & {\n max: number\n min: number\n /** Called when the use press backspace key while the input is empty. */\n onBack?: () => Promisable<void>\n /** Called when the input value reaches the size property. */\n onFilled?: () => Promisable<void>\n onFormatError: (hasNextFormatError: boolean) => Promisable<void>\n onInput?: (nextValue: string) => Promisable<void>\n /** Called when the right arrow is pressed while the cursor is positionned at the input end. */\n onNext?: () => Promisable<void>\n /** Called when the left arrow is pressed while the cursor is positionned at the input start. */\n onPrevious?: () => Promisable<void>\n size: number\n}\nfunction NumberInputWithRef(\n {\n defaultValue,\n max,\n min,\n onBack,\n onClick,\n onFilled,\n onFocus,\n onFormatError,\n onInput,\n onNext,\n onPrevious,\n size,\n ...nativeProps\n }: NumberInputProps,\n ref: ForwardedRef<HTMLInputElement>\n) {\n const inputRef = useRef<HTMLInputElement>() as MutableRefObject<HTMLInputElement>\n\n const placeholder = useMemo(() => '-'.repeat(size), [size])\n\n useImperativeHandle(ref, () => inputRef.current as HTMLInputElement)\n\n const handleClick = useCallback(\n (event: MouseEvent<HTMLInputElement>) => {\n // event.stopPropagation()\n\n if (onClick) {\n onClick(event)\n }\n },\n [onClick]\n )\n\n const handleFocus = useCallback(\n (event: FocusEvent<HTMLInputElement>) => {\n inputRef.current.select()\n\n if (onFocus) {\n onFocus(event)\n }\n },\n [onFocus]\n )\n\n const handleInput = useCallback(() => {\n onFormatError(false)\n\n const { value } = inputRef.current\n if (onInput) {\n onInput(value)\n }\n if (value.length !== size) {\n return\n }\n\n const valueAsNumber = Number(inputRef.current.value)\n if (Number.isNaN(valueAsNumber) || valueAsNumber < min || valueAsNumber > max) {\n onFormatError(true)\n\n return\n }\n\n if (onFilled && value.length === size) {\n onFilled()\n }\n }, [max, min, onFilled, onFormatError, onInput, size])\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLInputElement>) => {\n if (\n onPrevious &&\n event.key === 'ArrowLeft' &&\n inputRef.current.selectionStart === 0 &&\n // We don't want to call that function when the user is selecting the input text\n inputRef.current.selectionEnd === inputRef.current.selectionStart\n ) {\n event.preventDefault()\n\n onPrevious()\n\n return\n }\n\n if (\n onNext &&\n event.key === 'ArrowRight' &&\n inputRef.current.selectionStart === inputRef.current.value.length &&\n // We don't want to call that function when the user is selecting the input text\n inputRef.current.selectionEnd === inputRef.current.selectionStart\n ) {\n event.preventDefault()\n\n onNext()\n\n return\n }\n\n if (onBack && event.key === 'Backspace' && !inputRef.current.value.length) {\n event.preventDefault()\n\n onBack()\n }\n },\n [onBack, onNext, onPrevious]\n )\n\n return (\n <StyledNumberInput\n key={String(defaultValue)}\n ref={inputRef}\n defaultValue={defaultValue}\n maxLength={size}\n onClick={handleClick}\n onFocus={handleFocus}\n onInput={handleInput}\n onKeyDown={handleKeyDown}\n pattern=\"\\d*\"\n placeholder={placeholder}\n size={size}\n type=\"text\"\n {...nativeProps}\n />\n )\n}\n\nexport const NumberInput = forwardRef(NumberInputWithRef)\n\nconst StyledNumberInput = styled.input<{\n size: number\n}>`\n background-color: transparent;\n border: 0;\n font-size: inherit;\n outline: none;\n padding: 0;\n text-align: center;\n /* 1 digit = 0.5rem */\n width: ${p => p.size * 0.5}rem;\n\n ::placeholder {\n color: ${p => p.theme.color.slateGray};\n }\n`\n"],"names":["_jsx"],"mappings":";;;;AAwBA,SAAS,kBAAkB,CACzB,EACE,YAAY,EACZ,GAAG,EACH,GAAG,EACH,MAAM,EACN,OAAO,EACP,QAAQ,EACR,OAAO,EACP,aAAa,EACb,OAAO,EACP,MAAM,EACN,UAAU,EACV,IAAI,EACJ,GAAG,WAAW,EACG,EACnB,GAAmC,EAAA;AAEnC,IAAA,MAAM,QAAQ,GAAG,MAAM,EAA0D,CAAA;AAEjF,IAAA,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;IAE3D,mBAAmB,CAAC,GAAG,EAAE,MAAM,QAAQ,CAAC,OAA2B,CAAC,CAAA;AAEpE,IAAA,MAAM,WAAW,GAAG,WAAW,CAC7B,CAAC,KAAmC,KAAI;;AAGtC,QAAA,IAAI,OAAO,EAAE;Y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