@transferwise/components 0.0.0-experimental-0df72a3 → 0.0.0-experimental-fe160ab

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 (158) 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 +116 -16
  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 +117 -17
  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 +91 -0
  34. package/build/Calendar/TableLink/TableLink.js.map +1 -0
  35. package/build/Calendar/TableLink/TableLink.mjs +87 -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/hasDisabledDatesInMonth/hasDisabledDatesInMonth.js +33 -0
  46. package/build/Calendar/_helpers/hasDisabledDatesInMonth/hasDisabledDatesInMonth.js.map +1 -0
  47. package/build/Calendar/_helpers/hasDisabledDatesInMonth/hasDisabledDatesInMonth.mjs +31 -0
  48. package/build/Calendar/_helpers/hasDisabledDatesInMonth/hasDisabledDatesInMonth.mjs.map +1 -0
  49. package/build/Calendar/_helpers/isDateDisabled/isDateDisabled.js +40 -0
  50. package/build/Calendar/_helpers/isDateDisabled/isDateDisabled.js.map +1 -0
  51. package/build/Calendar/_helpers/isDateDisabled/isDateDisabled.mjs +38 -0
  52. package/build/Calendar/_helpers/isDateDisabled/isDateDisabled.mjs.map +1 -0
  53. package/build/DateLookup/DateLookup.js +20 -9
  54. package/build/DateLookup/DateLookup.js.map +1 -1
  55. package/build/DateLookup/DateLookup.mjs +20 -9
  56. package/build/DateLookup/DateLookup.mjs.map +1 -1
  57. package/build/i18n/en.json +4 -0
  58. package/build/i18n/en.json.js +4 -0
  59. package/build/i18n/en.json.js.map +1 -1
  60. package/build/i18n/en.json.mjs +4 -0
  61. package/build/i18n/en.json.mjs.map +1 -1
  62. package/build/i18n/hu.json +1 -1
  63. package/build/i18n/hu.json.js +1 -1
  64. package/build/i18n/hu.json.mjs +1 -1
  65. package/build/index.js +2 -2
  66. package/build/index.mjs +1 -1
  67. package/build/main.css +123 -43
  68. package/build/styles/Calendar/Calendar.css +112 -37
  69. package/build/styles/Calendar/TableLink/TableLink.css +115 -0
  70. package/build/styles/main.css +123 -43
  71. package/build/types/Calendar/Calendar.constants.d.ts +2 -0
  72. package/build/types/Calendar/Calendar.constants.d.ts.map +1 -0
  73. package/build/types/Calendar/Calendar.d.ts +16 -3
  74. package/build/types/Calendar/Calendar.d.ts.map +1 -1
  75. package/build/types/Calendar/Calendar.messages.d.ts +20 -0
  76. package/build/types/Calendar/Calendar.messages.d.ts.map +1 -1
  77. package/build/types/Calendar/Calendar.types.d.ts +32 -0
  78. package/build/types/Calendar/Calendar.types.d.ts.map +1 -0
  79. package/build/types/Calendar/DateHeader/DateHeader.d.ts +2 -0
  80. package/build/types/Calendar/DateHeader/DateHeader.d.ts.map +1 -1
  81. package/build/types/Calendar/DayCalendar/DayCalendar.d.ts +7 -1
  82. package/build/types/Calendar/DayCalendar/DayCalendar.d.ts.map +1 -1
  83. package/build/types/Calendar/DayCalendar/Table/DayCalendarTable.d.ts +6 -0
  84. package/build/types/Calendar/DayCalendar/Table/DayCalendarTable.d.ts.map +1 -1
  85. package/build/types/Calendar/MonthCalendar/MonthCalendar.d.ts +1 -0
  86. package/build/types/Calendar/MonthCalendar/MonthCalendar.d.ts.map +1 -1
  87. package/build/types/Calendar/MonthCalendar/Table/MonthCalendarTable.d.ts +2 -1
  88. package/build/types/Calendar/MonthCalendar/Table/MonthCalendarTable.d.ts.map +1 -1
  89. package/build/types/Calendar/{tableLink → TableLink}/TableLink.d.ts +5 -1
  90. package/build/types/Calendar/TableLink/TableLink.d.ts.map +1 -0
  91. package/build/types/Calendar/TableLink/index.d.ts.map +1 -0
  92. package/build/types/Calendar/YearCalendar/Table/YearCalendarTable.d.ts +2 -1
  93. package/build/types/Calendar/YearCalendar/Table/YearCalendarTable.d.ts.map +1 -1
  94. package/build/types/Calendar/YearCalendar/YearCalendar.d.ts +1 -0
  95. package/build/types/Calendar/YearCalendar/YearCalendar.d.ts.map +1 -1
  96. package/build/types/Calendar/_helpers/hasDisabledDatesInMonth/hasDisabledDatesInMonth.d.ts +3 -0
  97. package/build/types/Calendar/_helpers/hasDisabledDatesInMonth/hasDisabledDatesInMonth.d.ts.map +1 -0
  98. package/build/types/Calendar/_helpers/index.d.ts +3 -0
  99. package/build/types/Calendar/_helpers/index.d.ts.map +1 -0
  100. package/build/types/Calendar/_helpers/isDateDisabled/isDateDisabled.d.ts +3 -0
  101. package/build/types/Calendar/_helpers/isDateDisabled/isDateDisabled.d.ts.map +1 -0
  102. package/build/types/Calendar/index.d.ts +1 -0
  103. package/build/types/Calendar/index.d.ts.map +1 -1
  104. package/build/types/DateLookup/DateLookup.d.ts +24 -5
  105. package/build/types/DateLookup/DateLookup.d.ts.map +1 -1
  106. package/build/types/DateLookup/index.d.ts +1 -0
  107. package/build/types/DateLookup/index.d.ts.map +1 -1
  108. package/build/types/index.d.ts +3 -2
  109. package/build/types/index.d.ts.map +1 -1
  110. package/build/types/test-utils/index.d.ts +8 -0
  111. package/build/types/test-utils/index.d.ts.map +1 -1
  112. package/package.json +1 -1
  113. package/src/Calendar/Calendar.constants.ts +5 -0
  114. package/src/Calendar/Calendar.css +112 -37
  115. package/src/Calendar/Calendar.disabledDates.test.tsx +593 -0
  116. package/src/Calendar/Calendar.less +5 -35
  117. package/src/Calendar/Calendar.messages.ts +21 -0
  118. package/src/Calendar/Calendar.test.tsx +310 -28
  119. package/src/Calendar/Calendar.tsx +159 -18
  120. package/src/Calendar/Calendar.types.ts +35 -0
  121. package/src/Calendar/DateHeader/DateHeader.tsx +6 -0
  122. package/src/Calendar/DayCalendar/DayCalendar.tsx +39 -1
  123. package/src/Calendar/DayCalendar/Table/DayCalendarTable.tsx +67 -27
  124. package/src/Calendar/MonthCalendar/MonthCalendar.tsx +8 -0
  125. package/src/Calendar/MonthCalendar/Table/MonthCalendarTable.tsx +15 -3
  126. package/src/Calendar/TableLink/TableLink.css +115 -0
  127. package/src/Calendar/TableLink/TableLink.less +68 -0
  128. package/src/Calendar/TableLink/TableLink.tsx +112 -0
  129. package/src/Calendar/YearCalendar/Table/YearCalendarTable.tsx +15 -3
  130. package/src/Calendar/YearCalendar/YearCalendar.tsx +9 -0
  131. package/src/Calendar/_helpers/hasDisabledDatesInMonth/hasDisabledDatesInMonth.test.ts +98 -0
  132. package/src/Calendar/_helpers/hasDisabledDatesInMonth/hasDisabledDatesInMonth.ts +45 -0
  133. package/src/Calendar/_helpers/index.ts +2 -0
  134. package/src/Calendar/_helpers/isDateDisabled/isDateDisabled.test.ts +169 -0
  135. package/src/Calendar/_helpers/isDateDisabled/isDateDisabled.ts +59 -0
  136. package/src/Calendar/_stories/Calendar.accessibility.docs.mdx +118 -0
  137. package/src/Calendar/_stories/Calendar.story.tsx +138 -4
  138. package/src/Calendar/_stories/Calendar.test.story.tsx +114 -0
  139. package/src/Calendar/index.ts +7 -0
  140. package/src/DateLookup/DateLookup.disabledDates.test.tsx +293 -0
  141. package/src/DateLookup/DateLookup.test.tsx +34 -37
  142. package/src/DateLookup/DateLookup.tsx +37 -13
  143. package/src/DateLookup/_stories/DateLookup.accessibility.docs.mdx +108 -0
  144. package/src/DateLookup/_stories/DateLookup.story.tsx +124 -2
  145. package/src/DateLookup/index.ts +6 -0
  146. package/src/i18n/en.json +4 -0
  147. package/src/i18n/hu.json +1 -1
  148. package/src/index.ts +3 -2
  149. package/src/main.css +123 -43
  150. package/build/Calendar/tableLink/TableLink.js +0 -61
  151. package/build/Calendar/tableLink/TableLink.js.map +0 -1
  152. package/build/Calendar/tableLink/TableLink.mjs +0 -57
  153. package/build/Calendar/tableLink/TableLink.mjs.map +0 -1
  154. package/build/types/Calendar/tableLink/TableLink.d.ts.map +0 -1
  155. package/build/types/Calendar/tableLink/index.d.ts.map +0 -1
  156. package/src/Calendar/tableLink/TableLink.tsx +0 -77
  157. /package/build/types/Calendar/{tableLink → TableLink}/index.d.ts +0 -0
  158. /package/src/Calendar/{tableLink → TableLink}/index.ts +0 -0
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ const LONG_DAY_FORMAT = {
4
+ day: 'numeric',
5
+ month: 'long',
6
+ year: 'numeric'
7
+ };
8
+
9
+ exports.LONG_DAY_FORMAT = LONG_DAY_FORMAT;
10
+ //# sourceMappingURL=Calendar.constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Calendar.constants.js","sources":["../../src/Calendar/Calendar.constants.ts"],"sourcesContent":["export const LONG_DAY_FORMAT: Intl.DateTimeFormatOptions = {\n day: 'numeric',\n month: 'long',\n year: 'numeric',\n};\n"],"names":["LONG_DAY_FORMAT","day","month","year"],"mappings":";;AAAO,MAAMA,eAAe,GAA+B;AACzDC,EAAAA,GAAG,EAAE,SAAS;AACdC,EAAAA,KAAK,EAAE,MAAM;AACbC,EAAAA,IAAI,EAAE;;;;;"}
@@ -0,0 +1,8 @@
1
+ const LONG_DAY_FORMAT = {
2
+ day: 'numeric',
3
+ month: 'long',
4
+ year: 'numeric'
5
+ };
6
+
7
+ export { LONG_DAY_FORMAT };
8
+ //# sourceMappingURL=Calendar.constants.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Calendar.constants.mjs","sources":["../../src/Calendar/Calendar.constants.ts"],"sourcesContent":["export const LONG_DAY_FORMAT: Intl.DateTimeFormatOptions = {\n day: 'numeric',\n month: 'long',\n year: 'numeric',\n};\n"],"names":["LONG_DAY_FORMAT","day","month","year"],"mappings":"AAAO,MAAMA,eAAe,GAA+B;AACzDC,EAAAA,GAAG,EAAE,SAAS;AACdC,EAAAA,KAAK,EAAE,MAAM;AACbC,EAAAA,IAAI,EAAE;;;;;"}
@@ -3,6 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
+ var reactIntl = require('react-intl');
7
+ var formatting = require('@transferwise/formatting');
6
8
  require('../common/theme.js');
