@transferwise/components 46.156.0 → 46.157.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (215) hide show
  1. package/build/Calendar/Calendar.constants.js +10 -0
  2. package/build/Calendar/Calendar.constants.js.map +1 -0
  3. package/build/Calendar/Calendar.constants.mjs +8 -0
  4. package/build/Calendar/Calendar.constants.mjs.map +1 -0
  5. package/build/Calendar/Calendar.js +121 -17
  6. package/build/Calendar/Calendar.js.map +1 -1
  7. package/build/Calendar/Calendar.messages.js +12 -0
  8. package/build/Calendar/Calendar.messages.js.map +1 -1
  9. package/build/Calendar/Calendar.messages.mjs +12 -0
  10. package/build/Calendar/Calendar.messages.mjs.map +1 -1
  11. package/build/Calendar/Calendar.mjs +122 -18
  12. package/build/Calendar/Calendar.mjs.map +1 -1
  13. package/build/Calendar/DateHeader/DateHeader.js +5 -1
  14. package/build/Calendar/DateHeader/DateHeader.js.map +1 -1
  15. package/build/Calendar/DateHeader/DateHeader.mjs +5 -1
  16. package/build/Calendar/DateHeader/DateHeader.mjs.map +1 -1
  17. package/build/Calendar/DayCalendar/DayCalendar.js +20 -2
  18. package/build/Calendar/DayCalendar/DayCalendar.js.map +1 -1
  19. package/build/Calendar/DayCalendar/DayCalendar.mjs +20 -2
  20. package/build/Calendar/DayCalendar/DayCalendar.mjs.map +1 -1
  21. package/build/Calendar/DayCalendar/Table/DayCalendarTable.js +60 -19
  22. package/build/Calendar/DayCalendar/Table/DayCalendarTable.js.map +1 -1
  23. package/build/Calendar/DayCalendar/Table/DayCalendarTable.mjs +60 -19
  24. package/build/Calendar/DayCalendar/Table/DayCalendarTable.mjs.map +1 -1
  25. package/build/Calendar/MonthCalendar/MonthCalendar.js +6 -0
  26. package/build/Calendar/MonthCalendar/MonthCalendar.js.map +1 -1
  27. package/build/Calendar/MonthCalendar/MonthCalendar.mjs +6 -0
  28. package/build/Calendar/MonthCalendar/MonthCalendar.mjs.map +1 -1
  29. package/build/Calendar/MonthCalendar/Table/MonthCalendarTable.js +8 -3
  30. package/build/Calendar/MonthCalendar/Table/MonthCalendarTable.js.map +1 -1
  31. package/build/Calendar/MonthCalendar/Table/MonthCalendarTable.mjs +8 -3
  32. package/build/Calendar/MonthCalendar/Table/MonthCalendarTable.mjs.map +1 -1
  33. package/build/Calendar/TableLink/TableLink.js +95 -0
  34. package/build/Calendar/TableLink/TableLink.js.map +1 -0
  35. package/build/Calendar/TableLink/TableLink.mjs +91 -0
  36. package/build/Calendar/TableLink/TableLink.mjs.map +1 -0
  37. package/build/Calendar/YearCalendar/Table/YearCalendarTable.js +8 -3
  38. package/build/Calendar/YearCalendar/Table/YearCalendarTable.js.map +1 -1
  39. package/build/Calendar/YearCalendar/Table/YearCalendarTable.mjs +8 -3
  40. package/build/Calendar/YearCalendar/Table/YearCalendarTable.mjs.map +1 -1
  41. package/build/Calendar/YearCalendar/YearCalendar.js +7 -0
  42. package/build/Calendar/YearCalendar/YearCalendar.js.map +1 -1
  43. package/build/Calendar/YearCalendar/YearCalendar.mjs +7 -0
  44. package/build/Calendar/YearCalendar/YearCalendar.mjs.map +1 -1
  45. package/build/Calendar/_helpers/clampToDayViewBoundary/clampToDayViewBoundary.js +24 -0
  46. package/build/Calendar/_helpers/clampToDayViewBoundary/clampToDayViewBoundary.js.map +1 -0
  47. package/build/Calendar/_helpers/clampToDayViewBoundary/clampToDayViewBoundary.mjs +22 -0
  48. package/build/Calendar/_helpers/clampToDayViewBoundary/clampToDayViewBoundary.mjs.map +1 -0
  49. package/build/Calendar/_helpers/hasDisabledDatesInMonth/hasDisabledDatesInMonth.js +33 -0
  50. package/build/Calendar/_helpers/hasDisabledDatesInMonth/hasDisabledDatesInMonth.js.map +1 -0
  51. package/build/Calendar/_helpers/hasDisabledDatesInMonth/hasDisabledDatesInMonth.mjs +31 -0
  52. package/build/Calendar/_helpers/hasDisabledDatesInMonth/hasDisabledDatesInMonth.mjs.map +1 -0
  53. package/build/Calendar/_helpers/isDateDisabled/isDateDisabled.js +40 -0
  54. package/build/Calendar/_helpers/isDateDisabled/isDateDisabled.js.map +1 -0
  55. package/build/Calendar/_helpers/isDateDisabled/isDateDisabled.mjs +38 -0
  56. package/build/Calendar/_helpers/isDateDisabled/isDateDisabled.mjs.map +1 -0
  57. package/build/DateLookup/DateLookup.js +20 -9
  58. package/build/DateLookup/DateLookup.js.map +1 -1
  59. package/build/DateLookup/DateLookup.mjs +20 -9
  60. package/build/DateLookup/DateLookup.mjs.map +1 -1
  61. package/build/ExpressiveMoneyInput/CurrencySelector/CurrencySelector.js +3 -5
  62. package/build/ExpressiveMoneyInput/CurrencySelector/CurrencySelector.js.map +1 -1
  63. package/build/ExpressiveMoneyInput/CurrencySelector/CurrencySelector.mjs +3 -5
  64. package/build/ExpressiveMoneyInput/CurrencySelector/CurrencySelector.mjs.map +1 -1
  65. package/build/Inputs/SelectInput/TriggerButton/SelectInputTriggerButton.js.map +1 -1
  66. package/build/Inputs/SelectInput/TriggerButton/SelectInputTriggerButton.mjs.map +1 -1
  67. package/build/Typeahead/Typeahead.js +53 -27
  68. package/build/Typeahead/Typeahead.js.map +1 -1
  69. package/build/Typeahead/Typeahead.messages.js +3 -0
  70. package/build/Typeahead/Typeahead.messages.js.map +1 -1
  71. package/build/Typeahead/Typeahead.messages.mjs +3 -0
  72. package/build/Typeahead/Typeahead.messages.mjs.map +1 -1
  73. package/build/Typeahead/Typeahead.mjs +53 -27
  74. package/build/Typeahead/Typeahead.mjs.map +1 -1
  75. package/build/Typeahead/TypeaheadInput/TypeaheadInput.js +2 -2
  76. package/build/Typeahead/TypeaheadInput/TypeaheadInput.js.map +1 -1
  77. package/build/Typeahead/TypeaheadInput/TypeaheadInput.mjs +2 -2
  78. package/build/Typeahead/TypeaheadInput/TypeaheadInput.mjs.map +1 -1
  79. package/build/Typeahead/TypeaheadOption/TypeaheadOption.js +3 -1
  80. package/build/Typeahead/TypeaheadOption/TypeaheadOption.js.map +1 -1
  81. package/build/Typeahead/TypeaheadOption/TypeaheadOption.mjs +3 -1
  82. package/build/Typeahead/TypeaheadOption/TypeaheadOption.mjs.map +1 -1
  83. package/build/i18n/en.json +5 -0
  84. package/build/i18n/en.json.js +5 -0
  85. package/build/i18n/en.json.js.map +1 -1
  86. package/build/i18n/en.json.mjs +5 -0
  87. package/build/i18n/en.json.mjs.map +1 -1
  88. package/build/index.js +2 -2
  89. package/build/index.mjs +1 -1
  90. package/build/main.css +133 -43
  91. package/build/styles/Calendar/Calendar.css +112 -37
  92. package/build/styles/Calendar/TableLink/TableLink.css +115 -0
  93. package/build/styles/Typeahead/Typeahead.css +4 -0
  94. package/build/styles/Typeahead/TypeaheadOption/TypeaheadOption.css +5 -0
  95. package/build/styles/main.css +133 -43
  96. package/build/types/Body/Body.d.ts +2 -2
  97. package/build/types/Calendar/Calendar.constants.d.ts +2 -0
  98. package/build/types/Calendar/Calendar.constants.d.ts.map +1 -0
  99. package/build/types/Calendar/Calendar.d.ts +16 -3
  100. package/build/types/Calendar/Calendar.d.ts.map +1 -1
  101. package/build/types/Calendar/Calendar.messages.d.ts +20 -0
  102. package/build/types/Calendar/Calendar.messages.d.ts.map +1 -1
  103. package/build/types/Calendar/Calendar.types.d.ts +32 -0
  104. package/build/types/Calendar/Calendar.types.d.ts.map +1 -0
  105. package/build/types/Calendar/DateHeader/DateHeader.d.ts +2 -0
  106. package/build/types/Calendar/DateHeader/DateHeader.d.ts.map +1 -1
  107. package/build/types/Calendar/DayCalendar/DayCalendar.d.ts +7 -1
  108. package/build/types/Calendar/DayCalendar/DayCalendar.d.ts.map +1 -1
  109. package/build/types/Calendar/DayCalendar/Table/DayCalendarTable.d.ts +6 -0
  110. package/build/types/Calendar/DayCalendar/Table/DayCalendarTable.d.ts.map +1 -1
  111. package/build/types/Calendar/MonthCalendar/MonthCalendar.d.ts +1 -0
  112. package/build/types/Calendar/MonthCalendar/MonthCalendar.d.ts.map +1 -1
  113. package/build/types/Calendar/MonthCalendar/Table/MonthCalendarTable.d.ts +2 -1
  114. package/build/types/Calendar/MonthCalendar/Table/MonthCalendarTable.d.ts.map +1 -1
  115. package/build/types/Calendar/{tableLink → TableLink}/TableLink.d.ts +5 -1
  116. package/build/types/Calendar/TableLink/TableLink.d.ts.map +1 -0
  117. package/build/types/Calendar/TableLink/index.d.ts.map +1 -0
  118. package/build/types/Calendar/YearCalendar/Table/YearCalendarTable.d.ts +2 -1
  119. package/build/types/Calendar/YearCalendar/Table/YearCalendarTable.d.ts.map +1 -1
  120. package/build/types/Calendar/YearCalendar/YearCalendar.d.ts +1 -0
  121. package/build/types/Calendar/YearCalendar/YearCalendar.d.ts.map +1 -1
  122. package/build/types/Calendar/_helpers/clampToDayViewBoundary/clampToDayViewBoundary.d.ts +8 -0
  123. package/build/types/Calendar/_helpers/clampToDayViewBoundary/clampToDayViewBoundary.d.ts.map +1 -0
  124. package/build/types/Calendar/_helpers/hasDisabledDatesInMonth/hasDisabledDatesInMonth.d.ts +3 -0
  125. package/build/types/Calendar/_helpers/hasDisabledDatesInMonth/hasDisabledDatesInMonth.d.ts.map +1 -0
  126. package/build/types/Calendar/_helpers/index.d.ts +4 -0
  127. package/build/types/Calendar/_helpers/index.d.ts.map +1 -0
  128. package/build/types/Calendar/_helpers/isDateDisabled/isDateDisabled.d.ts +3 -0
  129. package/build/types/Calendar/_helpers/isDateDisabled/isDateDisabled.d.ts.map +1 -0
  130. package/build/types/Calendar/index.d.ts +1 -0
  131. package/build/types/Calendar/index.d.ts.map +1 -1
  132. package/build/types/DateLookup/DateLookup.d.ts +24 -5
  133. package/build/types/DateLookup/DateLookup.d.ts.map +1 -1
  134. package/build/types/DateLookup/index.d.ts +1 -0
  135. package/build/types/DateLookup/index.d.ts.map +1 -1
  136. package/build/types/ExpressiveMoneyInput/CurrencySelector/CurrencySelector.d.ts +6 -4
  137. package/build/types/ExpressiveMoneyInput/CurrencySelector/CurrencySelector.d.ts.map +1 -1
  138. package/build/types/IconButton/IconButton.d.ts +1 -1
  139. package/build/types/Inputs/SelectInput/TriggerButton/SelectInputTriggerButton.d.ts +1 -1
  140. package/build/types/Inputs/SelectInput/TriggerButton/SelectInputTriggerButton.d.ts.map +1 -1
  141. package/build/types/MoneyInput/MoneyInput.d.ts +1 -1
  142. package/build/types/MoneyInput/MoneyInput.d.ts.map +1 -1
  143. package/build/types/Title/Title.d.ts +2 -2
  144. package/build/types/Typeahead/Typeahead.d.ts.map +1 -1
  145. package/build/types/Typeahead/Typeahead.messages.d.ts +5 -0
  146. package/build/types/Typeahead/Typeahead.messages.d.ts.map +1 -1
  147. package/build/types/Typeahead/TypeaheadInput/TypeaheadInput.d.ts.map +1 -1
  148. package/build/types/Typeahead/TypeaheadOption/TypeaheadOption.d.ts +1 -0
  149. package/build/types/Typeahead/TypeaheadOption/TypeaheadOption.d.ts.map +1 -1
  150. package/build/types/Upload/Steps/UploadImageStep/UploadImageStep.d.ts +1 -1
  151. package/build/types/UploadInput/UploadItem/UploadItemLink.d.ts +1 -1
  152. package/build/types/index.d.ts +3 -2
  153. package/build/types/index.d.ts.map +1 -1
  154. package/build/types/test-utils/index.d.ts +10 -0
  155. package/build/types/test-utils/index.d.ts.map +1 -1
  156. package/package.json +1 -1
  157. package/src/Calendar/Calendar.constants.ts +5 -0
  158. package/src/Calendar/Calendar.css +112 -37
  159. package/src/Calendar/Calendar.disabledDates.test.tsx +610 -0
  160. package/src/Calendar/Calendar.less +5 -35
  161. package/src/Calendar/Calendar.messages.ts +21 -0
  162. package/src/Calendar/Calendar.test.tsx +342 -32
  163. package/src/Calendar/Calendar.tsx +169 -19
  164. package/src/Calendar/Calendar.types.ts +35 -0
  165. package/src/Calendar/DateHeader/DateHeader.tsx +6 -0
  166. package/src/Calendar/DayCalendar/DayCalendar.tsx +39 -1
  167. package/src/Calendar/DayCalendar/Table/DayCalendarTable.tsx +67 -27
  168. package/src/Calendar/MonthCalendar/MonthCalendar.tsx +8 -0
  169. package/src/Calendar/MonthCalendar/Table/MonthCalendarTable.tsx +15 -3
  170. package/src/Calendar/TableLink/TableLink.css +115 -0
  171. package/src/Calendar/TableLink/TableLink.less +68 -0
  172. package/src/Calendar/TableLink/TableLink.tsx +117 -0
  173. package/src/Calendar/YearCalendar/Table/YearCalendarTable.tsx +15 -3
  174. package/src/Calendar/YearCalendar/YearCalendar.tsx +9 -0
  175. package/src/Calendar/_helpers/clampToDayViewBoundary/clampToDayViewBoundary.test.ts +90 -0
  176. package/src/Calendar/_helpers/clampToDayViewBoundary/clampToDayViewBoundary.ts +25 -0
  177. package/src/Calendar/_helpers/hasDisabledDatesInMonth/hasDisabledDatesInMonth.test.ts +98 -0
  178. package/src/Calendar/_helpers/hasDisabledDatesInMonth/hasDisabledDatesInMonth.ts +45 -0
  179. package/src/Calendar/_helpers/index.ts +3 -0
  180. package/src/Calendar/_helpers/isDateDisabled/isDateDisabled.test.ts +169 -0
  181. package/src/Calendar/_helpers/isDateDisabled/isDateDisabled.ts +59 -0
  182. package/src/Calendar/_stories/Calendar.accessibility.docs.mdx +118 -0
  183. package/src/Calendar/_stories/Calendar.story.tsx +144 -4
  184. package/src/Calendar/_stories/Calendar.test.story.tsx +114 -0
  185. package/src/Calendar/index.ts +7 -0
  186. package/src/DateLookup/DateLookup.disabledDates.test.tsx +312 -0
  187. package/src/DateLookup/DateLookup.test.tsx +34 -37
  188. package/src/DateLookup/DateLookup.tsx +37 -13
  189. package/src/DateLookup/_stories/DateLookup.accessibility.docs.mdx +108 -0
  190. package/src/DateLookup/_stories/DateLookup.story.tsx +126 -2
  191. package/src/DateLookup/index.ts +6 -0
  192. package/src/ExpressiveMoneyInput/CurrencySelector/CurrencySelector.tsx +12 -13
  193. package/src/Inputs/SelectInput/SelectInput.test.tsx +37 -0
  194. package/src/Inputs/SelectInput/TriggerButton/SelectInputTriggerButton.tsx +1 -1
  195. package/src/Typeahead/Typeahead.css +4 -0
  196. package/src/Typeahead/Typeahead.less +2 -0
  197. package/src/Typeahead/Typeahead.messages.ts +5 -0
  198. package/src/Typeahead/Typeahead.test.tsx +80 -3
  199. package/src/Typeahead/Typeahead.tsx +50 -27
  200. package/src/Typeahead/TypeaheadInput/TypeaheadInput.tsx +2 -6
  201. package/src/Typeahead/TypeaheadOption/TypeaheadOption.css +5 -0
  202. package/src/Typeahead/TypeaheadOption/TypeaheadOption.less +9 -0
  203. package/src/Typeahead/TypeaheadOption/TypeaheadOption.tsx +4 -2
  204. package/src/i18n/en.json +4 -0
  205. package/src/index.ts +3 -2
  206. package/src/main.css +133 -43
  207. package/build/Calendar/tableLink/TableLink.js +0 -61
  208. package/build/Calendar/tableLink/TableLink.js.map +0 -1
  209. package/build/Calendar/tableLink/TableLink.mjs +0 -57
  210. package/build/Calendar/tableLink/TableLink.mjs.map +0 -1
  211. package/build/types/Calendar/tableLink/TableLink.d.ts.map +0 -1
  212. package/build/types/Calendar/tableLink/index.d.ts.map +0 -1
  213. package/src/Calendar/tableLink/TableLink.tsx +0 -77
  214. /package/build/types/Calendar/{tableLink → TableLink}/index.d.ts +0 -0
  215. /package/src/Calendar/{tableLink → TableLink}/index.ts +0 -0
@@ -1,4 +1,6 @@
1
- import { useEffect, useState, useCallback } from 'react';
1
+ import { useId, useRef, useEffect, useState, useCallback } from 'react';
2
+ import { useIntl } from 'react-intl';
3
+ import { formatDate } from '@transferwise/formatting';
2
4
  import '../common/theme.mjs';
3
5
  import '../common/direction.mjs';
4
6
  import '@transferwise/neptune-tokens';
@@ -18,37 +20,66 @@ import '../common/PropsValues/variant.mjs';
18
20
  import '../common/PropsValues/scroll.mjs';
19
21
  import '../common/PropsValues/markdownNodeType.mjs';
20
22
  import '../common/fileType.mjs';
21
- import '@transferwise/formatting';
22
23
  import '@transferwise/icons';
23
24
  import 'clsx';
24
- import 'react-intl';
25
25
  import '../common/CloseButton/CloseButton.messages.mjs';
26
26
  import { jsxs, jsx } from 'react/jsx-runtime';
27
27
  import { moveToWithinRange } from '../common/DateUtils/moveToWithinRange/moveToWithinRange.mjs';
28
28
  import { isWithinRange } from '../common/DateUtils/isWithinRange/isWithinRange.mjs';
29
29
  import { returnDateView } from '../common/DateUtils/getDateView/getDateView.mjs';
30
+ import { clampToDayViewBoundary } from './_helpers/clampToDayViewBoundary/clampToDayViewBoundary.mjs';
31
+ import { isDateDisabled } from './_helpers/isDateDisabled/isDateDisabled.mjs';
32
+ import { hasDisabledDatesInMonth } from './_helpers/hasDisabledDatesInMonth/hasDisabledDatesInMonth.mjs';
33
+ import { LONG_DAY_FORMAT } from './Calendar.constants.mjs';
34
+ import { InlinePrompt } from '../Prompt/InlinePrompt/InlinePrompt.mjs';
30
35
  import DayCalendar from './DayCalendar/DayCalendar.mjs';
31
36
  import { getStartOfDay } from './GetStartOfDay/GetStartOfDay.mjs';
37
+ import messages from './Calendar.messages.mjs';
32
38
  import MonthCalendar from './MonthCalendar/MonthCalendar.mjs';
33
39
  import YearCalendar from './YearCalendar/YearCalendar.mjs';
34
40
 
41
+ /**
42
+ * Inline calendar for selecting a single date. Powers [DateLookup](?path=/docs/forms-datelookup--docs).
43
+ */
35
44
  const Calendar = ({
36
45
  value,
37
46
  min: minProp = null,
38
47
  max: maxProp = null,
39
48
  monthFormat = MonthFormat.LONG,
40
49
  placeholder,
41
- onChange,
42
- onSelect
50
+ disabledRules,
51
+ onDateFocus,
52
+ onChange
43
53
  }) => {
54
+ const intl = useIntl();
44
55
  const selectedDate = getStartOfDay(value);
45
56
  const min = getStartOfDay(minProp);
46
57
  const max = getStartOfDay(maxProp);
58
+ const disabledReasonId = useId();
59
+ const disabledRulesRef = useRef(disabledRules);
60
+ useEffect(() => {
61
+ disabledRulesRef.current = disabledRules;
62
+ });
63
+ const [hasInteracted, setHasInteracted] = useState(false);
64
+ const [focusedDate, setFocusedDate] = useState(selectedDate);
65
+ useEffect(() => {
66
+ // eslint-disable-next-line react-hooks/set-state-in-effect
67
+ setFocusedDate(selectedDate);
68
+ }, [selectedDate?.getTime()]); // eslint-disable-line react-hooks/exhaustive-deps
69
+ const checkIsEnabled = date => {
70
+ if (!date) return true;
71
+ return isWithinRange(date, min, max) && !isDateDisabled(date, disabledRulesRef.current);
72
+ };
73
+ const focusedDateDisabled = focusedDate ? !isWithinRange(focusedDate, min, max) || isDateDisabled(focusedDate, disabledRules) : false;
47
74
  useEffect(() => {
48
75
  if (selectedDate && !isWithinRange(selectedDate, min, max)) {
49
- onChange(moveToWithinRange(selectedDate, min, max));
76
+ const clamped = moveToWithinRange(selectedDate, min, max);
77
+ setFocusedDate(clamped); // eslint-disable-line react-hooks/set-state-in-effect
78
+ onDateFocus?.(clamped, {
79
+ isEnabled: checkIsEnabled(clamped)
80
+ });
50
81
  }
51
- }, [selectedDate?.getTime(), min?.getTime(), max?.getTime(), onChange]); // eslint-disable-line react-hooks/exhaustive-deps
82
+ }, [selectedDate?.getTime(), min?.getTime(), max?.getTime(), onDateFocus]); // eslint-disable-line react-hooks/exhaustive-deps
52
83
  const dateView = returnDateView(selectedDate, min, max);
53
84
  const [viewMonth, setViewMonth] = useState(dateView.getMonth());
54
85
  const [viewYear, setViewYear] = useState(dateView.getFullYear());
@@ -59,6 +90,13 @@ const Calendar = ({
59
90
  setViewMonth(view.getMonth());
60
91
  setViewYear(view.getFullYear());
61
92
  }, [selectedDate?.getTime(), min?.getTime(), max?.getTime()]); // eslint-disable-line react-hooks/exhaustive-deps