7
9
  require('../common/direction.js');
8
10
  require('@transferwise/neptune-tokens');
@@ -22,17 +24,20 @@ require('../common/PropsValues/variant.js');
22
24
  require('../common/PropsValues/scroll.js');
23
25
  require('../common/PropsValues/markdownNodeType.js');
24
26
  require('../common/fileType.js');
25
- require('@transferwise/formatting');
26
27
  require('@transferwise/icons');
27
28
  require('clsx');
28
- require('react-intl');
29
29
  require('../common/CloseButton/CloseButton.messages.js');
30
30
  var jsxRuntime = require('react/jsx-runtime');
31
31
  var moveToWithinRange = require('../common/DateUtils/moveToWithinRange/moveToWithinRange.js');
32
32
  var isWithinRange = require('../common/DateUtils/isWithinRange/isWithinRange.js');
33
33
  var getDateView = require('../common/DateUtils/getDateView/getDateView.js');
34
+ var isDateDisabled = require('./_helpers/isDateDisabled/isDateDisabled.js');
35
+ var hasDisabledDatesInMonth = require('./_helpers/hasDisabledDatesInMonth/hasDisabledDatesInMonth.js');
36
+ var Calendar_constants = require('./Calendar.constants.js');
37
+ var InlinePrompt = require('../Prompt/InlinePrompt/InlinePrompt.js');
34
38
  var DayCalendar = require('./DayCalendar/DayCalendar.js');