93
+ useEffect(() => {
94
+ if (focusedDate) {
95
+ // eslint-disable-next-line react-hooks/set-state-in-effect
96
+ setViewMonth(focusedDate.getMonth());
97
+ setViewYear(focusedDate.getFullYear());
98
+ }
99
+ }, [focusedDate?.getTime()]); // eslint-disable-line react-hooks/exhaustive-deps
62
100
  const handleViewDateUpdate = useCallback(
63
101
  // eslint-disable-next-line react-hooks/preserve-manual-memoization
64
102
  ({
@@ -67,29 +105,56 @@ const Calendar = ({
67
105
  }) => {
68
106
  if (month !== undefined) setViewMonth(month);
69
107
  if (year !== undefined) setViewYear(year);
108
+ setHasInteracted(false);
70
109
  }, []);
71
110
  const switchToDays = useCallback(() => setMode('day'), []);
72
111
  const switchToMonths = useCallback(() => setMode('month'), []);
73
112
  const switchToYears = useCallback(() => setMode('year'), []);
74
113
  const handleSelectedDateUpdate = useCallback(date => {
75
- if (onSelect) {
76
- onSelect(date);
77
- } else {
114
+ if (!hasInteracted) setHasInteracted(true);
115
+ const isEnabled = checkIsEnabled(date);
116
+ setFocusedDate(date);
117
+ onDateFocus?.(date, {
118
+ isEnabled
119
+ });
120
+ if (isEnabled && onChange) {
78
121
  onChange(date);
79
122
  }
80
- }, [onChange, onSelect]);
123
+ }, [onDateFocus, onChange]);
81
124
  const adjustDate = useCallback((daysToAdd, monthsToAdd, yearsToAdd) => {
125
+ const base = focusedDate ?? selectedDate;
82
126
  let date;
83
- if (selectedDate) {
84
- date = new Date(mode === 'year' ? selectedDate.getFullYear() + yearsToAdd : selectedDate.getFullYear(), mode === 'month' ? selectedDate.getMonth() + monthsToAdd : selectedDate.getMonth(), mode === 'day' ? selectedDate.getDate() + daysToAdd : selectedDate.getDate());
127
+ if (base) {
128
+ date = new Date(mode === 'year' ? base.getFullYear() + yearsToAdd : base.getFullYear(), mode === 'month' ? base.getMonth() + monthsToAdd : base.getMonth(), mode === 'day' ? base.getDate() + daysToAdd : base.getDate());
85
129
  } else {
86
130
  date = getStartOfDay(new Date());
87
131
  }
88
- date &&= moveToWithinRange(date, min, max);
89
- if (date?.getTime() !== selectedDate?.getTime()) {
90
- onChange(date);
132
+ date &&= mode !== 'day' ? moveToWithinRange(date, min, max) : clampToDayViewBoundary(date, min, max);
133
+ if (date?.getTime() !== focusedDate?.getTime()) {
134
+ const monthChanged = date ? date.getMonth() !== focusedDate?.getMonth() || date.getFullYear() !== focusedDate?.getFullYear() : false;
135
+ setFocusedDate(date);
136
+ if (date) {
137
+ setViewMonth(date.getMonth());
138
+ setViewYear(date.getFullYear());
139
+ }
140
+ if (monthChanged) {
141
+ setHasInteracted(false);
142
+ } else if (!hasInteracted) {
143
+ setHasInteracted(true);
144
+ }
145
+ onDateFocus?.(date, {
146
+ isEnabled: checkIsEnabled(date)
147
+ });
91
148
  }
92
- }, [selectedDate, min, max, mode, onChange]);
149
+ }, [focusedDate, selectedDate, min, max, mode, onDateFocus]);
150
+ const handleDayFocus = useCallback(date => {
151
+ if (date.getTime() !== focusedDate?.getTime()) {
152
+ setFocusedDate(date);
153
+ onDateFocus?.(date, {
154
+ isEnabled: checkIsEnabled(date)
155
+ });
156
+ }
157
+ }, [focusedDate, onDateFocus]);
93
158
  const handleKeyDown = useCallback(event => {
94
159
  switch (event.key) {
95
160
  case 'ArrowLeft':
@@ -108,8 +173,34 @@ const Calendar = ({
108
173
  adjustDate(7, 4, 4);
109
174
  event.preventDefault();
110
175
  break;
176
+ case 'Enter':
177
+ case ' ':
178
+ if (mode === 'day' && focusedDate && event.target.hasAttribute('data-calendar-cell')) {
179
+ handleSelectedDateUpdate(focusedDate);
180
+ event.preventDefault();
181
+ }
182
+ break;
111
183
  }
112
- }, [adjustDate]);
184
+ }, [adjustDate, focusedDate, mode, handleSelectedDateUpdate]);
185
+ const focusedDateOutOfRange = focusedDate ? !isWithinRange(focusedDate, min, max) : false;
186
+ const formatDateForPrompt = date => formatDate(date, intl.locale, LONG_DAY_FORMAT);
187
+ const outOfRangePromptText = min && max ? intl.formatMessage(messages.outOfRangeBetween, {
188
+ min: formatDateForPrompt(min),
189
+ max: formatDateForPrompt(max)
190
+ }) : min ? intl.formatMessage(messages.outOfRangeAfter, {
191
+ min: formatDateForPrompt(min)
192
+ }) : max ? intl.formatMessage(messages.outOfRangeBefore, {
193
+ max: formatDateForPrompt(max)
194
+ }) : '';
195
+ const hasOutOfRangeDates = mode === 'day' && !!(min || max);
196
+ const showRulesPrompt = mode === 'day' && !!disabledRules && hasDisabledDatesInMonth(viewMonth, viewYear, disabledRules, min, max);
197
+ const showOutOfRangePrompt = mode === 'day' && focusedDateOutOfRange;
198
+ const showPrompt = hasOutOfRangeDates || showRulesPrompt;
199
+ const promptText = showOutOfRangePrompt ? outOfRangePromptText : disabledRules?.reason ?? outOfRangePromptText;
200
+ const promptSentiment = showOutOfRangePrompt || focusedDateDisabled ? 'negative' : 'neutral';
201
+ // Visible when there's an actionable message; sr-only when only hasOutOfRangeDates is true
202
+ // (prompt exists for aria-describedby but no visual cue needed until an out-of-range date is focused)
203
+ const promptClassName = showOutOfRangePrompt || showRulesPrompt ? 'm-t-1' : 'sr-only';
113
204
  return (
114
205
  /*#__PURE__*/
115
206
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions
@@ -117,16 +208,22 @@ const Calendar = ({
117
208
  onKeyDown: handleKeyDown,
118
209
  children: [mode === 'day' && /*#__PURE__*/jsx(DayCalendar, {
119
210
  selectedDate: selectedDate,
211
+ focusedDate: focusedDate,
120
212
  min: min,
121
213
  max: max,
122
214
  viewMonth: viewMonth,
123
215
  viewYear: viewYear,
124
216
  monthFormat: monthFormat,
217
+ disabledRules: disabledRules,
218
+ disabledReasonId: showPrompt ? disabledReasonId : undefined,
219
+ announceReasonOnFocus: !hasInteracted,
125
220
  onSelect: handleSelectedDateUpdate,
221
+ onDayFocus: handleDayFocus,
126
222
  onLabelClick: switchToYears,
127
223
  onViewDateUpdate: handleViewDateUpdate
128
224
  }), mode === 'month' && /*#__PURE__*/jsx(MonthCalendar, {
129
225
  selectedDate: selectedDate,
226
+ focusedDate: focusedDate,
130
227
  min: min,
131
228
  max: max,
132
229
  viewYear: viewYear,
@@ -138,6 +235,7 @@ const Calendar = ({
138
235
  onViewDateUpdate: handleViewDateUpdate
139
236
  }), mode === 'year' && /*#__PURE__*/jsx(YearCalendar, {
140
237
  selectedDate: selectedDate,
238
+ focusedDate: focusedDate,
141
239
  min: min,
142
240
  max: max,
143
241
  viewYear: viewYear,
@@ -146,6 +244,12 @@ const Calendar = ({
146
244
  }),
147
245
  onSelect: switchToMonths,
148
246
  onViewDateUpdate: handleViewDateUpdate
247
+ }), showPrompt && /*#__PURE__*/jsx(InlinePrompt, {
248
+ sentiment: promptSentiment,
249
+ width: "full",
250
+ id: disabledReasonId,
251
+ className: promptClassName,
252
+ children: promptText
149
253
  })]
150
254
  })
151
255
  );
@@ -1 +1 @@
1
- {"version":3,"file":"Calendar.mjs","sources":["../../src/Calendar/Calendar.tsx"],"sourcesContent":["import { useState, useCallback, useEffect, KeyboardEvent } from 'react';\n\nimport { MonthFormat } from '../common';\nimport { isWithinRange, moveToWithinRange, returnDateView } from '../common/DateUtils';\nimport DayCalendar from './DayCalendar';\nimport { getStartOfDay } from './GetStartOfDay';\nimport MonthCalendar from './MonthCalendar';\nimport YearCalendar from './YearCalendar';\n\nexport interface CalendarProps {\n value: Date | null;\n min?: Date | null;\n max?: Date | null;\n monthFormat?: `${MonthFormat}`;\n placeholder?: string;\n onChange: (date: Date | null) => void;\n onSelect?: (date: Date) => void;\n}\n\nconst Calendar = ({\n value,\n min: minProp = null,\n max: maxProp = null,\n monthFormat = MonthFormat.LONG,\n placeholder,\n onChange,\n onSelect,\n}: CalendarProps) => {\n const selectedDate = getStartOfDay(value);\n const min = getStartOfDay(minProp);\n const max = getStartOfDay(maxProp);\n\n useEffect(() => {\n if (selectedDate && !isWithinRange(selectedDate, min, max)) {\n onChange(moveToWithinRange(selectedDate, min, max));\n }\n }, [selectedDate?.getTime(), min?.getTime(), max?.getTime(), onChange]); // eslint-disable-line react-hooks/exhaustive-deps\n\n const dateView = returnDateView(selectedDate, min, max);\n const [viewMonth, setViewMonth] = useState(dateView.getMonth());\n const [viewYear, setViewYear] = useState(dateView.getFullYear());\n const [mode, setMode] = useState<'day' | 'month' | 'year'>('day');\n\n useEffect(() => {\n const view = returnDateView(selectedDate, min, max);\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setViewMonth(view.getMonth());\n\n setViewYear(view.getFullYear());\n }, [selectedDate?.getTime(), min?.getTime(), max?.getTime()]); // eslint-disable-line react-hooks/exhaustive-deps\n\n const handleViewDateUpdate = useCallback(\n // eslint-disable-next-line react-hooks/preserve-manual-memoization\n ({ month, year }: { month?: number; year?: number }) => {\n if (month !== undefined) setViewMonth(month);\n if (year !== undefined) setViewYear(year);\n },\n [],\n );\n\n const switchToDays = useCallback(() => setMode('day'), []);\n const switchToMonths = useCallback(() => setMode('month'), []);\n const switchToYears = useCallback(() => setMode('year'), []);\n\n const handleSelectedDateUpdate = useCallback(\n (date: Date) => {\n if (onSelect) {\n onSelect(date);\n } else {\n onChange(date);\n }\n },\n [onChange, onSelect],\n );\n\n const adjustDate = useCallback(\n (daysToAdd: number, monthsToAdd: number, yearsToAdd: number) => {\n let date: Date | null;\n if (selectedDate) {\n date = new Date(\n mode === 'year' ? selectedDate.getFullYear() + yearsToAdd : selectedDate.getFullYear(),\n mode === 'month' ? selectedDate.getMonth() + monthsToAdd : selectedDate.getMonth(),\n mode === 'day' ? selectedDate.getDate() + daysToAdd : selectedDate.getDate(),\n );\n } else {\n date = getStartOfDay(new Date());\n }\n date &&= moveToWithinRange(date, min, max);\n if (date?.getTime() !== selectedDate?.getTime()) {\n onChange(date);\n }\n },\n [selectedDate, min, max, mode, onChange],\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n switch (event.key) {\n case 'ArrowLeft':\n adjustDate(-1, -1, -1);\n event.preventDefault();\n break;\n case 'ArrowUp':\n adjustDate(-7, -4, -4);\n event.preventDefault();\n break;\n case 'ArrowRight':\n adjustDate(1, 1, 1);\n event.preventDefault();\n break;\n case 'ArrowDown':\n adjustDate(7, 4, 4);\n event.preventDefault();\n break;\n default:\n break;\n }\n },\n [adjustDate],\n );\n\n return (\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <div onKeyDown={handleKeyDown}>\n {mode === 'day' && (\n <DayCalendar\n selectedDate={selectedDate}\n min={min}\n max={max}\n viewMonth={viewMonth}\n viewYear={viewYear}\n monthFormat={monthFormat}\n onSelect={handleSelectedDateUpdate}\n onLabelClick={switchToYears}\n onViewDateUpdate={handleViewDateUpdate}\n />\n )}\n {mode === 'month' && (\n <MonthCalendar\n selectedDate={selectedDate}\n min={min}\n max={max}\n viewYear={viewYear}\n {...(placeholder != null && { placeholder })}\n onSelect={switchToDays}\n onLabelClick={switchToYears}\n onViewDateUpdate={handleViewDateUpdate}\n />\n )}\n {mode === 'year' && (\n <YearCalendar\n selectedDate={selectedDate}\n min={min}\n max={max}\n viewYear={viewYear}\n {...(placeholder != null && { placeholder })}\n onSelect={switchToMonths}\n onViewDateUpdate={handleViewDateUpdate}\n />\n )}\n </div>\n );\n};\n\nexport default Calendar;\n"],"names":["Calendar","value","min","minProp","max","maxProp","monthFormat","MonthFormat","LONG","placeholder","onChange","onSelect","selectedDate","getStartOfDay","useEffect","isWithinRange","moveToWithinRange","getTime","dateView","returnDateView","viewMonth","setViewMonth","useState","getMonth","viewYear","setViewYear","getFullYear","mode","setMode","view","handleViewDateUpdate","useCallback","month","year","undefined","switchToDays","switchToMonths","switchToYears","handleSelectedDateUpdate","date","adjustDate","daysToAdd","monthsToAdd","yearsToAdd","Date","getDate","handleKeyDown","event","key","preventDefault","_jsxs","onKeyDown","children","_jsx","DayCalendar","onLabelClick","onViewDateUpdate","MonthCalendar","YearCalendar"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,MAAMA,QAAQ,GAAGA,CAAC;EAChBC,KAAK;EACLC,GAAG,EAAEC,OAAO,GAAG,IAAI;EACnBC,GAAG,EAAEC,OAAO,GAAG,IAAI;EACnBC,WAAW,GAAGC,WAAW,CAACC,IAAI;EAC9BC,WAAW;EACXC,QAAQ;AACRC,EAAAA;AAAQ,CACM,KAAI;AAClB,EAAA,MAAMC,YAAY,GAAGC,aAAa,CAACZ,KAAK,CAAC;AACzC,EAAA,MAAMC,GAAG,GAAGW,aAAa,CAACV,OAAO,CAAC;AAClC,EAAA,MAAMC,GAAG,GAAGS,aAAa,CAACR,OAAO,CAAC;AAElCS,EAAAA,SAAS,CAAC,MAAK;IACb,IAAIF,YAAY,IAAI,CAACG,aAAa,CAACH,YAAY,EAAEV,GAAG,EAAEE,GAAG,CAAC,EAAE;MAC1DM,QAAQ,CAACM,iBAAiB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AAyB;AACnCiB,QAAAA,YAAY,EAAElB,aAAc;AAC5BmB,QAAAA,gBAAgB,EAAE1B;OAAqB,CAE1C,EACAH,IAAI,KAAK,OAAO,iBACf0B,GAAA,CAACI,aAAa,EAAA;AACZ7C,QAAAA,YAAY,EAAEA,YAAa;AAC3BV,QAAAA,GAAG,EAAEA,GAAI;AACTE,QAAAA,GAAG,EAAEA,GAAI;AACToB,QAAAA,QAAQ,EAAEA,QAAS;QAAA,IACdf,WAAW,IAAI,IAAI,IAAI;AAAEA,UAAAA;SAAa,CAAA;AAC3CE,QAAAA,QAAQ,EAAEwB,YAAa;AACvBoB,QAAAA,YAAY,EAAElB,aAAc;AAC5BmB,QAAAA,gBAAgB,EAAE1B;OAAqB,CAE1C,EACAH,IAAI,KAAK,MAAM,iBACd0B,GAAA,CAACK,YAAY,EAAA;AACX9C,QAAAA,YAAY,EAAEA,YAAa;AAC3BV,QAAAA,GAAG,EAAEA,GAAI;AACTE,QAAAA,GAAG,EAAEA,GAAI;AACToB,QAAAA,QAAQ,EAAEA,QAAS;QAAA,IACdf,WAAW,IAAI,IAAI,IAAI;AAAEA,UAAAA;SAAa,CAAA;AAC3CE,QAAAA,QAAQ,EAAEyB,cAAe;AACzBoB,QAAAA,gBAAgB,EAAE1B;AAAqB,OAAA,CAE1C;KACE;AAAC;AAEV;;;;"}
1
+ {"version":3,"file":"Calendar.mjs","sources":["../../src/Calendar/Calendar.tsx"],"sourcesContent":["import { useState, useCallback, useEffect, useId, useRef, KeyboardEvent } from 'react';\nimport { useIntl } from 'react-intl';\nimport { formatDate } from '@transferwise/formatting';\n\nimport { MonthFormat } from '../common';\nimport { isWithinRange, moveToWithinRange, returnDateView } from '../common/DateUtils';\nimport { clampToDayViewBoundary, isDateDisabled, hasDisabledDatesInMonth } from './_helpers';\nimport { LONG_DAY_FORMAT } from './Calendar.constants';\nimport { InlinePrompt } from '../Prompt/InlinePrompt';\nimport type { DateChangeMeta, DisabledRules } from './Calendar.types';\nimport DayCalendar from './DayCalendar';\nimport { getStartOfDay } from './GetStartOfDay';\nimport messages from './Calendar.messages';\nimport MonthCalendar from './MonthCalendar';\nimport YearCalendar from './YearCalendar';\n\nexport interface CalendarProps {\n /** The currently selected date, or `null` for no selection. */\n value: Date | null;\n /** Earliest selectable date (inclusive). Dates before this are interactive but not selectable, and show a boundary prompt. */\n min?: Date | null;\n /** Latest selectable date (inclusive). Dates after this are interactive but not selectable, and show a boundary prompt. */\n max?: Date | null;\n /** Month name format in the header. Defaults to `'long'` (e.g. \"January\"). */\n monthFormat?: `${MonthFormat}`;\n /** Placeholder text shown in the month/year cells when no date is selected. */\n placeholder?: string;\n /** Rules for disabling specific weekdays, individual dates, or date ranges. The required `reason` is shown in an inline prompt and linked to disabled cells via `aria-describedby` for screen reader accessibility. */\n disabledRules?: DisabledRules;\n /** Called whenever the focused date changes — including disabled and out-of-range dates. `meta.isEnabled` is `false` when the date is not selectable. */\n onDateFocus?: (date: Date | null, meta: DateChangeMeta) => void;\n /** Called when a date is confirmed (click or Enter). Only fires for enabled dates. */\n onChange?: (date: Date | null) => void;\n}\n\n/**\n * Temporary toggle — set `true` to restore strict min/max keyboard clamping.\n * @see https://transferwise.atlassian.net/browse/DS-8518\n */\nconst STRICT_KEYBOARD_CLAMPING = false;\n\n/**\n * Inline calendar for selecting a single date. Powers [DateLookup](?path=/docs/forms-datelookup--docs).\n */\nconst Calendar = ({\n value,\n min: minProp = null,\n max: maxProp = null,\n monthFormat = MonthFormat.LONG,\n placeholder,\n disabledRules,\n onDateFocus,\n onChange,\n}: CalendarProps) => {\n const intl = useIntl();\n const selectedDate = getStartOfDay(value);\n const min = getStartOfDay(minProp);\n const max = getStartOfDay(maxProp);\n const disabledReasonId = useId();\n const disabledRulesRef = useRef(disabledRules);\n useEffect(() => {\n disabledRulesRef.current = disabledRules;\n });\n\n const [hasInteracted, setHasInteracted] = useState(false);\n const [focusedDate, setFocusedDate] = useState<Date | null>(selectedDate);\n\n useEffect(() => {\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setFocusedDate(selectedDate);\n }, [selectedDate?.getTime()]); // eslint-disable-line react-hooks/exhaustive-deps\n\n const checkIsEnabled = (date: Date | null) => {\n if (!date) return true;\n return isWithinRange(date, min, max) && !isDateDisabled(date, disabledRulesRef.current);\n };\n\n const focusedDateDisabled = focusedDate\n ? !isWithinRange(focusedDate, min, max) || isDateDisabled(focusedDate, disabledRules)\n : false;\n\n useEffect(() => {\n if (selectedDate && !isWithinRange(selectedDate, min, max)) {\n const clamped = moveToWithinRange(selectedDate, min, max);\n setFocusedDate(clamped); // eslint-disable-line react-hooks/set-state-in-effect\n onDateFocus?.(clamped, { isEnabled: checkIsEnabled(clamped) });\n }\n }, [selectedDate?.getTime(), min?.getTime(), max?.getTime(), onDateFocus]); // eslint-disable-line react-hooks/exhaustive-deps\n\n const dateView = returnDateView(selectedDate, min, max);\n const [viewMonth, setViewMonth] = useState(dateView.getMonth());\n const [viewYear, setViewYear] = useState(dateView.getFullYear());\n const [mode, setMode] = useState<'day' | 'month' | 'year'>('day');\n\n useEffect(() => {\n const view = returnDateView(selectedDate, min, max);\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setViewMonth(view.getMonth());\n\n setViewYear(view.getFullYear());\n }, [selectedDate?.getTime(), min?.getTime(), max?.getTime()]); // eslint-disable-line react-hooks/exhaustive-deps\n\n useEffect(() => {\n if (focusedDate) {\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setViewMonth(focusedDate.getMonth());\n setViewYear(focusedDate.getFullYear());\n }\n }, [focusedDate?.getTime()]); // eslint-disable-line react-hooks/exhaustive-deps\n\n const handleViewDateUpdate = useCallback(\n // eslint-disable-next-line react-hooks/preserve-manual-memoization\n ({ month, year }: { month?: number; year?: number }) => {\n if (month !== undefined) setViewMonth(month);\n if (year !== undefined) setViewYear(year);\n setHasInteracted(false);\n },\n [],\n );\n\n const switchToDays = useCallback(() => setMode('day'), []);\n const switchToMonths = useCallback(() => setMode('month'), []);\n const switchToYears = useCallback(() => setMode('year'), []);\n\n const handleSelectedDateUpdate = useCallback(\n (date: Date) => {\n if (!hasInteracted) setHasInteracted(true);\n const isEnabled = checkIsEnabled(date);\n setFocusedDate(date);\n onDateFocus?.(date, { isEnabled });\n if (isEnabled && onChange) {\n onChange(date);\n }\n },\n [onDateFocus, onChange], // eslint-disable-line react-hooks/exhaustive-deps\n );\n\n const adjustDate = useCallback(\n (daysToAdd: number, monthsToAdd: number, yearsToAdd: number) => {\n const base = focusedDate ?? selectedDate;\n let date: Date | null;\n if (base) {\n date = new Date(\n mode === 'year' ? base.getFullYear() + yearsToAdd : base.getFullYear(),\n mode === 'month' ? base.getMonth() + monthsToAdd : base.getMonth(),\n mode === 'day' ? base.getDate() + daysToAdd : base.getDate(),\n );\n } else {\n date = getStartOfDay(new Date());\n }\n date &&=\n STRICT_KEYBOARD_CLAMPING || mode !== 'day'\n ? moveToWithinRange(date, min, max)\n : clampToDayViewBoundary(date, min, max);\n if (date?.getTime() !== focusedDate?.getTime()) {\n const monthChanged = date\n ? date.getMonth() !== focusedDate?.getMonth() ||\n date.getFullYear() !== focusedDate?.getFullYear()\n : false;\n setFocusedDate(date);\n if (date) {\n setViewMonth(date.getMonth());\n setViewYear(date.getFullYear());\n }\n if (monthChanged) {\n setHasInteracted(false);\n } else if (!hasInteracted) {\n setHasInteracted(true);\n }\n onDateFocus?.(date, { isEnabled: checkIsEnabled(date) });\n }\n },\n [focusedDate, selectedDate, min, max, mode, onDateFocus], // eslint-disable-line react-hooks/exhaustive-deps\n );\n\n const handleDayFocus = useCallback(\n (date: Date) => {\n if (date.getTime() !== focusedDate?.getTime()) {\n setFocusedDate(date);\n onDateFocus?.(date, { isEnabled: checkIsEnabled(date) });\n }\n },\n [focusedDate, onDateFocus], // eslint-disable-line react-hooks/exhaustive-deps\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n switch (event.key) {\n case 'ArrowLeft':\n adjustDate(-1, -1, -1);\n event.preventDefault();\n break;\n case 'ArrowUp':\n adjustDate(-7, -4, -4);\n event.preventDefault();\n break;\n case 'ArrowRight':\n adjustDate(1, 1, 1);\n event.preventDefault();\n break;\n case 'ArrowDown':\n adjustDate(7, 4, 4);\n event.preventDefault();\n break;\n case 'Enter':\n case ' ':\n if (\n mode === 'day' &&\n focusedDate &&\n (event.target as HTMLElement).hasAttribute('data-calendar-cell')\n ) {\n handleSelectedDateUpdate(focusedDate);\n event.preventDefault();\n }\n break;\n default:\n break;\n }\n },\n [adjustDate, focusedDate, mode, handleSelectedDateUpdate],\n );\n\n const focusedDateOutOfRange = focusedDate ? !isWithinRange(focusedDate, min, max) : false;\n\n const formatDateForPrompt = (date: Date) => formatDate(date, intl.locale, LONG_DAY_FORMAT);\n\n const outOfRangePromptText =\n min && max\n ? intl.formatMessage(messages.outOfRangeBetween, {\n min: formatDateForPrompt(min),\n max: formatDateForPrompt(max),\n })\n : min\n ? intl.formatMessage(messages.outOfRangeAfter, { min: formatDateForPrompt(min) })\n : max\n ? intl.formatMessage(messages.outOfRangeBefore, { max: formatDateForPrompt(max) })\n : '';\n\n const hasOutOfRangeDates = mode === 'day' && !!(min || max);\n const showRulesPrompt =\n mode === 'day' &&\n !!disabledRules &&\n hasDisabledDatesInMonth(viewMonth, viewYear, disabledRules, min, max);\n const showOutOfRangePrompt = mode === 'day' && focusedDateOutOfRange;\n const showPrompt = hasOutOfRangeDates || showRulesPrompt;\n\n const promptText = showOutOfRangePrompt\n ? outOfRangePromptText\n : (disabledRules?.reason ?? outOfRangePromptText);\n const promptSentiment = showOutOfRangePrompt || focusedDateDisabled ? 'negative' : 'neutral';\n // Visible when there's an actionable message; sr-only when only hasOutOfRangeDates is true\n // (prompt exists for aria-describedby but no visual cue needed until an out-of-range date is focused)\n const promptClassName = showOutOfRangePrompt || showRulesPrompt ? 'm-t-1' : 'sr-only';\n\n return (\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <div onKeyDown={handleKeyDown}>\n {mode === 'day' && (\n <DayCalendar\n selectedDate={selectedDate}\n focusedDate={focusedDate}\n min={min}\n max={max}\n viewMonth={viewMonth}\n viewYear={viewYear}\n monthFormat={monthFormat}\n disabledRules={disabledRules}\n disabledReasonId={showPrompt ? disabledReasonId : undefined}\n announceReasonOnFocus={!hasInteracted}\n onSelect={handleSelectedDateUpdate}\n onDayFocus={handleDayFocus}\n onLabelClick={switchToYears}\n onViewDateUpdate={handleViewDateUpdate}\n />\n )}\n {mode === 'month' && (\n <MonthCalendar\n selectedDate={selectedDate}\n focusedDate={focusedDate}\n min={min}\n max={max}\n viewYear={viewYear}\n {...(placeholder != null && { placeholder })}\n onSelect={switchToDays}\n onLabelClick={switchToYears}\n onViewDateUpdate={handleViewDateUpdate}\n />\n )}\n {mode === 'year' && (\n <YearCalendar\n selectedDate={selectedDate}\n focusedDate={focusedDate}\n min={min}\n max={max}\n viewYear={viewYear}\n {...(placeholder != null && { placeholder })}\n onSelect={switchToMonths}\n onViewDateUpdate={handleViewDateUpdate}\n />\n )}\n {showPrompt && (\n <InlinePrompt\n sentiment={promptSentiment}\n width=\"full\"\n id={disabledReasonId}\n className={promptClassName}\n >\n {promptText}\n </InlinePrompt>\n )}\n </div>\n );\n};\n\nexport default Calendar;\n"],"names":["Calendar","value","min","minProp","max","maxProp","monthFormat","MonthFormat","LONG","placeholder","disabledRules","onDateFocus","onChange","intl","useIntl","selectedDate","getStartOfDay","disabledReasonId","useId","disabledRulesRef","useRef","useEffect","current","hasInteracted","setHasInteracted","useState","focusedDate","setFocusedDate","getTime","checkIsEnabled","date","isWithinRange","isDateDisabled","focusedDateDisabled","clamped","moveToWithinRange","isEnabled","dateView","returnDateView","viewMonth","setViewMonth","getMonth","viewYear","setViewYear","getFullYear","mode","setMode","view","handleViewDateUpdate","useCallback","month","year","undefined","switchToDays","switchToMonths","switchToYears","handleSelectedDateUpdate","adjustDate","daysToAdd","monthsToAdd","yearsToAdd","base","Date","getDate","clampToDayViewBoundary","monthChanged","handleDayFocus","handleKeyDown","event","key","preventDefault","target","hasAttribute","focusedDateOutOfRange","formatDateForPrompt","formatDate","locale","LONG_DAY_FORMAT","outOfRangePromptText","formatMessage","messages","outOfRangeBetween","outOfRangeAfter","outOfRangeBefore","hasOutOfRangeDates","showRulesPrompt","hasDisabledDatesInMonth","showOutOfRangePrompt","showPrompt","promptText","reason","promptSentiment","promptClassName","_jsxs","onKeyDown","children","_jsx","DayCalendar","announceReasonOnFocus","onSelect","onDayFocus","onLabelClick","onViewDateUpdate","MonthCalendar","YearCalendar","InlinePrompt","sentiment","width","id","className"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA;;AAEG;AACH,MAAMA,QAAQ,GAAGA,CAAC;EAChBC,KAAK;EACLC,GAAG,EAAEC,OAAO,GAAG,IAAI;EACnBC,GAAG,EAAEC,OAAO,GAAG,IAAI;EACnBC,WAAW,GAAGC,WAAW,CAACC,IAAI;EAC9BC,WAAW;EACXC,aAAa;EACbC,WAAW;AACXC,EAAAA;AAAQ,CACM,KAAI;AAClB,EAAA,MAAMC,IAAI,GAAGC,OAAO,EAAE;AACtB,EAAA,MAAMC,YAAY,GAAGC,aAAa,CAACf,KAAK,CAAC;AACzC,EAAA,MAAMC,GAAG,GAAGc,aAAa,CAACb,OAAO,CAAC;AAClC,EAAA,MAAMC,GAAG,GAAGY,aAAa,CAACX,OAAO,CAAC;AAClC,EAAA,MAAMY,gBAAgB,GAAGC,KAAK,EAAE;AAChC,EAAA,MAAMC,gBAAgB,GAAGC,MAAM,CAACV,aAAa,CAAC;AAC9CW,EAAAA,SAAS,CAAC,MAAK;IACbF,gBAAgB,CAACG,OAAO,GAAGZ,aAAa;AAC1C,EAAA,CAAC,CAAC;EAEF,MAAM,CAACa,aAAa,EAAEC,gBAAgB,CAAC,GAAGC,QAAQ,CAAC,KAAK,CAAC;EACzD,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGF,QAAQ,CAAcV,YAAY,CAAC;AAEzEM,E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AI;AACTE,QAAAA,GAAG,EAAEA,GAAI;AACTsC,QAAAA,QAAQ,EAAEA,QAAS;QAAA,IACdjC,WAAW,IAAI,IAAI,IAAI;AAAEA,UAAAA;SAAa,CAAA;AAC3C0F,QAAAA,QAAQ,EAAE7C,cAAe;AACzBgD,QAAAA,gBAAgB,EAAEtD;AAAqB,OAAA,CAE1C,EACAwC,UAAU,iBACTQ,GAAA,CAACS,YAAY,EAAA;AACXC,QAAAA,SAAS,EAAEf,eAAgB;AAC3BgB,QAAAA,KAAK,EAAC,MAAM;AACZC,QAAAA,EAAE,EAAE3F,gBAAiB;AACrB4F,QAAAA,SAAS,EAAEjB,eAAgB;AAAAG,QAAAA,QAAA,EAE1BN;AAAU,OACC,CACf;KACE;AAAC;AAEV;;;;"}
@@ -41,7 +41,9 @@ const DateHeader = ({
41
41
  onLabelClick,
42
42
  onPreviousClick,
43
43
  onNextClick,
44
- dateMode
44
+ dateMode,
45
+ isPreviousDisabled,
46
+ isNextDisabled
45
47
  }) => {
46
48
  const intl = reactIntl.useIntl();
47
49
  const {
@@ -56,6 +58,7 @@ const DateHeader = ({
56
58
  priority: "minimal",
57
59
  className: "d-inline-flex",
58
60
  "aria-label": `${intl.formatMessage(Calendar_messages.default.previous)} ${dateMode}`,
61
+ disabled: isPreviousDisabled,
59
62
  onClick: onPreviousClick,
60
63
  children: /*#__PURE__*/jsxRuntime.jsx(icons.ChevronLeft, {
61
64
  className: "left-single-direction"
@@ -85,6 +88,7 @@ const DateHeader = ({
85
88
  className: "d-inline-flex",
86
89
  "aria-label": `${intl.formatMessage(Calendar_messages.default.next)} ${dateMode}`,
87
90
  priority: "minimal",
91
+ disabled: isNextDisabled,
88
92
  onClick: onNextClick,
89
93
  children: /*#__PURE__*/jsxRuntime.jsx(icons.ChevronRight, {
90
94
  className: "right-single-direction"
@@ -1 +1 @@
1
- {"version":3,"file":"DateHeader.js","sources":["../../../src/Calendar/DateHeader/DateHeader.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useIntl } from 'react-intl';\n\nimport { Typography } from '../../common';\nimport { useLayout } from '../../common/hooks';\nimport Title from '../../Title';\nimport messages from '../Calendar.messages';\nimport Button from '../../Button/Button';\nimport { ChevronDown, ChevronLeft, ChevronRight } from '@transferwise/icons';\nimport IconButton from '../../IconButton';\n\ninterface DateHeaderProps {\n label?: string;\n onLabelClick?: () => void;\n onPreviousClick: () => void;\n onNextClick: () => void;\n dateMode: string;\n}\n\nconst DateHeader: React.FC<DateHeaderProps> = ({\n label,\n onLabelClick,\n onPreviousClick,\n onNextClick,\n dateMode,\n}) => {\n const intl = useIntl();\n const { isMobile } = useLayout();\n return (\n <div className={clsx('text-xs-center', !isMobile && ['clearfix', 'p-y-1'])}>\n <div className=\"pull-left-single-direction\">\n <IconButton\n size={40}\n priority=\"minimal\"\n className=\"d-inline-flex\"\n aria-label={`${intl.formatMessage(messages.previous)} ${dateMode}`}\n onClick={onPreviousClick}\n >\n <ChevronLeft className=\"left-single-direction\" />\n </IconButton>\n </div>\n {label && (\n <Title type={Typography.TITLE_BODY} className=\"tw-date-lookup-header-current-container\">\n <Button\n v2\n size=\"md\"\n type=\"button\"\n priority=\"tertiary\"\n className=\"tw-date-lookup-header-current\"\n aria-label={intl.formatMessage(messages.goTo20YearView)}\n addonEnd={{ type: 'icon', value: <ChevronDown /> }}\n onClick={onLabelClick}\n >\n {label}\n </Button>\n </Title>\n )}\n <div className=\"pull-right-single-direction\">\n <IconButton\n size={40}\n className=\"d-inline-flex\"\n aria-label={`${intl.formatMessage(messages.next)} ${dateMode}`}\n priority=\"minimal\"\n onClick={onNextClick}\n >\n <ChevronRight className=\"right-single-direction\" />\n </IconButton>\n </div>\n </div>\n );\n};\n\nexport default DateHeader;\n"],"names":["DateHeader","label","onLabelClick","onPreviousClick","onNextClick","dateMode","intl","useIntl","isMobile","useLayout","_jsxs","className","clsx","children","_jsx","IconButton","size","priority","formatMessage","messages","previous","onClick","ChevronLeft","Title","type","Typography","TITLE_BODY","Button","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AU;AACnBN,QAAAA,SAAS,EAAC,+BAA+B;AACzC,QAAA,YAAA,EAAYL,IAAI,CAACY,aAAa,CAACC,yBAAQ,CAACU,cAAc,CAAE;AACxDC,QAAAA,QAAQ,EAAE;AAAEN,UAAAA,IAAI,EAAE,MAAM;AAAEO,UAAAA,KAAK,eAAEjB,cAAA,CAACkB,iBAAW,EAAA,EAAA;SAAM;AACnDX,QAAAA,OAAO,EAAEnB,YAAa;AAAAW,QAAAA,QAAA,EAErBZ;OACK;KACH,CACR,eACDa,cAAA,CAAA,KAAA,EAAA;AAAKH,MAAAA,SAAS,EAAC,6BAA6B;MAAAE,QAAA,eAC1CC,cAAA,CAACC,kBAAU,EAAA;AACTC,QAAAA,IAAI,EAAE,EAAG;AACTL,QAAAA,SAAS,EAAC,eAAe;QACzB,YAAA,EAAY,CAAA,EAAGL,IAAI,CAACY,aAAa,CAACC,yBAAQ,CAACc,IAAI,CAAC,CAAA,CAAA,EAAI5B,QAAQ,CAAA,CAAG;AAC/DY,QAAAA,QAAQ,EAAC,SAAS;AAClBI,QAAAA,OAAO,EAAEjB,WAAY;QAAAS,QAAA,eAErBC,cAAA,CAACoB,kBAAY,EAAA;AAACvB,UAAAA,SAAS,EAAC;SAAwB;OACtC;AACd,KAAK,CACP;AAAA,GAAK,CAAC;AAEV;;;;"}
1
+ {"version":3,"file":"DateHeader.js","sources":["../../../src/Calendar/DateHeader/DateHeader.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useIntl } from 'react-intl';\n\nimport { Typography } from '../../common';\nimport { useLayout } from '../../common/hooks';\nimport Title from '../../Title';\nimport messages from '../Calendar.messages';\nimport Button from '../../Button/Button';\nimport { ChevronDown, ChevronLeft, ChevronRight } from '@transferwise/icons';\nimport IconButton from '../../IconButton';\n\ninterface DateHeaderProps {\n label?: string;\n onLabelClick?: () => void;\n onPreviousClick: () => void;\n onNextClick: () => void;\n dateMode: string;\n isPreviousDisabled?: boolean;\n isNextDisabled?: boolean;\n}\n\nconst DateHeader: React.FC<DateHeaderProps> = ({\n label,\n onLabelClick,\n onPreviousClick,\n onNextClick,\n dateMode,\n isPreviousDisabled,\n isNextDisabled,\n}) => {\n const intl = useIntl();\n const { isMobile } = useLayout();\n return (\n <div className={clsx('text-xs-center', !isMobile && ['clearfix', 'p-y-1'])}>\n <div className=\"pull-left-single-direction\">\n <IconButton\n size={40}\n priority=\"minimal\"\n className=\"d-inline-flex\"\n aria-label={`${intl.formatMessage(messages.previous)} ${dateMode}`}\n disabled={isPreviousDisabled}\n onClick={onPreviousClick}\n >\n <ChevronLeft className=\"left-single-direction\" />\n </IconButton>\n </div>\n {label && (\n <Title type={Typography.TITLE_BODY} className=\"tw-date-lookup-header-current-container\">\n <Button\n v2\n size=\"md\"\n type=\"button\"\n priority=\"tertiary\"\n className=\"tw-date-lookup-header-current\"\n aria-label={intl.formatMessage(messages.goTo20YearView)}\n addonEnd={{ type: 'icon', value: <ChevronDown /> }}\n onClick={onLabelClick}\n >\n {label}\n </Button>\n </Title>\n )}\n <div className=\"pull-right-single-direction\">\n <IconButton\n size={40}\n className=\"d-inline-flex\"\n aria-label={`${intl.formatMessage(messages.next)} ${dateMode}`}\n priority=\"minimal\"\n disabled={isNextDisabled}\n onClick={onNextClick}\n >\n <ChevronRight className=\"right-single-direction\" />\n </IconButton>\n </div>\n </div>\n );\n};\n\nexport default DateHeader;\n"],"names":["DateHeader","label","onLabelClick","onPreviousClick","onNextClick","dateMode","isPreviousDisabled","isNextDisabled","intl","useIntl","isMobile","useLayout","_jsxs","className","clsx","children","_jsx","IconButton","size","priority","formatMessage","messages","previous","disabled","onClick","ChevronLeft","Title","type","Typography","TITLE_BODY","Button","v2","goTo20YearView","addonEnd","value","ChevronDown","next","ChevronRight"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAMA,UAAU,GAA8BA,CAAC;EAC7CC,KAAK;EACLC,YAAY;EACZC,eAAe;EACfC,WAAW;EACXC,QAAQ;EACR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,QAAQ,EAAE;AAAEN,UAAAA,IAAI,EAAE,MAAM;AAAEO,UAAAA,KAAK,eAAElB,cAAA,CAACmB,iBAAW,EAAA,EAAA;SAAM;AACnDX,QAAAA,OAAO,EAAEtB,YAAa;AAAAa,QAAAA,QAAA,EAErBd;OACK;KACH,CACR,eACDe,cAAA,CAAA,KAAA,EAAA;AAAKH,MAAAA,SAAS,EAAC,6BAA6B;MAAAE,QAAA,eAC1CC,cAAA,CAACC,kBAAU,EAAA;AACTC,QAAAA,IAAI,EAAE,EAAG;AACTL,QAAAA,SAAS,EAAC,eAAe;QACzB,YAAA,EAAY,CAAA,EAAGL,IAAI,CAACY,aAAa,CAACC,yBAAQ,CAACe,IAAI,CAAC,CAAA,CAAA,EAAI/B,QAAQ,CAAA,CAAG;AAC/Dc,QAAAA,QAAQ,EAAC,SAAS;AAClBI,QAAAA,QAAQ,EAAEhB,cAAe;AACzBiB,QAAAA,OAAO,EAAEpB,WAAY;QAAAW,QAAA,eAErBC,cAAA,CAACqB,kBAAY,EAAA;AAACxB,UAAAA,SAAS,EAAC;SAAwB;OACtC;AACd,KAAK,CACP;AAAA,GAAK,CAAC;AAEV;;;;"}
@@ -37,7 +37,9 @@ const DateHeader = ({
37
37
  onLabelClick,
38
38
  onPreviousClick,
39
39
  onNextClick,
40
- dateMode
40
+ dateMode,
41
+ isPreviousDisabled,
42
+ isNextDisabled
41
43
  }) => {
42
44
  const intl = useIntl();
43
45
  const {
@@ -52,6 +54,7 @@ const DateHeader = ({
52
54
  priority: "minimal",
53
55
  className: "d-inline-flex",
54
56
  "aria-label": `${intl.formatMessage(messages.previous)} ${dateMode}`,
57
+ disabled: isPreviousDisabled,
55
58
  onClick: onPreviousClick,
56
59
  children: /*#__PURE__*/jsx(ChevronLeft, {
57
60
  className: "left-single-direction"
@@ -81,6 +84,7 @@ const DateHeader = ({
81
84
  className: "d-inline-flex",
82
85
  "aria-label": `${intl.formatMessage(messages.next)} ${dateMode}`,
83
86
  priority: "minimal",
87
+ disabled: isNextDisabled,
84
88
  onClick: onNextClick,
85
89
  children: /*#__PURE__*/jsx(ChevronRight, {
86
90
  className: "right-single-direction"
@@ -1 +1 @@
1
- {"version":3,"file":"DateHeader.mjs","sources":["../../../src/Calendar/DateHeader/DateHeader.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useIntl } from 'react-intl';\n\nimport { Typography } from '../../common';\nimport { useLayout } from '../../common/hooks';\nimport Title from '../../Title';\nimport messages from '../Calendar.messages';\nimport Button from '../../Button/Button';\nimport { ChevronDown, ChevronLeft, ChevronRight } from '@transferwise/icons';\nimport IconButton from '../../IconButton';\n\ninterface DateHeaderProps {\n label?: string;\n onLabelClick?: () => void;\n onPreviousClick: () => void;\n onNextClick: () => void;\n dateMode: string;\n}\n\nconst DateHeader: React.FC<DateHeaderProps> = ({\n label,\n onLabelClick,\n onPreviousClick,\n onNextClick,\n dateMode,\n}) => {\n const intl = useIntl();\n const { isMobile } = useLayout();\n return (\n <div className={clsx('text-xs-center', !isMobile && ['clearfix', 'p-y-1'])}>\n <div className=\"pull-left-single-direction\">\n <IconButton\n size={40}\n priority=\"minimal\"\n className=\"d-inline-flex\"\n aria-label={`${intl.formatMessage(messages.previous)} ${dateMode}`}\n onClick={onPreviousClick}\n >\n <ChevronLeft className=\"left-single-direction\" />\n </IconButton>\n </div>\n {label && (\n <Title type={Typography.TITLE_BODY} className=\"tw-date-lookup-header-current-container\">\n <Button\n v2\n size=\"md\"\n type=\"button\"\n priority=\"tertiary\"\n className=\"tw-date-lookup-header-current\"\n aria-label={intl.formatMessage(messages.goTo20YearView)}\n addonEnd={{ type: 'icon', value: <ChevronDown /> }}\n onClick={onLabelClick}\n >\n {label}\n </Button>\n </Title>\n )}\n <div className=\"pull-right-single-direction\">\n <IconButton\n size={40}\n className=\"d-inline-flex\"\n aria-label={`${intl.formatMessage(messages.next)} ${dateMode}`}\n priority=\"minimal\"\n onClick={onNextClick}\n >\n <ChevronRight className=\"right-single-direction\" />\n </IconButton>\n </div>\n </div>\n );\n};\n\nexport default DateHeader;\n"],"names":["DateHeader","label","onLabelClick","onPreviousClick","onNextClick","dateMode","intl","useIntl","isMobile","useLayout","_jsxs","className","clsx","children","_jsx","IconButton","size","priority","formatMessage","messages","previous","onClick","ChevronLeft","Title","type","Typography","TITLE_BODY","Button","v2","goTo20YearView","addonEnd","value","ChevronDown","next","ChevronRight"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,MAAMA,UAAU,GAA8BA,CAAC;EAC7CC,KAAK;EACLC,YAAY;EACZC,eAAe;EACfC,WAAW;AACXC,EAAAA;AAAQ,CACT,KAAI;AACH,EAAA,MAAMC,IAAI,GAAGC,OAAO,EAAE;EACtB,MAAM;AAAEC,IAAAA;GAAU,GAAGC,SAAS,EAAE;AAChC,EAAA,oBACEC,IAAA,CAAA,KAAA,EAAA;AAAKC,IAAAA,SAAS,EAAEC,IAAI,CAAC,gBAAgB,EAAE,CAACJ,QAAQ,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CAAE;AAAAK,IAAAA,QAAA,gBACzEC,GAAA,CAAA,KAAA,EAAA;AAAKH,MAAAA,SAAS,EAAC,4BAA4B;MAAAE,QAAA,eACzCC,GAAA,CAACC,UAAU,EAAA;AACTC,QAAAA,IAAI,EAAE,EAAG;AACTC,QAAAA,QAAQ,EAAC,SAAS;AAClBN,QAAAA,SAAS,EAAC,eAAe;QACzB,YAAA,EAAY,CAAA,EAAGL,IAAI,CAACY,aAAa,CAACC,QAAQ,CAACC,QAAQ,CAAC,CAAA,CAAA,EAAIf,QAAQ,CAAA,CAAG;AACnEgB,QAAAA,OAAO,EAAElB,eAAgB;QAAAU,QAAA,eAEzBC,GAAA,CAACQ,WAAW,EAAA;AAACX,UAAAA,SAAS,EAAC;SAAuB;OACpC;AACd,KAAK,CACL,EAACV,KAAK,iBACJa,GAAA,CAACS,KAAK,EAAA;MAACC,IAAI,EAAEC,UAAU,CAACC,UAAW;AAACf,MAAAA,SAAS,EAAC,yCAAyC;MAAAE,QAAA,eACrFC,GAAA,CAACa,MAAM,EAAA;QACLC,EAAE,EAAA,IAAA;AACFZ,QAAAA,IAAI,EAAC,IAAI;AACTQ,QAAAA,IAAI,EAAC,QAAQ;AACbP,QAAAA,QAAQ,EAAC,UAAU;AACnBN,QAAAA,SAAS,EAAC,+BAA+B;AACzC,QAAA,YAAA,EAAYL,IAAI,CAACY,aAAa,CAACC,QAAQ,CAACU,cAAc,CAAE;AACxDC,QAAAA,QAAQ,EAAE;AAAEN,UAAAA,IAAI,EAAE,MAAM;AAAEO,UAAAA,KAAK,eAAEjB,GAAA,CAACkB,WAAW,EAAA,EAAA;SAAM;AACnDX,QAAAA,OAAO,EAAEnB,YAAa;AAAAW,QAAAA,QAAA,EAErBZ;OACK;KACH,CACR,eACDa,GAAA,CAAA,KAAA,EAAA;AAAKH,MAAAA,SAAS,EAAC,6BAA6B;MAAAE,QAAA,eAC1CC,GAAA,CAACC,UAAU,EAAA;AACTC,QAAAA,IAAI,EAAE,EAAG;AACTL,QAAAA,SAAS,EAAC,eAAe;QACzB,YAAA,EAAY,CAAA,EAAGL,IAAI,CAACY,aAAa,CAACC,QAAQ,CAACc,IAAI,CAAC,CAAA,CAAA,EAAI5B,QAAQ,CAAA,CAAG;AAC/DY,QAAAA,QAAQ,EAAC,SAAS;AAClBI,QAAAA,OAAO,EAAEjB,WAAY;QAAAS,QAAA,eAErBC,GAAA,CAACoB,YAAY,EAAA;AAACvB,UAAAA,SAAS,EAAC;SAAwB;OACtC;AACd,KAAK,CACP;AAAA,GAAK,CAAC;AAEV;;;;"}
1
+ {"version":3,"file":"DateHeader.mjs","sources":["../../../src/Calendar/DateHeader/DateHeader.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useIntl } from 'react-intl';\n\nimport { Typography } from '../../common';\nimport { useLayout } from '../../common/hooks';\nimport Title from '../../Title';\nimport messages from '../Calendar.messages';\nimport Button from '../../Button/Button';\nimport { ChevronDown, ChevronLeft, ChevronRight } from '@transferwise/icons';\nimport IconButton from '../../IconButton';\n\ninterface DateHeaderProps {\n label?: string;\n onLabelClick?: () => void;\n onPreviousClick: () => void;\n onNextClick: () => void;\n dateMode: string;\n isPreviousDisabled?: boolean;\n isNextDisabled?: boolean;\n}\n\nconst DateHeader: React.FC<DateHeaderProps> = ({\n label,\n onLabelClick,\n onPreviousClick,\n onNextClick,\n dateMode,\n isPreviousDisabled,\n isNextDisabled,\n}) => {\n const intl = useIntl();\n const { isMobile } = useLayout();\n return (\n <div className={clsx('text-xs-center', !isMobile && ['clearfix', 'p-y-1'])}>\n <div className=\"pull-left-single-direction\">\n <IconButton\n size={40}\n priority=\"minimal\"\n className=\"d-inline-flex\"\n aria-label={`${intl.formatMessage(messages.previous)} ${dateMode}`}\n disabled={isPreviousDisabled}\n onClick={onPreviousClick}\n >\n <ChevronLeft className=\"left-single-direction\" />\n </IconButton>\n </div>\n {label && (\n <Title type={Typography.TITLE_BODY} className=\"tw-date-lookup-header-current-container\">\n <Button\n v2\n size=\"md\"\n type=\"button\"\n priority=\"tertiary\"\n className=\"tw-date-lookup-header-current\"\n aria-label={intl.formatMessage(messages.goTo20YearView)}\n addonEnd={{ type: 'icon', value: <ChevronDown /> }}\n onClick={onLabelClick}\n >\n {label}\n </Button>\n </Title>\n )}\n <div className=\"pull-right-single-direction\">\n <IconButton\n size={40}\n className=\"d-inline-flex\"\n aria-label={`${intl.formatMessage(messages.next)} ${dateMode}`}\n priority=\"minimal\"\n disabled={isNextDisabled}\n onClick={onNextClick}\n >\n <ChevronRight className=\"right-single-direction\" />\n </IconButton>\n </div>\n </div>\n );\n};\n\nexport default DateHeader;\n"],"names":["DateHeader","label","onLabelClick","onPreviousClick","onNextClick","dateMode","isPreviousDisabled","isNextDisabled","intl","useIntl","isMobile","useLayout","_jsxs","className","clsx","children","_jsx","IconButton","size","priority","formatMessage","messages","previous","disabled","onClick","ChevronLeft","Title","type","Typography","TITLE_BODY","Button","v2","goTo20YearView","addon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EAAC,QAAQ;AACbR,QAAAA,QAAQ,EAAC,UAAU;AACnBN,QAAAA,SAAS,EAAC,+BAA+B;AACzC,QAAA,YAAA,EAAYL,IAAI,CAACY,aAAa,CAACC,QAAQ,CAACW,cAAc,CAAE;AACxDC,QAAAA,QAAQ,EAAE;AAAEN,UAAAA,IAAI,EAAE,MAAM;AAAEO,UAAAA,KAAK,eAAElB,GAAA,CAACmB,WAAW,EAAA,EAAA;SAAM;AACnDX,QAAAA,OAAO,EAAEtB,YAAa;AAAAa,QAAAA,QAAA,EAErBd;OACK;KACH,CACR,eACDe,GAAA,CAAA,KAAA,EAAA;AAAKH,MAAAA,SAAS,EAAC,6BAA6B;MAAAE,QAAA,eAC1CC,GAAA,CAACC,UAAU,EAAA;AACTC,QAAAA,IAAI,EAAE,EAAG;AACTL,QAAAA,SAAS,EAAC,eAAe;QACzB,YAAA,EAAY,CAAA,EAAGL,IAAI,CAACY,aAAa,CAACC,QAAQ,CAACe,IAAI,CAAC,CAAA,CAAA,EAAI/B,QAAQ,CAAA,CAAG;AAC/Dc,QAAAA,QAAQ,EAAC,SAAS;AAClBI,QAAAA,QAAQ,EAAEhB,cAAe;AACzBiB,QAAAA,OAAO,EAAEpB,WAAY;QAAAW,QAAA,eAErBC,GAAA,CAACqB,YAAY,EAAA;AAACxB,UAAAA,SAAS,EAAC;SAAwB;OACtC;AACd,KAAK,CACP;AAAA,GAAK,CAAC;AAEV;;;;"}
@@ -34,6 +34,7 @@ let DayCalendar$1 = class DayCalendar extends React.PureComponent {
34
34
  render() {
35
35
  const {
36
36
  selectedDate,
37
+ focusedDate,
37
38
  min,
38
39
  max,
39
40
  viewMonth,
@@ -43,9 +44,19 @@ let DayCalendar$1 = class DayCalendar extends React.PureComponent {
43
44
  formatMessage
44
45
  },
45
46
  monthFormat,
47
+ disabledRules,
48
+ disabledReasonId,
49
+ announceReasonOnFocus,
46
50
  onLabelClick,
47
- onSelect
51
+ onSelect,
52
+ onDayFocus
48
53
  } = this.props;
54
+ const prevMonth = viewMonth <= 0 ? 11 : viewMonth - 1;
55
+ const prevYear = viewMonth <= 0 ? viewYear - 1 : viewYear;
56
+ const nextMonth = viewMonth >= 11 ? 0 : viewMonth + 1;
57
+ const nextYear = viewMonth >= 11 ? viewYear + 1 : viewYear;
58
+ const isPreviousDisabled = !!(min && new Date(prevYear, prevMonth) < new Date(min.getFullYear(), min.getMonth()));
59
+ const isNextDisabled = !!(max && new Date(nextYear, nextMonth) > new Date(max.getFullYear(), max.getMonth()));
49
60
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
50
61
  children: [/*#__PURE__*/jsxRuntime.jsx(DateHeader.default, {
51
62
  label: formatting.formatDate(new Date(viewYear, viewMonth), locale, {
@@ -53,16 +64,23 @@ let DayCalendar$1 = class DayCalendar extends React.PureComponent {
53
64
  year: 'numeric'
54
65
  }),
55
66
  dateMode: formatMessage(Calendar_messages.default.month),
67
+ isPreviousDisabled: isPreviousDisabled,
68
+ isNextDisabled: isNextDisabled,
56
69
  onLabelClick: onLabelClick,
57
70
  onPreviousClick: this.selectPreviousMonth,
58
71
  onNextClick: this.selectNextMonth
59
72
  }), /*#__PURE__*/jsxRuntime.jsx(DayCalendarTable.default, {
60
73
  selectedDate,
74
+ focusedDate,
61
75
  min,
62
76
  max,
63
77
  viewMonth,
64
78
  viewYear,
65
- onSelect
79
+ disabledRules,
80
+ disabledReasonId,
81
+ announceReasonOnFocus,
82
+ onSelect,
83
+ onDayFocus
66
84
  })]
67
85
  });
68
86
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DayCalendar.js","sources":["../../../src/Calendar/DayCalendar/DayCalendar.tsx"],"sourcesContent":["import { formatDate } from '@transferwise/formatting';\nimport { PureComponent } from 'react';\n\nimport { MonthFormat } from '../../common';\nimport messages from '../Calendar.messages';\nimport DateHeader from '../DateHeader';\n\nimport DayCalendarTable from './Table';\nimport { injectIntl, type WrappedComponentProps } from '../../common/injectIntl';\n\ninterface DayCalendarProps extends WrappedComponentProps {\n selectedDate: Date | null;\n min: Date | null;\n max: Date | null;\n viewMonth: number;\n viewYear: number;\n monthFormat: `${MonthFormat}`;\n onSelect: (date: Date) => void;\n onLabelClick: () => void;\n onViewDateUpdate: (date: { month: number; year: number }) => void;\n}\n\nclass DayCalendar extends PureComponent<DayCalendarProps> {\n selectPreviousMonth = () => {\n const { viewMonth, viewYear } = this.props;\n this.props.onViewDateUpdate({\n month: viewMonth <= 0 ? 11 : viewMonth - 1,\n year: viewMonth <= 0 ? viewYear - 1 : viewYear,\n });\n };\n\n selectNextMonth = () => {\n const { viewMonth, viewYear } = this.props;\n this.props.onViewDateUpdate({\n month: viewMonth >= 11 ? 0 : viewMonth + 1,\n year: viewMonth >= 11 ? viewYear + 1 : viewYear,\n });\n };\n\n render() {\n const {\n selectedDate,\n min,\n max,\n viewMonth,\n viewYear,\n intl: { locale, formatMessage },\n monthFormat,\n onLabelClick,\n onSelect,\n } = this.props;\n return (\n <>\n <DateHeader\n label={formatDate(new Date(viewYear, viewMonth), locale, {\n month: monthFormat,\n year: 'numeric',\n })}\n dateMode={formatMessage(messages.month)}\n onLabelClick={onLabelClick}\n onPreviousClick={this.selectPreviousMonth}\n onNextClick={this.selectNextMonth}\n />\n <DayCalendarTable {...{ selectedDate, min, max, viewMonth, viewYear, onSelect }} />\n </>\n );\n }\n}\n\nexport default injectIntl(DayCalendar);\n"],"names":["DayCalendar","PureComponent","selectPreviousMonth","viewMonth","viewYear","props","onViewDateUpdate","month","year","selectNextMonth","render","selectedDate","min","max","intl","locale","formatMessage","monthFormat","onLabelClick","onSelect","_jsxs","_Fragment","children","_jsx","DateHeader","label","formatDate","Date","dateMode","messages","onPreviousClick","onNextClick","DayCalendarTable","injectIntl"],"mappings":";;;;;;;;;;;;oBAsBA,MAAMA,WAAY,SAAQC,mBAA+B,CAAA;EACvDC,mBAAmB,GAAGA,MAAK;IACzB,MAAM;MAAEC,SAAS;AAAEC,MAAAA;KAAU,GAAG,IAAI,CAACC,KAAK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IAAI,CAACtB;AAAgB,OAAA,CAEpC,eAAAc,cAAA,CAACS,wBAAgB,EAAA;QAAOrB,YAAY;QAAEC,GAAG;QAAEC,GAAG;QAAEV,SAAS;QAAEC,QAAQ;AAAEe,QAAAA;AAAQ,OAAG,CAClF;AAAA,KAAA,CAAG;AAEP,EAAA;AACD;AAED,kBAAec,qBAAU,CAACjC,aAAW,CAAC;;;;"}
1
+ {"version":3,"file":"DayCalendar.js","sources":["../../../src/Calendar/DayCalendar/DayCalendar.tsx"],"sourcesContent":["import { formatDate } from '@transferwise/formatting';\nimport { PureComponent } from 'react';\n\nimport { MonthFormat } from '../../common';\nimport type { DisabledRules } from '../Calendar.types';\nimport messages from '../Calendar.messages';\nimport DateHeader from '../DateHeader';\n\nimport DayCalendarTable from './Table';\nimport { injectIntl, type WrappedComponentProps } from '../../common/injectIntl';\n\ninterface DayCalendarProps extends WrappedComponentProps {\n selectedDate: Date | null;\n focusedDate?: Date | null;\n min: Date | null;\n max: Date | null;\n viewMonth: number;\n viewYear: number;\n monthFormat: `${MonthFormat}`;\n disabledRules?: DisabledRules;\n disabledReasonId?: string;\n announceReasonOnFocus?: boolean;\n onSelect: (date: Date) => void;\n onDayFocus?: (date: Date) => void;\n onLabelClick: () => void;\n onViewDateUpdate: (date: { month: number; year: number }) => void;\n}\n\nclass DayCalendar extends PureComponent<DayCalendarProps> {\n selectPreviousMonth = () => {\n const { viewMonth, viewYear } = this.props;\n this.props.onViewDateUpdate({\n month: viewMonth <= 0 ? 11 : viewMonth - 1,\n year: viewMonth <= 0 ? viewYear - 1 : viewYear,\n });\n };\n\n selectNextMonth = () => {\n const { viewMonth, viewYear } = this.props;\n this.props.onViewDateUpdate({\n month: viewMonth >= 11 ? 0 : viewMonth + 1,\n year: viewMonth >= 11 ? viewYear + 1 : viewYear,\n });\n };\n\n render() {\n const {\n selectedDate,\n focusedDate,\n min,\n max,\n viewMonth,\n viewYear,\n intl: { locale, formatMessage },\n monthFormat,\n disabledRules,\n disabledReasonId,\n announceReasonOnFocus,\n onLabelClick,\n onSelect,\n onDayFocus,\n } = this.props;\n const prevMonth = viewMonth <= 0 ? 11 : viewMonth - 1;\n const prevYear = viewMonth <= 0 ? viewYear - 1 : viewYear;\n const nextMonth = viewMonth >= 11 ? 0 : viewMonth + 1;\n const nextYear = viewMonth >= 11 ? viewYear + 1 : viewYear;\n const isPreviousDisabled = !!(\n min && new Date(prevYear, prevMonth) < new Date(min.getFullYear(), min.getMonth())\n );\n const isNextDisabled = !!(\n max && new Date(nextYear, nextMonth) > new Date(max.getFullYear(), max.getMonth())\n );\n\n return (\n <>\n <DateHeader\n label={formatDate(new Date(viewYear, viewMonth), locale, {\n month: monthFormat,\n year: 'numeric',\n })}\n dateMode={formatMessage(messages.month)}\n isPreviousDisabled={isPreviousDisabled}\n isNextDisabled={isNextDisabled}\n onLabelClick={onLabelClick}\n onPreviousClick={this.selectPreviousMonth}\n onNextClick={this.selectNextMonth}\n />\n <DayCalendarTable\n {...{\n selectedDate,\n focusedDate,\n min,\n max,\n viewMonth,\n viewYear,\n disabledRules,\n disabledReasonId,\n announceReasonOnFocus,\n onSelect,\n onDayFocus,\n }}\n />\n </>\n );\n }\n}\n\nexport default injectIntl(DayCalendar);\n"],"names":["DayCalendar","PureComponent","selectPreviousMonth","viewMonth","viewYear","props","onViewDateUpdate","month","year","selectNextMonth","render","selectedDate","focusedDate","min","max","intl","locale","formatMessage","monthFormat","disabledRules","disabledReasonId","announceReasonOnFocus","onLabelClick","onSelect","onDayFocus","prevMonth","prevYear","nextMonth","nextYear","isPreviousDisabled","Date","getFullYear","getMonth","isNextDisabled","_jsxs","_Fragment","children","_jsx","DateHeader","label","formatDate","dateMode","messages","onPreviousClick","onNextClick","DayCalendarTable","injectIntl"],"mappings":";;;;;;;;;;;;oBA4BA,MAAMA,WAAY,SAAQC,mBAA+B,CAAA;EACvDC,mBAAmB,GAAGA,MAAK;IACzB,MAAM;MAAEC,SAAS;AAAEC,MAAAA;KAAU,GAAG,IA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+30,7 @@ class DayCalendar extends PureComponent {
30
30
  render() {
31
31
  const {
32
32
  selectedDate,
33
+ focusedDate,
33
34
  min,
34
35
  max,
35
36
  viewMonth,
@@ -39,9 +40,19 @@ class DayCalendar extends PureComponent {
39
40
  formatMessage
40
41
  },
41
42
  monthFormat,
43
+ disabledRules,
44
+ disabledReasonId,
45
+ announceReasonOnFocus,
42
46
  onLabelClick,
43
- onSelect
47
+ onSelect,
48
+ onDayFocus
44
49
  } = this.props;
50
+ const prevMonth = viewMonth <= 0 ? 11 : viewMonth - 1;
51
+ const prevYear = viewMonth <= 0 ? viewYear - 1 : viewYear;
52
+ const nextMonth = viewMonth >= 11 ? 0 : viewMonth + 1;
53
+ const nextYear = viewMonth >= 11 ? viewYear + 1 : viewYear;
54
+ const isPreviousDisabled = !!(min && new Date(prevYear, prevMonth) < new Date(min.getFullYear(), min.getMonth()));
55
+ const isNextDisabled = !!(max && new Date(nextYear, nextMonth) > new Date(max.getFullYear(), max.getMonth()));
45
56
  return /*#__PURE__*/jsxs(Fragment, {
46
57
  children: [/*#__PURE__*/jsx(DateHeader, {
47
58
  label: formatDate(new Date(viewYear, viewMonth), locale, {
@@ -49,16 +60,23 @@ class DayCalendar extends PureComponent {
49
60
  year: 'numeric'
50
61
  }),
51
62
  dateMode: formatMessage(messages.month),
63
+ isPreviousDisabled: isPreviousDisabled,
64
+ isNextDisabled: isNextDisabled,
52
65
  onLabelClick: onLabelClick,
53
66
  onPreviousClick: this.selectPreviousMonth,
54
67
  onNextClick: this.selectNextMonth
55
68
  }), /*#__PURE__*/jsx(DayCalendarTable, {
56
69
  selectedDate,
70
+ focusedDate,
57
71
  min,
58
72
  max,
59
73
  viewMonth,
60
74
  viewYear,
61
- onSelect
75
+ disabledRules,
76
+ disabledReasonId,
77
+ announceReasonOnFocus,
78
+ onSelect,
79
+ onDayFocus
62
80
  })]
63
81
  });
64
82
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DayCalendar.mjs","sources":["../../../src/Calendar/DayCalendar/DayCalendar.tsx"],"sourcesContent":["import { formatDate } from '@transferwise/formatting';\nimport { PureComponent } from 'react';\n\nimport { MonthFormat } from '../../common';\nimport messages from '../Calendar.messages';\nimport DateHeader from '../DateHeader';\n\nimport DayCalendarTable from './Table';\nimport { injectIntl, type WrappedComponentProps } from '../../common/injectIntl';\n\ninterface DayCalendarProps extends WrappedComponentProps {\n selectedDate: Date | null;\n min: Date | null;\n max: Date | null;\n viewMonth: number;\n viewYear: number;\n monthFormat: `${MonthFormat}`;\n onSelect: (date: Date) => void;\n onLabelClick: () => void;\n onViewDateUpdate: (date: { month: number; year: number }) => void;\n}\n\nclass DayCalendar extends PureComponent<DayCalendarProps> {\n selectPreviousMonth = () => {\n const { viewMonth, viewYear } = this.props;\n this.props.onViewDateUpdate({\n month: viewMonth <= 0 ? 11 : viewMonth - 1,\n year: viewMonth <= 0 ? viewYear - 1 : viewYear,\n });\n };\n\n selectNextMonth = () => {\n const { viewMonth, viewYear } = this.props;\n this.props.onViewDateUpdate({\n month: viewMonth >= 11 ? 0 : viewMonth + 1,\n year: viewMonth >= 11 ? viewYear + 1 : viewYear,\n });\n };\n\n render() {\n const {\n selectedDate,\n min,\n max,\n viewMonth,\n viewYear,\n intl: { locale, formatMessage },\n monthFormat,\n onLabelClick,\n onSelect,\n } = this.props;\n return (\n <>\n <DateHeader\n label={formatDate(new Date(viewYear, viewMonth), locale, {\n month: monthFormat,\n year: 'numeric',\n })}\n dateMode={formatMessage(messages.month)}\n onLabelClick={onLabelClick}\n onPreviousClick={this.selectPreviousMonth}\n onNextClick={this.selectNextMonth}\n />\n <DayCalendarTable {...{ selectedDate, min, max, viewMonth, viewYear, onSelect }} />\n </>\n );\n }\n}\n\nexport default injectIntl(DayCalendar);\n"],"names":["DayCalendar","PureComponent","selectPreviousMonth","viewMonth","viewYear","props","onViewDateUpdate","month","year","selectNextMonth","render","selectedDate","min","max","intl","locale","formatMessage","monthFormat","onLabelClick","onSelect","_jsxs","_Fragment","children","_jsx","DateHeader","label","formatDate","Date","dateMode","messages","onPreviousClick","onNextClick","DayCalendarTable","injectIntl"],"mappings":";;;;;;;;AAsBA,MAAMA,WAAY,SAAQC,aAA+B,CAAA;EACvDC,mBAAmB,GAAGA,MAAK;IACzB,MAAM;MAAEC,SAAS;AAAEC,MAAAA;KAAU,GAAG,IAAI,CAACC,KAAK;AAC1C,IAAA,IAAI,CAACA,KAAK,CAACC,gBAAgB,CAAC;MAC1BC,KAAK,EAAEJ,SAAS,IAAI,CAAC,GAAG,EAAE,GAAGA,SAAS,GAAG,CAAC;MAC1CK,IAAI,EAAEL,SAAS,IAAI,CAAC,GAAGC,QAAQ,GAAG,CAAC,GAAGA;AACvC,KAAA,CAAC;EACJ,CAAC;EAEDK,eAAe,GAAGA,MAAK;IACrB,MAAM;MAAEN,SAAS;AAAEC,MAAAA;KAAU,GAAG,IAAI,CAACC,KAAK;AAC1C,IAAA,IAAI,CAACA,KAAK,CAACC,gBAAgB,CAAC;MAC1BC,KAAK,EAAEJ,SAAS,IAAI,EAAE,GAAG,CAAC,GAAGA,SAAS,GAAG,CAAC;MAC1CK,IAAI,EAAEL,SAAS,IAAI,EAAE,GAAGC,QAAQ,GAAG,CAAC,GAAGA;AACxC,KAAA,CAAC;EACJ,CAAC;AAEDM,EAAAA,MAAMA,GAAA;IACJ,MAAM;MACJC,YAAY;MACZC,GAAG;MACHC,GAAG;MACHV,SAAS;MACTC,QAAQ;AACRU,MAAAA,IAAI,EAAE;QAAEC,MAAM;AAAEC,QAAAA;OAAe;MAC/BC,WAAW;MACXC,YAAY;AACZC,MAAAA;KACD,GAAG,IAAI,CAACd,KAAK;IACd,oBACEe,IAAA,CAAAC,QAAA,EAAA;MAAAC,QAAA,EAAA,cACEC,GAAA,CAACC,UAAU,EAAA;AACTC,QAAAA,KAAK,EAAEC,UAAU,CAAC,IAAIC,IAAI,CAACvB,QAAQ,EAAED,SAAS,CAAC,EAAEY,MAAM,EAAE;AACvDR,UAAAA,KAAK,EAAEU,WAAW;AAClBT,UAAAA,IAAI,EAAE;AACP,SAAA,CAAE;AACHoB,QAAAA,QAAQ,EAAEZ,aAAa,CAACa,QAAQ,CAACtB,KAAK,CAAE;AACxCW,QAAAA,YAAY,EAAEA,YAAa;QAC3BY,eAAe,EAAE,IAAI,CAAC5B,mBAAoB;QAC1C6B,WAAW,EAAE,IAAI,CAACtB;AAAgB,OAAA,CAEpC,eAAAc,GAAA,CAACS,gBAAgB,EAAA;QAAOrB,YAAY;QAAEC,GAAG;QAAEC,GAAG;QAAEV,SAAS;QAAEC,QAAQ;AAAEe,QAAAA;AAAQ,OAAG,CAClF;AAAA,KAAA,CAAG;AAEP,EAAA;AACD;AAED,oBAAec,UAAU,CAACjC,WAAW,CAAC;;;;"}
1
+ {"version":3,"file":"DayCalendar.mjs","sources":["../../../src/Calendar/DayCalendar/DayCalendar.tsx"],"sourcesContent":["import { formatDate } from '@transferwise/formatting';\nimport { PureComponent } from 'react';\n\nimport { MonthFormat } from '../../common';\nimport type { DisabledRules } from '../Calendar.types';\nimport messages from '../Calendar.messages';\nimport DateHeader from '../DateHeader';\n\nimport DayCalendarTable from './Table';\nimport { injectIntl, type WrappedComponentProps } from '../../common/injectIntl';\n\ninterface DayCalendarProps extends WrappedComponentProps {\n selectedDate: Date | null;\n focusedDate?: Date | null;\n min: Date | null;\n max: Date | null;\n viewMonth: number;\n viewYear: number;\n monthFormat: `${MonthFormat}`;\n disabledRules?: DisabledRules;\n disabledReasonId?: string;\n announceReasonOnFocus?: boolean;\n onSelect: (date: Date) => void;\n onDayFocus?: (date: Date) => void;\n onLabelClick: () => void;\n onViewDateUpdate: (date: { month: number; year: number }) => void;\n}\n\nclass DayCalendar extends PureComponent<DayCalendarProps> {\n selectPreviousMonth = () => {\n const { viewMonth, viewYear } = this.props;\n this.props.onViewDateUpdate({\n month: viewMonth <= 0 ? 11 : viewMonth - 1,\n year: viewMonth <= 0 ? viewYear - 1 : viewYear,\n });\n };\n\n selectNextMonth = () => {\n const { viewMonth, viewYear } = this.props;\n this.props.onViewDateUpdate({\n month: viewMonth >= 11 ? 0 : viewMonth + 1,\n year: viewMonth >= 11 ? viewYear + 1 : viewYear,\n });\n };\n\n render() {\n const {\n selectedDate,\n focusedDate,\n min,\n max,\n viewMonth,\n viewYear,\n intl: { locale, formatMessage },\n monthFormat,\n disabledRules,\n disabledReasonId,\n announceReasonOnFocus,\n onLabelClick,\n onSelect,\n onDayFocus,\n } = this.props;\n const prevMonth = viewMonth <= 0 ? 11 : viewMonth - 1;\n const prevYear = viewMonth <= 0 ? viewYear - 1 : viewYear;\n const nextMonth = viewMonth >= 11 ? 0 : viewMonth + 1;\n const nextYear = viewMonth >= 11 ? viewYear + 1 : viewYear;\n const isPreviousDisabled = !!(\n min && new Date(prevYear, prevMonth) < new Date(min.getFullYear(), min.getMonth())\n );\n const isNextDisabled = !!(\n max && new Date(nextYear, nextMonth) > new Date(max.getFullYear(), max.getMonth())\n );\n\n return (\n <>\n <DateHeader\n label={formatDate(new Date(viewYear, viewMonth), locale, {\n month: monthFormat,\n year: 'numeric',\n })}\n dateMode={formatMessage(messages.month)}\n isPreviousDisabled={isPreviousDisabled}\n isNextDisabled={isNextDisabled}\n onLabelClick={onLabelClick}\n onPreviousClick={this.selectPreviousMonth}\n onNextClick={this.selectNextMonth}\n />\n <DayCalendarTable\n {...{\n selectedDate,\n focusedDate,\n min,\n max,\n viewMonth,\n viewYear,\n disabledRules,\n disabledReasonId,\n announceReasonOnFocus,\n onSelect,\n onDayFocus,\n }}\n />\n </>\n );\n }\n}\n\nexport default injectIntl(DayCalendar);\n"],"names":["DayCalendar","PureComponent","selectPreviousMonth","viewMonth","viewYear","props","onViewDateUpdate","month","year","selectNextMonth","render","selectedDate","focusedDate","min","max","intl","locale","formatMessage","monthFormat","disabledRules","disabledReasonId","announceReasonOnFocus","onLabelClick","onSelect","onDayFocus","prevMonth","prevYear","nextMonth","nextYear","isPreviousDisabled","Date","getFullYear","getMonth","isNextDisabled","_jsxs","_Fragment","children","_jsx","DateHeader","label","formatDate","dateMode","messages","onPreviousClick","onNextClick","DayCalendarTable","injectIntl"],"mappings":";;;;;;;;AA4BA,MAAMA,WAAY,SAAQC,aAA+B,CAAA;EACvDC,mBAAmB,GAAGA,MAAK;IACzB,MAAM;MAAEC,SAAS;AAAEC,MAAAA;KAAU,GAAG,IAAI,CAACC,KAAK;AAC1C,IAAA,IAAI,CAACA,KAAK,CAACC,gBAAgB,CAAC;MAC1BC,KAAK,EAAEJ,SAAS,IAAI,CAAC,GAAG,EAAE,GAAGA,SAAS,GAAG,CAAC;MAC1CK,IAAI,EAAEL,SAAS,IAAI,CAAC,GAAGC,QAAQ,GAAG,CAAC,GAAGA;AACvC,KAAA,CAAC;EACJ,CAAC;EAEDK,eAAe,GAAGA,MAAK;IACrB,MAAM;MAAEN,SAAS;AAAEC,MAAAA;KAAU,GAAG,IAAI,CAACC,KAAK;AAC1C,IAAA,IAAI,CAACA,KAAK,CAACC,gBAAgB,CAAC;MAC1BC,KAAK,EAAEJ,SAAS,IAAI,EAAE,GAAG,CAAC,GAAGA,SAAS,GAAG,CAAC;MAC1CK,IAAI,EAAEL,SAAS,IAAI,EAAE,GAAGC,QAAQ,GAAG,CAAC,GAAGA;AACxC,KAAA,CAAC;EACJ,CAAC;AAEDM,EAAAA,MAAMA,GAAA;IACJ,MAAM;MACJC,YAAY;MACZC,WAAW;MACXC,GAAG;MACHC,GAAG;MACHX,SAAS;MACTC,QAAQ;AACRW,MAAAA,IAAI,EAAE;QAAEC,MAAM;AAAEC,QAAAA;OAAe;MAC/BC,WAAW;MACXC,aAAa;MACbC,gBAAgB;MAChBC,qBAAqB;MACrBC,YAAY;MACZC,QAAQ;AACRC,MAAAA;KACD,GAAG,IAAI,CAACnB,KAAK;IACd,MAAMoB,SAAS,GAAGtB,SAAS,IAAI,CAAC,GAAG,EAAE,GAAGA,SAAS,GAAG,CAAC;IACrD,MAAMuB,QAAQ,GAAGvB,SAAS,IAAI,CAAC,GAAGC,QAAQ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