35
39
  var GetStartOfDay = require('./GetStartOfDay/GetStartOfDay.js');
40
+ var Calendar_messages = require('./Calendar.messages.js');
36
41
  var MonthCalendar = require('./MonthCalendar/MonthCalendar.js');
37
42
  var YearCalendar = require('./YearCalendar/YearCalendar.js');
38
43
 
@@ -42,17 +47,39 @@ const Calendar = ({
42
47
  max: maxProp = null,
43
48
  monthFormat: monthFormat$1 = monthFormat.MonthFormat.LONG,
44
49
  placeholder,
45
- onChange,
46
- onSelect
50
+ disabledRules,
51
+ onDateFocus,
52
+ onChange
47
53
  }) => {
54
+ const intl = reactIntl.useIntl();
48
55
  const selectedDate = GetStartOfDay.getStartOfDay(value);
49
56
  const min = GetStartOfDay.getStartOfDay(minProp);
50
57
  const max = GetStartOfDay.getStartOfDay(maxProp);
58
+ const disabledReasonId = React.useId();
59
+ const disabledRulesRef = React.useRef(disabledRules);
60
+ React.useEffect(() => {
61
+ disabledRulesRef.current = disabledRules;
62
+ });
63
+ const [hasInteracted, setHasInteracted] = React.useState(false);
64
+ const [focusedDate, setFocusedDate] = React.useState(selectedDate);
65
+ React.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.isWithinRange(date, min, max) && !isDateDisabled.isDateDisabled(date, disabledRulesRef.current);
72
+ };
73
+ const focusedDateDisabled = focusedDate ? !isWithinRange.isWithinRange(focusedDate, min, max) || isDateDisabled.isDateDisabled(focusedDate, disabledRules) : false;
51
74
  React.useEffect(() => {
52
75
  if (selectedDate && !isWithinRange.isWithinRange(selectedDate, min, max)) {
53
- onChange(moveToWithinRange.moveToWithinRange(selectedDate, min, max));
76
+ const clamped = moveToWithinRange.moveToWithinRange(selectedDate, min, max);
77
+ setFocusedDate(clamped); // eslint-disable-line react-hooks/set-state-in-effect
78
+ onDateFocus?.(clamped, {
79
+ isEnabled: checkIsEnabled(clamped)
80
+ });
54
81
  }
55
- }, [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
56
83
  const dateView = getDateView.returnDateView(selectedDate, min, max);
57
84
  const [viewMonth, setViewMonth] = React.useState(dateView.getMonth());
58
85
  const [viewYear, setViewYear] = React.useState(dateView.getFullYear());
@@ -63,6 +90,13 @@ const Calendar = ({
63
90
  setViewMonth(view.getMonth());
64
91
  setViewYear(view.getFullYear());
65
92
  }, [selectedDate?.getTime(), min?.getTime(), max?.getTime()]); // eslint-disable-line react-hooks/exhaustive-deps
93
+ React.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
66
100
  const handleViewDateUpdate = React.useCallback(
67
101
  // eslint-disable-next-line react-hooks/preserve-manual-memoization
68
102
  ({
@@ -71,29 +105,56 @@ const Calendar = ({
71
105
  }) => {
72
106
  if (month !== undefined) setViewMonth(month);
73
107
  if (year !== undefined) setViewYear(year);
108
+ setHasInteracted(false);
74
109
  }, []);
75
110
  const switchToDays = React.useCallback(() => setMode('day'), []);
76
111
  const switchToMonths = React.useCallback(() => setMode('month'), []);
77
112
  const switchToYears = React.useCallback(() => setMode('year'), []);
78
113
  const handleSelectedDateUpdate = React.useCallback(date => {
79
- if (onSelect) {
80
- onSelect(date);
81
- } else {
114
+ if (!hasInteracted) setHasInteracted(true);
115
+ const isEnabled = checkIsEnabled(date);
116
+ setFocusedDate(date);
117
+ onDateFocus?.(date, {
118
+ isEnabled
119
+ });
120
+ if (isEnabled && onChange) {
82
121
  onChange(date);
83
122
  }
84
- }, [onChange, onSelect]);
123
+ }, [onDateFocus, onChange]);
85
124
  const adjustDate = React.useCallback((daysToAdd, monthsToAdd, yearsToAdd) => {
125
+ const base = focusedDate ?? selectedDate;
86
126
  let date;
87
- if (selectedDate) {
88
- 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());
89
129
  } else {
90
130
  date = GetStartOfDay.getStartOfDay(new Date());
91
131
  }
92
132
  date &&= moveToWithinRange.moveToWithinRange(date, min, max);
93
- if (date?.getTime() !== selectedDate?.getTime()) {
94
- onChange(date);
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
+ });
95
148
  }
96
- }, [selectedDate, min, max, mode, onChange]);
149
+ }, [focusedDate, selectedDate, min, max, mode, onDateFocus]);
150
+ const handleDayFocus = React.useCallback(date => {
151
+ if (date.getTime() !== focusedDate?.getTime()) {
152
+ setFocusedDate(date);
153
+ onDateFocus?.(date, {
154
+ isEnabled: checkIsEnabled(date)
155
+ });
156
+ }
157
+ }, [focusedDate, onDateFocus]);
97
158
  const handleKeyDown = React.useCallback(event => {
98
159
  switch (event.key) {
99
160
  case 'ArrowLeft':
@@ -112,8 +173,34 @@ const Calendar = ({
112
173
  adjustDate(7, 4, 4);
113
174
  event.preventDefault();
114
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;
115
183
  }
116
- }, [adjustDate]);
184
+ }, [adjustDate, focusedDate, mode, handleSelectedDateUpdate]);
185
+ const focusedDateOutOfRange = focusedDate ? !isWithinRange.isWithinRange(focusedDate, min, max) : false;
186
+ const formatDateForPrompt = date => formatting.formatDate(date, intl.locale, Calendar_constants.LONG_DAY_FORMAT);
187
+ const outOfRangePromptText = min && max ? intl.formatMessage(Calendar_messages.default.outOfRangeBetween, {
188
+ min: formatDateForPrompt(min),
189
+ max: formatDateForPrompt(max)
190
+ }) : min ? intl.formatMessage(Calendar_messages.default.outOfRangeAfter, {
191
+ min: formatDateForPrompt(min)
192
+ }) : max ? intl.formatMessage(Calendar_messages.default.outOfRangeBefore, {
193
+ max: formatDateForPrompt(max)
194
+ }) : '';
195
+ const hasOutOfRangeDates = mode === 'day' && !!(min || max);
196
+ const showRulesPrompt = mode === 'day' && !!disabledRules && hasDisabledDatesInMonth.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';
117
204
  return (
118
205
  /*#__PURE__*/
119
206
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions
@@ -121,16 +208,22 @@ const Calendar = ({
121
208
  onKeyDown: handleKeyDown,
122
209
  children: [mode === 'day' && /*#__PURE__*/jsxRuntime.jsx(DayCalendar.default, {
123
210
  selectedDate: selectedDate,
211
+ focusedDate: focusedDate,
124
212
  min: min,
125
213
  max: max,
126
214
  viewMonth: viewMonth,
127
215
  viewYear: viewYear,
128
216
  monthFormat: monthFormat$1,
217
+ disabledRules: disabledRules,
218
+ disabledReasonId: showPrompt ? disabledReasonId : undefined,
219
+ announceReasonOnFocus: !hasInteracted,
129
220
  onSelect: handleSelectedDateUpdate,
221
+ onDayFocus: handleDayFocus,
130
222
  onLabelClick: switchToYears,
131
223
  onViewDateUpdate: handleViewDateUpdate
132
224
  }), mode === 'month' && /*#__PURE__*/jsxRuntime.jsx(MonthCalendar.default, {
133
225
  selectedDate: selectedDate,
226
+ focusedDate: focusedDate,
134
227
  min: min,
135
228
  max: max,
136
229
  viewYear: viewYear,
@@ -142,6 +235,7 @@ const Calendar = ({
142
235
  onViewDateUpdate: handleViewDateUpdate
143
236
  }), mode === 'year' && /*#__PURE__*/jsxRuntime.jsx(YearCalendar.default, {
144
237
  selectedDate: selectedDate,
238
+ focusedDate: focusedDate,
145
239
  min: min,
146
240
  max: max,
147
241
  viewYear: viewYear,
@@ -150,6 +244,12 @@ const Calendar = ({
150
244
  }),
151
245
  onSelect: switchToMonths,
152
246
  onViewDateUpdate: handleViewDateUpdate
247
+ }), showPrompt && /*#__PURE__*/jsxRuntime.jsx(InlinePrompt.InlinePrompt, {
248
+ sentiment: promptSentiment,
249
+ width: "full",
250
+ id: disabledReasonId,
251
+ className: promptClassName,
252
+ children: promptText
153
253
  })]
154
254
  })
155
255
  );
@@ -1 +1 @@
1
- {"version":3,"file":"Calendar.js","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,aAAW,GAAGC,uBAAW,CAACC,IAAI;EAC9BC,WAAW;EACXC,QAAQ;AACRC,EAAAA;AAAQ,CACM,KAAI;AAClB,EAAA,MAAMC,YAAY,GAAGC,2BAAa,CAACZ,KAAK,CAAC;AACzC,EAAA,MAAMC,GAAG,GAAGW,2BAAa,CAACV,OAAO,CAAC;AAClC,EAAA,MAAMC,GAAG,GAAGS,2BAAa,CAACR,OAAO,CAAC;AAElCS,EAAAA,eAAS,CAAC,MAAK;IACb,IAAIF,YAAY,IAAI,CAACG,2BAAa,CAACH,YAAY,EAAEV,GAAG,EAAEE,GAAG,CAAC,EAAE;MAC1DM,QAAQ,CAACM,mCAAiB,CAACJ,YAAY,EAAEV,GAAG,EAAEE,GAAG,CAAC,CAAC;AACrD,IAAA;EACF,CAAC,EAAE,CAACQ,YAAY,EAAEK,OAAO,EAAE,EAAEf,GAAG,EAAEe,OAAO,EAAE,EAAEb,GAAG,EAAEa,OAAO,EAAE,EAAEP,QAAQ,CAAC,CAAC,CAAC;EAExE,MAAMQ,QAAQ,GAAGC,0BAAc,CAACP,YAAY,EAAEV,GAAG,EAAEE,GAAG,CAAC;AACvD,EAAA,MAAM,CAACgB,SAAS,EAAEC,YAAY,CAAC,GAAGC,cAAQ,CAACJ,QAAQ,CAACK,QAAQ,EAAE,CAAC;AAC/D,EAAA,MAAM,CAACC,QAAQ,EAAEC,WAAW,C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AA,gBAAgB,EAAE1B;OAAqB,CAE1C,EACAH,IAAI,KAAK,MAAM,iBACd0B,cAAA,CAACK,oBAAY,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.js","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 { 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 * 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 &&= moveToWithinRange(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","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAMA,QAAQ,GAAGA,CAAC;EAChBC,KAAK;EACLC,GAAG,EAAEC,OAAO,GAAG,IAAI;EACnBC,GAAG,EAAEC,OAAO,GAAG,IAAI;eACnBC,aAAW,GAAGC,uBAAW,CAACC,IAAI;EAC9BC,WAAW;EACXC,aAAa;EACbC,WAAW;AACXC,EAAAA;AAAQ,CACM,KAA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ACO,qBAAa,EAAA;AACZvF,QAAAA,YAAY,EAAEA,YAAa;AAC3BW,QAAAA,WAAW,EAAEA,WAAY;AACzBxB,QAAAA,GAAG,EAAEA,GAAI;AACTE,QAAAA,GAAG,EAAEA,GAAI;AACTsC,QAAAA,QAAQ,EAAEA,QAAS;QAAA,IACdjC,WAAW,IAAI,IAAI,IAAI;AAAEA,UAAAA;SAAa,CAAA;AAC3CyF,QAAAA,QAAQ,EAAE7C,YAAa;AACvB+C,QAAAA,YAAY,EAAE7C,aAAc;AAC5B8C,QAAAA,gBAAgB,EAAErD;OAAqB,CAE1C,EACAH,IAAI,KAAK,MAAM,iBACdkD,cAAA,CAACQ,oBAAY,EAAA;AACXxF,QAAAA,YAAY,EAAEA,YAAa;AAC3BW,QAAAA,WAAW,EAAEA,WAAY;AACzBxB,QAAAA,GAAG,EAAEA,GAAI;AACTE,QAAAA,GAAG,EAAEA,GAAI;AACTsC,QAAAA,QAAQ,EAAEA,QAAS;QAAA,IACdjC,WAAW,IAAI,IAAI,IAAI;AAAEA,UAAAA;SAAa,CAAA;AAC3CyF,QAAAA,QAAQ,EAAE5C,cAAe;AACzB+C,QAAAA,gBAAgB,EAAErD;AAAqB,OAAA,CAE1C,EACAuC,UAAU,iBACTQ,cAAA,CAACS,yBAAY,EAAA;AACXC,QAAAA,SAAS,EAAEf,eAAgB;AAC3BgB,QAAAA,KAAK,EAAC,MAAM;AACZC,QAAAA,EAAE,EAAE1F,gBAAiB;AACrB2F,QAAAA,SAAS,EAAEjB,eAAgB;AAAAG,QAAAA,QAAA,EAE1BN;AAAU,OACC,CACf;KACE;AAAC;AAEV;;;;"}
@@ -26,8 +26,20 @@ var messages = reactIntl.defineMessages({
26
26
  selected: {
27
27
  id: "neptune.DateLookup.selected"
28
28
  },
29
+ notAvailable: {
30
+ id: "neptune.DateLookup.notAvailable"
31
+ },
29
32
  goTo20YearView: {
30
33
  id: "neptune.DateLookup.goTo20YearView"
34
+ },
35
+ outOfRangeBetween: {
36
+ id: "neptune.DateLookup.outOfRangeBetween"
37
+ },
38
+ outOfRangeAfter: {
39
+ id: "neptune.DateLookup.outOfRangeAfter"
40
+ },
41
+ outOfRangeBefore: {
42
+ id: "neptune.DateLookup.outOfRangeBefore"
31
43
  }
32
44
  });
33
45
 
@@ -1 +1 @@
1
- {"version":3,"file":"Calendar.messages.js","sources":["../../src/Calendar/Calendar.messages.ts"],"sourcesContent":["import { defineMessages } from 'react-intl';\n\nexport default defineMessages({\n next: {\n id: 'neptune.DateLookup.next',\n defaultMessage: 'next',\n description: 'Description of next button',\n },\n previous: {\n id: 'neptune.DateLookup.previous',\n defaultMessage: 'previous',\n description: 'Description of previous button',\n },\n day: {\n id: 'neptune.DateLookup.day',\n defaultMessage: 'day',\n description: 'Description of next/previous/selected day button',\n },\n month: {\n id: 'neptune.DateLookup.month',\n defaultMessage: 'month',\n description: 'Description of next/previous/selected month button',\n },\n year: {\n id: 'neptune.DateLookup.year',\n defaultMessage: 'year',\n description: 'Description of next/previous/selected year button',\n },\n twentyYears: {\n id: 'neptune.DateLookup.twentyYears',\n defaultMessage: '20 years',\n description: 'Description of next/previous 20 years button',\n },\n selected: {\n id: 'neptune.DateLookup.selected',\n defaultMessage: 'selected',\n description: 'Description of the selected day/month/year',\n },\n goTo20YearView: {\n id: 'neptune.DateLookup.goTo20YearView',\n defaultMessage: 'Go to 20 year view',\n description: 'Description of the button to go to 20 year view',\n },\n});\n"],"names":["defineMessages","next","id","previous","day","month","year","twentyYears","selected","goTo20YearView"],"mappings":";;;;;;AAEA,eAAeA,wBAAc,CAAC;AAC5BC,EAAAA,IAAI,EAAE;IACJC,EAAE,EAAA;GAGH;AACDC,EAAAA,QAAQ,EAAE;IACRD,EAAE,EAAA;GAGH;AACDE,EAAAA,GAAG,EAAE;IACHF,EAAE,EAAA;GAGH;AACDG,EAAAA,KAAK,EAAE;IACLH,EAAE,EAAA;GAGH;AACDI,EAAAA,IAAI,EAAE;IACJJ,EAAE,EAAA;GAGH;AACDK,EAAAA,WAAW,EAAE;IACXL,EAAE,EAAA;GAGH;AACDM,EAAAA,QAAQ,EAAE;IACRN,EAAE,EAAA;GAGH;AACDO,EAAAA,cAAc,EAAE;IACdP,EAAE,EAAA;AAGH;AACF,CAAA,CAAC;;;;"}
1
+ {"version":3,"file":"Calendar.messages.js","sources":["../../src/Calendar/Calendar.messages.ts"],"sourcesContent":["import { defineMessages } from 'react-intl';\n\nexport default defineMessages({\n next: {\n id: 'neptune.DateLookup.next',\n defaultMessage: 'next',\n description: 'Description of next button',\n },\n previous: {\n id: 'neptune.DateLookup.previous',\n defaultMessage: 'previous',\n description: 'Description of previous button',\n },\n day: {\n id: 'neptune.DateLookup.day',\n defaultMessage: 'day',\n description: 'Description of next/previous/selected day button',\n },\n month: {\n id: 'neptune.DateLookup.month',\n defaultMessage: 'month',\n description: 'Description of next/previous/selected month button',\n },\n year: {\n id: 'neptune.DateLookup.year',\n defaultMessage: 'year',\n description: 'Description of next/previous/selected year button',\n },\n twentyYears: {\n id: 'neptune.DateLookup.twentyYears',\n defaultMessage: '20 years',\n description: 'Description of next/previous 20 years button',\n },\n selected: {\n id: 'neptune.DateLookup.selected',\n defaultMessage: 'selected',\n description: 'Description of the selected day/month/year',\n },\n notAvailable: {\n id: 'neptune.DateLookup.notAvailable',\n defaultMessage: 'not available',\n description: 'Announces that a date is disabled/unavailable',\n },\n goTo20YearView: {\n id: 'neptune.DateLookup.goTo20YearView',\n defaultMessage: 'Go to 20 year view',\n description: 'Description of the button to go to 20 year view',\n },\n outOfRangeBetween: {\n id: 'neptune.DateLookup.outOfRangeBetween',\n defaultMessage: 'Please select a date between {min} and {max}.',\n description:\n 'Inline prompt when a date outside min/max boundaries is focused and both min and max are set',\n },\n outOfRangeAfter: {\n id: 'neptune.DateLookup.outOfRangeAfter',\n defaultMessage: 'Please enter {min} or a later date.',\n description: 'Inline prompt when a date before min is focused and only min is set',\n },\n outOfRangeBefore: {\n id: 'neptune.DateLookup.outOfRangeBefore',\n defaultMessage: 'Please enter {max} or an earlier date.',\n description: 'Inline prompt when a date after max is focused and only max is set',\n },\n});\n"],"names":["defineMessages","next","id","previous","day","month","year","twentyYears","selected","notAvailable","goTo20YearView","outOfRangeBetween","outOfRangeAfter","outOfRangeBefore"],"mappings":";;;;;;AAEA,eAAeA,wBAAc,CAAC;AAC5BC,EAAAA,IAAI,EAAE;IACJC,EAAE,EAAA;GAGH;AACDC,EAAAA,QAAQ,EAAE;IACRD,EAAE,EAAA;GAGH;AACDE,EAAAA,GAAG,EAAE;IACHF,EAAE,EAAA;GAGH;AACDG,EAAAA,KAAK,EAAE;IACLH,EAAE,EAAA;GAGH;AACDI,EAAAA,IAAI,EAAE;IACJJ,EAAE,EAAA;GAGH;AACDK,EAAAA,WAAW,EAAE;IACXL,EAAE,EAAA;GAGH;AACDM,EAAAA,QAAQ,EAAE;IACRN,EAAE,EAAA;GAGH;AACDO,EAAAA,YAAY,EAAE;IACZP,EAAE,EAAA;GAGH;AACDQ,EAAAA,cAAc,EAAE;IACdR,EAAE,EAAA;GAGH;AACDS,EAAAA,iBAAiB,EAAE;IACjBT,EAAE,EAAA;GAIH;AACDU,EAAAA,eAAe,EAAE;IACfV,EAAE,EAAA;GAGH;AACDW,EAAAA,gBAAgB,EAAE;IAChBX,EAAE,EAAA;AAGH;AACF,CAAA,CAAC;;;;"}
@@ -22,8 +22,20 @@ var messages = defineMessages({
22
22
  selected: {
23
23
  id: "neptune.DateLookup.selected"
24
24
  },
25
+ notAvailable: {
26
+ id: "neptune.DateLookup.notAvailable"
27
+ },
25
28
  goTo20YearView: {
26
29
  id: "neptune.DateLookup.goTo20YearView"
30
+ },
31
+ outOfRangeBetween: {
32
+ id: "neptune.DateLookup.outOfRangeBetween"
33
+ },
34
+ outOfRangeAfter: {
35
+ id: "neptune.DateLookup.outOfRangeAfter"
36
+ },
37
+ outOfRangeBefore: {
38
+ id: "neptune.DateLookup.outOfRangeBefore"
27
39
  }
28
40
  });
29
41
 
@@ -1 +1 @@
1
- {"version":3,"file":"Calendar.messages.mjs","sources":["../../src/Calendar/Calendar.messages.ts"],"sourcesContent":["import { defineMessages } from 'react-intl';\n\nexport default defineMessages({\n next: {\n id: 'neptune.DateLookup.next',\n defaultMessage: 'next',\n description: 'Description of next button',\n },\n previous: {\n id: 'neptune.DateLookup.previous',\n defaultMessage: 'previous',\n description: 'Description of previous button',\n },\n day: {\n id: 'neptune.DateLookup.day',\n defaultMessage: 'day',\n description: 'Description of next/previous/selected day button',\n },\n month: {\n id: 'neptune.DateLookup.month',\n defaultMessage: 'month',\n description: 'Description of next/previous/selected month button',\n },\n year: {\n id: 'neptune.DateLookup.year',\n defaultMessage: 'year',\n description: 'Description of next/previous/selected year button',\n },\n twentyYears: {\n id: 'neptune.DateLookup.twentyYears',\n defaultMessage: '20 years',\n description: 'Description of next/previous 20 years button',\n },\n selected: {\n id: 'neptune.DateLookup.selected',\n defaultMessage: 'selected',\n description: 'Description of the selected day/month/year',\n },\n goTo20YearView: {\n id: 'neptune.DateLookup.goTo20YearView',\n defaultMessage: 'Go to 20 year view',\n description: 'Description of the button to go to 20 year view',\n },\n});\n"],"names":["defineMessages","next","id","previous","day","month","year","twentyYears","selected","goTo20YearView"],"mappings":";;AAEA,eAAeA,cAAc,CAAC;AAC5BC,EAAAA,IAAI,EAAE;IACJC,EAAE,EAAA;GAGH;AACDC,EAAAA,QAAQ,EAAE;IACRD,EAAE,EAAA;GAGH;AACDE,EAAAA,GAAG,EAAE;IACHF,EAAE,EAAA;GAGH;AACDG,EAAAA,KAAK,EAAE;IACLH,EAAE,EAAA;GAGH;AACDI,EAAAA,IAAI,EAAE;IACJJ,EAAE,EAAA;GAGH;AACDK,EAAAA,WAAW,EAAE;IACXL,EAAE,EAAA;GAGH;AACDM,EAAAA,QAAQ,EAAE;IACRN,EAAE,EAAA;GAGH;AACDO,EAAAA,cAAc,EAAE;IACdP,EAAE,EAAA;AAGH;AACF,CAAA,CAAC;;;;"}
1
+ {"version":3,"file":"Calendar.messages.mjs","sources":["../../src/Calendar/Calendar.messages.ts"],"sourcesContent":["import { defineMessages } from 'react-intl';\n\nexport default defineMessages({\n next: {\n id: 'neptune.DateLookup.next',\n defaultMessage: 'next',\n description: 'Description of next button',\n },\n previous: {\n id: 'neptune.DateLookup.previous',\n defaultMessage: 'previous',\n description: 'Description of previous button',\n },\n day: {\n id: 'neptune.DateLookup.day',\n defaultMessage: 'day',\n description: 'Description of next/previous/selected day button',\n },\n month: {\n id: 'neptune.DateLookup.month',\n defaultMessage: 'month',\n description: 'Description of next/previous/selected month button',\n },\n year: {\n id: 'neptune.DateLookup.year',\n defaultMessage: 'year',\n description: 'Description of next/previous/selected year button',\n },\n twentyYears: {\n id: 'neptune.DateLookup.twentyYears',\n defaultMessage: '20 years',\n description: 'Description of next/previous 20 years button',\n },\n selected: {\n id: 'neptune.DateLookup.selected',\n defaultMessage: 'selected',\n description: 'Description of the selected day/month/year',\n },\n notAvailable: {\n id: 'neptune.DateLookup.notAvailable',\n defaultMessage: 'not available',\n description: 'Announces that a date is disabled/unavailable',\n },\n goTo20YearView: {\n id: 'neptune.DateLookup.goTo20YearView',\n defaultMessage: 'Go to 20 year view',\n description: 'Description of the button to go to 20 year view',\n },\n outOfRangeBetween: {\n id: 'neptune.DateLookup.outOfRangeBetween',\n defaultMessage: 'Please select a date between {min} and {max}.',\n description:\n 'Inline prompt when a date outside min/max boundaries is focused and both min and max are set',\n },\n outOfRangeAfter: {\n id: 'neptune.DateLookup.outOfRangeAfter',\n defaultMessage: 'Please enter {min} or a later date.',\n description: 'Inline prompt when a date before min is focused and only min is set',\n },\n outOfRangeBefore: {\n id: 'neptune.DateLookup.outOfRangeBefore',\n defaultMessage: 'Please enter {max} or an earlier date.',\n description: 'Inline prompt when a date after max is focused and only max is set',\n },\n});\n"],"names":["defineMessages","next","id","previous","day","month","year","twentyYears","selected","notAvailable","goTo20YearView","outOfRangeBetween","outOfRangeAfter","outOfRangeBefore"],"mappings":";;AAEA,eAAeA,cAAc,CAAC;AAC5BC,EAAAA,IAAI,EAAE;IACJC,EAAE,EAAA;GAGH;AACDC,EAAAA,QAAQ,EAAE;IACRD,EAAE,EAAA;GAGH;AACDE,EAAAA,GAAG,EAAE;IACHF,EAAE,EAAA;GAGH;AACDG,EAAAA,KAAK,EAAE;IACLH,EAAE,EAAA;GAGH;AACDI,EAAAA,IAAI,EAAE;IACJJ,EAAE,EAAA;GAGH;AACDK,EAAAA,WAAW,EAAE;IACXL,EAAE,EAAA;GAGH;AACDM,EAAAA,QAAQ,EAAE;IACRN,EAAE,EAAA;GAGH;AACDO,EAAAA,YAAY,EAAE;IACZP,EAAE,EAAA;GAGH;AACDQ,EAAAA,cAAc,EAAE;IACdR,EAAE,EAAA;GAGH;AACDS,EAAAA,iBAAiB,EAAE;IACjBT,EAAE,EAAA;GAIH;AACDU,EAAAA,eAAe,EAAE;IACfV,EAAE,EAAA;GAGH;AACDW,EAAAA,gBAAgB,EAAE;IAChBX,EAAE,EAAA;AAGH;AACF,CAAA,CAAC;;;;"}