@transferwise/components 0.0.0-experimental-749d29d → 0.0.0-experimental-a26af76

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 (205) hide show
  1. package/build/dateLookup/DateLookup.js +165 -26
  2. package/build/dateLookup/DateLookup.js.map +1 -1
  3. package/build/{calendarInput/CalendarInput.messages.js → dateLookup/DateLookup.messages.js} +1 -1
  4. package/build/dateLookup/DateLookup.messages.js.map +1 -0
  5. package/build/{calendarInput/CalendarInput.messages.mjs → dateLookup/DateLookup.messages.mjs} +1 -1
  6. package/build/dateLookup/DateLookup.messages.mjs.map +1 -0
  7. package/build/dateLookup/DateLookup.mjs +166 -27
  8. package/build/dateLookup/DateLookup.mjs.map +1 -1
  9. package/build/{calendarInput → dateLookup}/dateHeader/DateHeader.js +4 -4
  10. package/build/dateLookup/dateHeader/DateHeader.js.map +1 -0
  11. package/build/{calendarInput → dateLookup}/dateHeader/DateHeader.mjs +1 -1
  12. package/build/dateLookup/dateHeader/DateHeader.mjs.map +1 -0
  13. package/build/{calendarInput → dateLookup}/dayCalendar/DayCalendar.js +2 -2
  14. package/build/dateLookup/dayCalendar/DayCalendar.js.map +1 -0
  15. package/build/{calendarInput → dateLookup}/dayCalendar/DayCalendar.mjs +1 -1
  16. package/build/dateLookup/dayCalendar/DayCalendar.mjs.map +1 -0
  17. package/build/dateLookup/dayCalendar/table/DayCalendarTable.js.map +1 -0
  18. package/build/dateLookup/dayCalendar/table/DayCalendarTable.mjs.map +1 -0
  19. package/build/dateLookup/getFocusableTime/getFocusableTime.js.map +1 -0
  20. package/build/dateLookup/getFocusableTime/getFocusableTime.mjs.map +1 -0
  21. package/build/dateLookup/getStartOfDay/getStartOfDay.js.map +1 -0
  22. package/build/dateLookup/getStartOfDay/getStartOfDay.mjs.map +1 -0
  23. package/build/{calendarInput → dateLookup}/monthCalendar/MonthCalendar.js +2 -2
  24. package/build/dateLookup/monthCalendar/MonthCalendar.js.map +1 -0
  25. package/build/{calendarInput → dateLookup}/monthCalendar/MonthCalendar.mjs +1 -1
  26. package/build/dateLookup/monthCalendar/MonthCalendar.mjs.map +1 -0
  27. package/build/dateLookup/monthCalendar/table/MonthCalendarTable.js.map +1 -0
  28. package/build/dateLookup/monthCalendar/table/MonthCalendarTable.mjs.map +1 -0
  29. package/build/{calendarInput → dateLookup}/tableLink/TableLink.js +2 -2
  30. package/build/dateLookup/tableLink/TableLink.js.map +1 -0
  31. package/build/{calendarInput → dateLookup}/tableLink/TableLink.mjs +1 -1
  32. package/build/dateLookup/tableLink/TableLink.mjs.map +1 -0
  33. package/build/{calendarInput → dateLookup}/yearCalendar/YearCalendar.js +2 -2
  34. package/build/dateLookup/yearCalendar/YearCalendar.js.map +1 -0
  35. package/build/{calendarInput → dateLookup}/yearCalendar/YearCalendar.mjs +1 -1
  36. package/build/dateLookup/yearCalendar/YearCalendar.mjs.map +1 -0
  37. package/build/dateLookup/yearCalendar/table/YearCalendarTable.js.map +1 -0
  38. package/build/dateLookup/yearCalendar/table/YearCalendarTable.mjs.map +1 -0
  39. package/build/index.js +0 -2
  40. package/build/index.js.map +1 -1
  41. package/build/index.mjs +0 -1
  42. package/build/index.mjs.map +1 -1
  43. package/build/main.css +603 -649
  44. package/build/sentimentSurface/SentimentSurface.js +9 -2
  45. package/build/sentimentSurface/SentimentSurface.js.map +1 -1
  46. package/build/sentimentSurface/SentimentSurface.mjs +9 -2
  47. package/build/sentimentSurface/SentimentSurface.mjs.map +1 -1
  48. package/build/styles/css/neptune.css +11 -11
  49. package/build/styles/dateLookup/DateLookup.css +90 -0
  50. package/build/styles/less/legacy-variables.less +1 -1
  51. package/build/styles/less/neptune-tokens.less +2 -2
  52. package/build/styles/main.css +603 -649
  53. package/build/styles/props/custom-media.css +1 -1
  54. package/build/styles/props/neptune-tokens.css +1 -1
  55. package/build/styles/sentimentSurface/SentimentSurface.css +325 -337
  56. package/build/styles/styles/less/neptune.css +11 -11
  57. package/build/types/dateLookup/DateLookup.d.ts +25 -2
  58. package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
  59. package/build/types/{calendarInput/CalendarInput.messages.d.ts → dateLookup/DateLookup.messages.d.ts} +1 -1
  60. package/build/types/dateLookup/DateLookup.messages.d.ts.map +1 -0
  61. package/build/types/dateLookup/dateHeader/DateHeader.d.ts.map +1 -0
  62. package/build/types/dateLookup/dateHeader/index.d.ts.map +1 -0
  63. package/build/types/dateLookup/dayCalendar/DayCalendar.d.ts.map +1 -0
  64. package/build/types/dateLookup/dayCalendar/index.d.ts.map +1 -0
  65. package/build/types/dateLookup/dayCalendar/table/DayCalendarTable.d.ts.map +1 -0
  66. package/build/types/dateLookup/dayCalendar/table/index.d.ts.map +1 -0
  67. package/build/types/dateLookup/getFocusableTime/getFocusableTime.d.ts.map +1 -0
  68. package/build/types/dateLookup/getStartOfDay/getStartOfDay.d.ts.map +1 -0
  69. package/build/types/dateLookup/getStartOfDay/index.d.ts.map +1 -0
  70. package/build/types/dateLookup/monthCalendar/MonthCalendar.d.ts.map +1 -0
  71. package/build/types/dateLookup/monthCalendar/index.d.ts.map +1 -0
  72. package/build/types/dateLookup/monthCalendar/table/MonthCalendarTable.d.ts.map +1 -0
  73. package/build/types/dateLookup/monthCalendar/table/index.d.ts.map +1 -0
  74. package/build/types/dateLookup/tableLink/TableLink.d.ts.map +1 -0
  75. package/build/types/dateLookup/tableLink/index.d.ts.map +1 -0
  76. package/build/types/dateLookup/yearCalendar/YearCalendar.d.ts.map +1 -0
  77. package/build/types/dateLookup/yearCalendar/index.d.ts.map +1 -0
  78. package/build/types/dateLookup/yearCalendar/table/YearCalendarTable.d.ts.map +1 -0
  79. package/build/types/dateLookup/yearCalendar/table/index.d.ts.map +1 -0
  80. package/build/types/index.d.ts +0 -2
  81. package/build/types/index.d.ts.map +1 -1
  82. package/build/types/sentimentSurface/SentimentSurface.d.ts.map +1 -1
  83. package/package.json +2 -2
  84. package/src/criticalBanner/CriticalCommsBanner.test.tsx +1 -1
  85. package/src/dateLookup/DateLookup.css +90 -0
  86. package/src/dateLookup/DateLookup.less +91 -0
  87. package/src/dateLookup/DateLookup.tsx +157 -30
  88. package/src/{calendarInput → dateLookup}/dateHeader/DateHeader.tsx +1 -1
  89. package/src/{calendarInput → dateLookup}/dayCalendar/DayCalendar.tsx +1 -1
  90. package/src/{calendarInput → dateLookup}/monthCalendar/MonthCalendar.tsx +1 -1
  91. package/src/{calendarInput → dateLookup}/tableLink/TableLink.tsx +1 -1
  92. package/src/{calendarInput → dateLookup}/yearCalendar/YearCalendar.tsx +1 -1
  93. package/src/index.ts +0 -2
  94. package/src/main.css +603 -649
  95. package/src/main.less +0 -1
  96. package/src/sentimentSurface/SentimentSurface.css +325 -337
  97. package/src/sentimentSurface/SentimentSurface.docs.mdx +2 -0
  98. package/src/sentimentSurface/SentimentSurface.less +2 -322
  99. package/src/sentimentSurface/SentimentSurface.story.tsx +4 -0
  100. package/src/sentimentSurface/SentimentSurface.test.story.tsx +1 -5
  101. package/src/sentimentSurface/SentimentSurface.test.tsx +84 -3
  102. package/src/sentimentSurface/SentimentSurface.tsx +10 -2
  103. package/src/styles/less/neptune.css +11 -11
  104. package/build/calendarInput/CalendarInput.js +0 -154
  105. package/build/calendarInput/CalendarInput.js.map +0 -1
  106. package/build/calendarInput/CalendarInput.messages.js.map +0 -1
  107. package/build/calendarInput/CalendarInput.messages.mjs.map +0 -1
  108. package/build/calendarInput/CalendarInput.mjs +0 -150
  109. package/build/calendarInput/CalendarInput.mjs.map +0 -1
  110. package/build/calendarInput/dateHeader/DateHeader.js.map +0 -1
  111. package/build/calendarInput/dateHeader/DateHeader.mjs.map +0 -1
  112. package/build/calendarInput/dayCalendar/DayCalendar.js.map +0 -1
  113. package/build/calendarInput/dayCalendar/DayCalendar.mjs.map +0 -1
  114. package/build/calendarInput/dayCalendar/table/DayCalendarTable.js.map +0 -1
  115. package/build/calendarInput/dayCalendar/table/DayCalendarTable.mjs.map +0 -1
  116. package/build/calendarInput/getFocusableTime/getFocusableTime.js.map +0 -1
  117. package/build/calendarInput/getFocusableTime/getFocusableTime.mjs.map +0 -1
  118. package/build/calendarInput/getStartOfDay/getStartOfDay.js.map +0 -1
  119. package/build/calendarInput/getStartOfDay/getStartOfDay.mjs.map +0 -1
  120. package/build/calendarInput/monthCalendar/MonthCalendar.js.map +0 -1
  121. package/build/calendarInput/monthCalendar/MonthCalendar.mjs.map +0 -1
  122. package/build/calendarInput/monthCalendar/table/MonthCalendarTable.js.map +0 -1
  123. package/build/calendarInput/monthCalendar/table/MonthCalendarTable.mjs.map +0 -1
  124. package/build/calendarInput/tableLink/TableLink.js.map +0 -1
  125. package/build/calendarInput/tableLink/TableLink.mjs.map +0 -1
  126. package/build/calendarInput/yearCalendar/YearCalendar.js.map +0 -1
  127. package/build/calendarInput/yearCalendar/YearCalendar.mjs.map +0 -1
  128. package/build/calendarInput/yearCalendar/table/YearCalendarTable.js.map +0 -1
  129. package/build/calendarInput/yearCalendar/table/YearCalendarTable.mjs.map +0 -1
  130. package/build/styles/calendarInput/CalendarInput.css +0 -83
  131. package/build/types/calendarInput/CalendarInput.d.ts +0 -12
  132. package/build/types/calendarInput/CalendarInput.d.ts.map +0 -1
  133. package/build/types/calendarInput/CalendarInput.messages.d.ts.map +0 -1
  134. package/build/types/calendarInput/dateHeader/DateHeader.d.ts.map +0 -1
  135. package/build/types/calendarInput/dateHeader/index.d.ts.map +0 -1
  136. package/build/types/calendarInput/dayCalendar/DayCalendar.d.ts.map +0 -1
  137. package/build/types/calendarInput/dayCalendar/index.d.ts.map +0 -1
  138. package/build/types/calendarInput/dayCalendar/table/DayCalendarTable.d.ts.map +0 -1
  139. package/build/types/calendarInput/dayCalendar/table/index.d.ts.map +0 -1
  140. package/build/types/calendarInput/getFocusableTime/getFocusableTime.d.ts.map +0 -1
  141. package/build/types/calendarInput/getStartOfDay/getStartOfDay.d.ts.map +0 -1
  142. package/build/types/calendarInput/getStartOfDay/index.d.ts.map +0 -1
  143. package/build/types/calendarInput/index.d.ts +0 -3
  144. package/build/types/calendarInput/index.d.ts.map +0 -1
  145. package/build/types/calendarInput/monthCalendar/MonthCalendar.d.ts.map +0 -1
  146. package/build/types/calendarInput/monthCalendar/index.d.ts.map +0 -1
  147. package/build/types/calendarInput/monthCalendar/table/MonthCalendarTable.d.ts.map +0 -1
  148. package/build/types/calendarInput/monthCalendar/table/index.d.ts.map +0 -1
  149. package/build/types/calendarInput/tableLink/TableLink.d.ts.map +0 -1
  150. package/build/types/calendarInput/tableLink/index.d.ts.map +0 -1
  151. package/build/types/calendarInput/yearCalendar/YearCalendar.d.ts.map +0 -1
  152. package/build/types/calendarInput/yearCalendar/index.d.ts.map +0 -1
  153. package/build/types/calendarInput/yearCalendar/table/YearCalendarTable.d.ts.map +0 -1
  154. package/build/types/calendarInput/yearCalendar/table/index.d.ts.map +0 -1
  155. package/src/calendarInput/CalendarInput.css +0 -83
  156. package/src/calendarInput/CalendarInput.less +0 -79
  157. package/src/calendarInput/CalendarInput.story.tsx +0 -64
  158. package/src/calendarInput/CalendarInput.tsx +0 -163
  159. package/src/calendarInput/index.ts +0 -2
  160. /package/build/{calendarInput → dateLookup}/dayCalendar/table/DayCalendarTable.js +0 -0
  161. /package/build/{calendarInput → dateLookup}/dayCalendar/table/DayCalendarTable.mjs +0 -0
  162. /package/build/{calendarInput → dateLookup}/getFocusableTime/getFocusableTime.js +0 -0
  163. /package/build/{calendarInput → dateLookup}/getFocusableTime/getFocusableTime.mjs +0 -0
  164. /package/build/{calendarInput → dateLookup}/getStartOfDay/getStartOfDay.js +0 -0
  165. /package/build/{calendarInput → dateLookup}/getStartOfDay/getStartOfDay.mjs +0 -0
  166. /package/build/{calendarInput → dateLookup}/monthCalendar/table/MonthCalendarTable.js +0 -0
  167. /package/build/{calendarInput → dateLookup}/monthCalendar/table/MonthCalendarTable.mjs +0 -0
  168. /package/build/{calendarInput → dateLookup}/yearCalendar/table/YearCalendarTable.js +0 -0
  169. /package/build/{calendarInput → dateLookup}/yearCalendar/table/YearCalendarTable.mjs +0 -0
  170. /package/build/types/{calendarInput → dateLookup}/dateHeader/DateHeader.d.ts +0 -0
  171. /package/build/types/{calendarInput → dateLookup}/dateHeader/index.d.ts +0 -0
  172. /package/build/types/{calendarInput → dateLookup}/dayCalendar/DayCalendar.d.ts +0 -0
  173. /package/build/types/{calendarInput → dateLookup}/dayCalendar/index.d.ts +0 -0
  174. /package/build/types/{calendarInput → dateLookup}/dayCalendar/table/DayCalendarTable.d.ts +0 -0
  175. /package/build/types/{calendarInput → dateLookup}/dayCalendar/table/index.d.ts +0 -0
  176. /package/build/types/{calendarInput → dateLookup}/getFocusableTime/getFocusableTime.d.ts +0 -0
  177. /package/build/types/{calendarInput → dateLookup}/getStartOfDay/getStartOfDay.d.ts +0 -0
  178. /package/build/types/{calendarInput → dateLookup}/getStartOfDay/index.d.ts +0 -0
  179. /package/build/types/{calendarInput → dateLookup}/monthCalendar/MonthCalendar.d.ts +0 -0
  180. /package/build/types/{calendarInput → dateLookup}/monthCalendar/index.d.ts +0 -0
  181. /package/build/types/{calendarInput → dateLookup}/monthCalendar/table/MonthCalendarTable.d.ts +0 -0
  182. /package/build/types/{calendarInput → dateLookup}/monthCalendar/table/index.d.ts +0 -0
  183. /package/build/types/{calendarInput → dateLookup}/tableLink/TableLink.d.ts +0 -0
  184. /package/build/types/{calendarInput → dateLookup}/tableLink/index.d.ts +0 -0
  185. /package/build/types/{calendarInput → dateLookup}/yearCalendar/YearCalendar.d.ts +0 -0
  186. /package/build/types/{calendarInput → dateLookup}/yearCalendar/index.d.ts +0 -0
  187. /package/build/types/{calendarInput → dateLookup}/yearCalendar/table/YearCalendarTable.d.ts +0 -0
  188. /package/build/types/{calendarInput → dateLookup}/yearCalendar/table/index.d.ts +0 -0
  189. /package/src/{calendarInput/CalendarInput.messages.ts → dateLookup/DateLookup.messages.ts} +0 -0
  190. /package/src/{calendarInput → dateLookup}/dateHeader/index.ts +0 -0
  191. /package/src/{calendarInput → dateLookup}/dayCalendar/index.ts +0 -0
  192. /package/src/{calendarInput → dateLookup}/dayCalendar/table/DayCalendarTable.tsx +0 -0
  193. /package/src/{calendarInput → dateLookup}/dayCalendar/table/index.ts +0 -0
  194. /package/src/{calendarInput → dateLookup}/getFocusableTime/getFocusable.test.ts +0 -0
  195. /package/src/{calendarInput → dateLookup}/getFocusableTime/getFocusableTime.tsx +0 -0
  196. /package/src/{calendarInput → dateLookup}/getStartOfDay/getStartOfDay.test.js +0 -0
  197. /package/src/{calendarInput → dateLookup}/getStartOfDay/getStartOfDay.tsx +0 -0
  198. /package/src/{calendarInput → dateLookup}/getStartOfDay/index.ts +0 -0
  199. /package/src/{calendarInput → dateLookup}/monthCalendar/index.ts +0 -0
  200. /package/src/{calendarInput → dateLookup}/monthCalendar/table/MonthCalendarTable.tsx +0 -0
  201. /package/src/{calendarInput → dateLookup}/monthCalendar/table/index.ts +0 -0
  202. /package/src/{calendarInput → dateLookup}/tableLink/index.ts +0 -0
  203. /package/src/{calendarInput → dateLookup}/yearCalendar/index.ts +0 -0
  204. /package/src/{calendarInput → dateLookup}/yearCalendar/table/YearCalendarTable.tsx +0 -0
  205. /package/src/{calendarInput → dateLookup}/yearCalendar/table/index.ts +0 -0
@@ -4,10 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var clsx = require('clsx');
6
6
  var React = require('react');
7
- var CalendarInput = require('../calendarInput/CalendarInput.js');
7
+ var neptuneTokens = require('@transferwise/neptune-tokens');
8
8
  require('../common/theme.js');
9
9
  require('../common/direction.js');
10
- require('@transferwise/neptune-tokens');
11
10
  require('../common/propsValues/control.js');
12
11
  var size = require('../common/propsValues/size.js');
13
12
  require('../common/propsValues/typography.js');
@@ -29,10 +28,17 @@ require('@transferwise/icons');
29
28
  require('react-intl');
30
29
  require('../common/closeButton/CloseButton.messages.js');
31
30
  var jsxRuntime = require('react/jsx-runtime');
31
+ var moveToWithinRange = require('../common/dateUtils/moveToWithinRange/moveToWithinRange.js');
32
+ var isWithinRange = require('../common/dateUtils/isWithinRange/isWithinRange.js');
33
+ var getDateView = require('../common/dateUtils/getDateView/getDateView.js');
32
34
  var ResponsivePanel = require('../common/responsivePanel/ResponsivePanel.js');
33
35
  var contexts = require('../inputs/contexts.js');
34
36
  var OverlayIdProvider = require('../provider/overlay/OverlayIdProvider.js');
35
37
  var DateTrigger = require('./dateTrigger/DateTrigger.js');
38
+ var DayCalendar = require('./dayCalendar/DayCalendar.js');
39
+ var getStartOfDay = require('./getStartOfDay/getStartOfDay.js');
40
+ var MonthCalendar = require('./monthCalendar/MonthCalendar.js');
41
+ var YearCalendar = require('./yearCalendar/YearCalendar.js');
36
42
 
37
43
  class DateLookup extends React.PureComponent {
38
44
  static defaultProps = {
@@ -47,19 +53,61 @@ class DateLookup extends React.PureComponent {
47
53
  clearable: false
48
54
  };
49
55
  element = /*#__PURE__*/React.createRef();
56
+ dropdown = /*#__PURE__*/React.createRef();
50
57
  constructor(props) {
51
58
  super(props);
59
+ const dateView = getDateView.returnDateView(props.value, props.min, props.max);
52
60
  this.state = {
61
+ selectedDate: getStartOfDay.getStartOfDay(props.value),
53
62
  originalDate: null,
54
- open: false
63
+ min: getStartOfDay.getStartOfDay(props.min),
64
+ max: getStartOfDay.getStartOfDay(props.max),
65
+ viewMonth: dateView.getMonth(),
66
+ viewYear: dateView.getFullYear(),
67
+ open: false,
68
+ mode: 'day',
69
+ isMobile: false
55
70
  };
56
71
  }
72
+ static getDerivedStateFromProps(props, state) {
73
+ const propsSelected = getStartOfDay.getStartOfDay(props.value);
74
+ const propsMin = getStartOfDay.getStartOfDay(props.min);
75
+ const propsMax = getStartOfDay.getStartOfDay(props.max);
76
+ const hasSelectedChanged = state.selectedDate?.getTime() !== propsSelected?.getTime();
77
+ const hasMinChanged = state.min?.getTime() !== propsMin?.getTime();
78
+ const hasMaxChanged = state.max?.getTime() !== propsMax?.getTime();
79
+ if (hasSelectedChanged || hasMinChanged || hasMaxChanged) {
80
+ const selectedDate = hasSelectedChanged ? propsSelected : state.selectedDate;
81
+ const min = hasMinChanged ? propsMin : state.min;
82
+ const max = hasMaxChanged ? propsMax : state.max;
83
+ if (selectedDate && !isWithinRange.isWithinRange(selectedDate, min, max)) {
84
+ props.onChange(moveToWithinRange.moveToWithinRange(selectedDate, min, max));
85
+ return null;
86
+ }
87
+ const viewDateThatIsWithinRange = getDateView.returnDateView(selectedDate, min, max);
88
+ const viewMonth = viewDateThatIsWithinRange.getMonth();
89
+ const viewYear = viewDateThatIsWithinRange.getFullYear();
90
+ return {
91
+ selectedDate,
92
+ min,
93
+ max,
94
+ viewMonth,
95
+ viewYear
96
+ };
97
+ }
98
+ return null;
99
+ }
57
100
  componentDidUpdate(previousProps) {
58
101
  if (this.props.value?.getTime() !== previousProps.value?.getTime() && this.state.open) {
59
102
  this.focusOn('.active');
60
103
  }
104
+ const mediaQuery = window.matchMedia(`(max-width: ${neptuneTokens.Breakpoint.SMALL}px)`);
105
+ this.setState({
106
+ isMobile: mediaQuery.matches
107
+ });
61
108
  }
62
109
  componentWillUnmount() {
110
+ // Prevents memory leak by cleaning state.
63
111
  this.setState = () => {};
64
112
  }
65
113
  open = () => {
@@ -67,7 +115,8 @@ class DateLookup extends React.PureComponent {
67
115
  onFocus
68
116
  } = this.props;
69
117
  this.setState({
70
- open: true
118
+ open: true,
119
+ mode: 'day'
71
120
  });
72
121
  if (onFocus) {
73
122
  onFocus();
@@ -101,13 +150,36 @@ class DateLookup extends React.PureComponent {
101
150
  } = this.state;
102
151
  switch (event.key) {
103
152
  case 'ArrowLeft':
153
+ if (open) {
154
+ this.adjustDate(-1, -1, -1);
155
+ } else {
156
+ this.open();
157
+ }
158
+ event.preventDefault();
159
+ break;
104
160
  case 'ArrowUp':
161
+ if (open) {
162
+ this.adjustDate(-7, -4, -4);
163
+ } else {
164
+ this.open();
165
+ }
166
+ event.preventDefault();
167
+ break;
105
168
  case 'ArrowRight':
169
+ if (open) {
170
+ this.adjustDate(1, 1, 1);
171
+ } else {
172
+ this.open();
173
+ }
174
+ event.preventDefault();
175
+ break;
106
176
  case 'ArrowDown':
107
- if (!open) {
177
+ if (open) {
178
+ this.adjustDate(7, 4, 4);
179
+ } else {
108
180
  this.open();
109
- event.preventDefault();
110
181
  }
182
+ event.preventDefault();
111
183
  break;
112
184
  case 'Escape':
113
185
  if (originalDate !== null) {
@@ -118,6 +190,30 @@ class DateLookup extends React.PureComponent {
118
190
  break;
119
191
  }
120
192
  };
193
+ adjustDate = (daysToAdd, monthsToAdd, yearsToAdd) => {
194
+ const {
195
+ selectedDate,
196
+ min,
197
+ max,
198
+ mode,
199
+ originalDate
200
+ } = this.state;
201
+ if (originalDate === null) {
202
+ this.setState({
203
+ originalDate: selectedDate
204
+ });
205
+ }
206
+ let date;
207
+ if (selectedDate) {
208
+ date = new Date(mode === 'year' ? selectedDate.getFullYear() + yearsToAdd : selectedDate.getFullYear(), mode === 'month' ? selectedDate.getMonth() + monthsToAdd : selectedDate.getMonth(), mode === 'day' ? selectedDate.getDate() + daysToAdd : selectedDate.getDate());
209
+ } else {
210
+ date = getStartOfDay.getStartOfDay(new Date());
211
+ }
212
+ date &&= moveToWithinRange.moveToWithinRange(date, min, max);
213
+ if (date?.getTime() !== selectedDate?.getTime()) {
214
+ this.props.onChange(date);
215
+ }
216
+ };
121
217
  focusOn = (preferredElement, fallbackElement) => {
122
218
  const element = this.element.current?.querySelector(preferredElement);
123
219
  if (element) {
@@ -126,38 +222,80 @@ class DateLookup extends React.PureComponent {
126
222
  this.focusOn(fallbackElement);
127
223
  }
128
224
  };
129
- handleDateChange = date => {
130
- this.setState(state => {
131
- const originalDate = state.originalDate ?? this.props.value;
132
- return {
133
- originalDate
134
- };
225
+ switchMode = mode => {
226
+ this.setState({
227
+ mode
135
228
  }, () => {
136
- this.props.onChange(date);
229
+ this.focusOn('.active', '.today');
137
230
  });
138
231
  };
139
- handleDateSelect = date => {
140
- this.props.onChange(date);
141
- this.close();
142
- this.focusOn('.btn');
232
+ switchToDays = () => this.switchMode('day');
233
+ switchToMonths = () => this.switchMode('month');
234
+ switchToYears = () => this.switchMode('year');
235
+ handleSelectedDateUpdate = selectedDate => {
236
+ this.setState({
237
+ selectedDate
238
+ }, () => {
239
+ this.props.onChange(selectedDate);
240
+ this.close();
241
+ this.focusOn('.btn');
242
+ });
243
+ };
244
+ handleViewDateUpdate = ({
245
+ month = this.state.viewMonth,
246
+ year = this.state.viewYear
247
+ }) => {
248
+ this.setState({
249
+ viewMonth: month,
250
+ viewYear: year
251
+ });
143
252
  };
144
253
  getCalendar = () => {
145
254
  const {
146
- value,
255
+ selectedDate,
147
256
  min,
148
257
  max,
258
+ viewMonth,
259
+ viewYear,
260
+ mode,
261
+ isMobile
262
+ } = this.state;
263
+ const {
264
+ placeholder,
149
265
  monthFormat
150
266
  } = this.props;
151
- return /*#__PURE__*/jsxRuntime.jsx("div", {
152
- className: "p-a-1",
153
- children: /*#__PURE__*/jsxRuntime.jsx(CalendarInput.default, {
154
- value: value,
267
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
268
+ className: clsx.clsx({
269
+ 'p-a-1': !isMobile
270
+ }),
271
+ children: [mode === 'day' && /*#__PURE__*/jsxRuntime.jsx(DayCalendar.default, {
272
+ selectedDate: selectedDate,
155
273
  min: min,
156
274
  max: max,
275
+ viewMonth: viewMonth,
276
+ viewYear: viewYear,
157
277
  monthFormat: monthFormat,
158
- onChange: this.handleDateChange,
159
- onSelect: this.handleDateSelect
160
- })
278
+ onSelect: this.handleSelectedDateUpdate,
279
+ onLabelClick: this.switchToYears,
280
+ onViewDateUpdate: this.handleViewDateUpdate
281
+ }), mode === 'month' && /*#__PURE__*/jsxRuntime.jsx(MonthCalendar.default, {
282
+ selectedDate: selectedDate,
283
+ min: min,
284
+ max: max,
285
+ viewYear: viewYear,
286
+ placeholder: placeholder,
287
+ onSelect: this.switchToDays,
288
+ onLabelClick: this.switchToYears,
289
+ onViewDateUpdate: this.handleViewDateUpdate
290
+ }), mode === 'year' && /*#__PURE__*/jsxRuntime.jsx(YearCalendar.default, {
291
+ selectedDate: selectedDate,
292
+ min: min,
293
+ max: max,
294
+ viewYear: viewYear,
295
+ placeholder: placeholder,
296
+ onSelect: this.switchToMonths,
297
+ onViewDateUpdate: this.handleViewDateUpdate
298
+ })]
161
299
  });
162
300
  };
163
301
  handleClear = () => {
@@ -166,6 +304,7 @@ class DateLookup extends React.PureComponent {
166
304
  };
167
305
  render() {
168
306
  const {
307
+ selectedDate,
169
308
  open
170
309
  } = this.state;
171
310
  const {
@@ -194,7 +333,7 @@ class DateLookup extends React.PureComponent {
194
333
  children: [/*#__PURE__*/jsxRuntime.jsx(DateTrigger.default, {
195
334
  id: id,
196
335
  ariaLabelledBy: ariaLabelledBy,
197
- selectedDate: value,
336
+ selectedDate: selectedDate,
198
337
  size: size,
199
338
  placeholder: placeholder,
200
339
  label: label,
@@ -1 +1 @@
1
- {"version":3,"file":"DateLookup.js","sources":["../../src/dateLookup/DateLookup.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { createRef, PureComponent, KeyboardEvent } from 'react';\nimport CalendarInput from '../calendarInput';\nimport {\n Size,\n MonthFormat,\n Position,\n type SizeSmall,\n type SizeMedium,\n type SizeLarge,\n} from '../common';\nimport ResponsivePanel from '../common/responsivePanel';\nimport { WithInputAttributesProps, withInputAttributes } from '../inputs/contexts';\nimport { OverlayIdProvider } from '../provider/overlay/OverlayIdProvider';\nimport DateTrigger from './dateTrigger';\n\nexport interface DateLookupProps {\n id?: string;\n value: Date | null;\n min?: Date | null;\n max?: Date | null;\n size?: SizeSmall | SizeMedium | SizeLarge;\n placeholder?: string;\n label?: string;\n 'aria-labelledby'?: string;\n monthFormat?: `${MonthFormat}`;\n disabled?: boolean;\n clearable?: boolean;\n onChange: (date: Date | null) => void;\n onFocus?: () => void;\n onBlur?: () => void;\n}\n\ntype DateLookupPropsWithInputAttributes = DateLookupProps & Partial<WithInputAttributesProps>;\n\ninterface DateLookupState {\n originalDate: Date | null;\n open: boolean;\n}\n\nclass DateLookup extends PureComponent<DateLookupPropsWithInputAttributes, DateLookupState> {\n declare props: DateLookupPropsWithInputAttributes &\n Required<Pick<DateLookupPropsWithInputAttributes, keyof typeof DateLookup.defaultProps>>;\n\n static defaultProps = {\n value: null,\n min: null,\n max: null,\n size: Size.MEDIUM,\n placeholder: '',\n label: '',\n monthFormat: MonthFormat.LONG,\n disabled: false,\n clearable: false,\n } satisfies Partial<DateLookupPropsWithInputAttributes>;\n\n element = createRef<HTMLDivElement>();\n\n constructor(props: DateLookup['props']) {\n super(props);\n this.state = {\n originalDate: null,\n open: false,\n };\n }\n\n componentDidUpdate(previousProps: DateLookupPropsWithInputAttributes) {\n if (this.props.value?.getTime() !== previousProps.value?.getTime() && this.state.open) {\n this.focusOn('.active');\n }\n }\n\n componentWillUnmount() {\n this.setState = () => {};\n }\n\n open = () => {\n const { onFocus } = this.props;\n\n this.setState({ open: true });\n if (onFocus) {\n onFocus();\n }\n };\n\n discard = () => {\n const { originalDate } = this.state;\n if (originalDate !== null) {\n this.props.onChange(originalDate);\n }\n this.close();\n };\n\n close = () => {\n const { onBlur } = this.props;\n this.setState({ open: false, originalDate: null });\n if (onBlur) {\n onBlur();\n }\n };\n\n handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n const { open, originalDate } = this.state;\n switch (event.key) {\n case 'ArrowLeft':\n case 'ArrowUp':\n case 'ArrowRight':\n case 'ArrowDown':\n if (!open) {\n this.open();\n event.preventDefault();\n }\n break;\n case 'Escape':\n if (originalDate !== null) {\n this.props.onChange(originalDate);\n }\n this.close();\n event.preventDefault();\n break;\n default:\n break;\n }\n };\n\n focusOn = (preferredElement: string, fallbackElement?: string) => {\n const element = this.element.current?.querySelector(preferredElement) as HTMLElement | null;\n if (element) {\n element.focus();\n } else if (fallbackElement) {\n this.focusOn(fallbackElement);\n }\n };\n\n handleDateChange = (date: Date | null) => {\n this.setState(\n (state) => {\n const originalDate = state.originalDate ?? this.props.value;\n return { originalDate };\n },\n () => {\n this.props.onChange(date);\n },\n );\n };\n\n handleDateSelect = (date: Date) => {\n this.props.onChange(date);\n this.close();\n this.focusOn('.btn');\n };\n\n getCalendar = () => {\n const { value, min, max, monthFormat } = this.props;\n return (\n <div className=\"p-a-1\">\n <CalendarInput\n value={value}\n min={min}\n max={max}\n monthFormat={monthFormat}\n onChange={this.handleDateChange}\n onSelect={this.handleDateSelect}\n />\n </div>\n );\n };\n\n handleClear = () => {\n this.props.onChange(null);\n this.focusOn('.np-date-trigger');\n };\n\n render() {\n const { open } = this.state;\n\n const {\n inputAttributes,\n id: idProp,\n 'aria-labelledby': ariaLabelledByProp,\n size,\n placeholder,\n label,\n monthFormat,\n disabled,\n clearable,\n value,\n } = this.props;\n const id = idProp ?? inputAttributes?.id;\n const ariaLabelledBy = ariaLabelledByProp ?? inputAttributes?.['aria-labelledby'];\n\n return (\n <div\n ref={this.element}\n aria-labelledby={id}\n aria-invalid={inputAttributes?.['aria-invalid']}\n aria-describedby={inputAttributes?.['aria-describedby']}\n className={clsx('input-group', disabled && 'disabled')}\n onKeyDown={this.handleKeyDown}\n >\n <OverlayIdProvider open={open}>\n <DateTrigger\n id={id}\n ariaLabelledBy={ariaLabelledBy}\n selectedDate={value}\n size={size}\n placeholder={placeholder}\n label={label}\n monthFormat={monthFormat}\n disabled={disabled || false}\n onClick={this.open}\n onClear={!disabled && clearable && value ? this.handleClear : undefined}\n />\n <ResponsivePanel\n anchorRef={this.element}\n open={open}\n className=\"tw-date-lookup-menu\"\n position={Position.BOTTOM}\n considerHeight\n onClose={this.discard}\n >\n {this.getCalendar()}\n </ResponsivePanel>\n </OverlayIdProvider>\n </div>\n );\n }\n}\n\nexport const DateLookupWithoutInputAttributes = DateLookup;\n\nconst WrappedDateLookup = withInputAttributes(\n DateLookup as React.ComponentType<DateLookupPropsWithInputAttributes>,\n { nonLabelable: true },\n);\nWrappedDateLookup.displayName = 'DateLookup';\n\nexport default WrappedDateLookup;\n"],"names":["DateLookup","PureComponent","defaultProps","value","min","max","size","Size","MEDIUM","placeholder","label","monthFormat","MonthFormat","LONG","disabled","clearable","element","createRef","constructor","props","state","originalDate","open","componentDidUpdate","previousProps","getTime","focusOn","componentWillUnmount","setState","onFocus","discard","onChange","close","onBlur","handleKeyDown","event","key","preventDefault","preferredElement","fallbackElement","current","querySelector","focus","handleDateChange","date","handleDateSelect","getCalendar","_jsx","className","children","CalendarInput","onSelect","handleClear","render","inputAttributes","id","idProp","ariaLabelledByProp","ariaLabelledBy","ref","clsx","onKeyDown","_jsxs","OverlayIdProvider","DateTrigger","selectedDate","onClick","onClear","undefined","ResponsivePanel","anchorRef","position","Position","BOTTOM","considerHeight","onClose","WrappedDateLookup","withInputAttributes","nonLabelable","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAMA,UAAW,SAAQC,mBAAkE,CAAA;AAIzF,EAAA,OAAOC,YAAY,GAAG;AACpBC,IAAAA,KAAK,EAAE,IAAI;AACXC,IAAAA,GAAG,EAAE,IAAI;AACTC,IAAAA,GAAG,EAAE,IAAI;IACTC,IAAI,EAAEC,SAAI,CAACC,MAAM;AACjBC,IAAAA,WAAW,EAAE,EAAE;AACfC,IAAAA,KAAK,EAAE,EAAE;IACTC,WAAW,EAAEC,uBAAW,CAACC,IAAI;AAC7BC,IAAAA,QAAQ,EAAE,KAAK;AACfC,IAAAA,SAAS,EAAE;GAC0C;EAEvDC,OAAO,gBAAGC,eAAS,EAAkB;EAErCC,WAAAA,CAAYC,KAA0B,EAAA;IACpC,KAAK,CAACA,KAAK,CAAC;IACZ,IAAI,CAACC,KAAK,GAAG;AACXC,MAAAA,YAAY,EAAE,IAAI;AAClBC,MAAAA,IAAI,EAAE;KACP;AACH,EAAA;EAEAC,kBAAkBA,CAACC,aAAiD,EAAA;IAClE,IAAI,IAAI,CAACL,KAAK,CAAChB,KAAK,EAAEsB,OAAO,EAAE,KAAKD,aAAa,CAACrB,KAAK,EAAEsB,OAAO,EAAE,IAAI,IAAI,CAACL,KAAK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U,CAAE;MACvD+C,SAAS,EAAE,IAAI,CAAC3B,aAAc;MAAAe,QAAA,eAE9Ba,eAAA,CAACC,mCAAiB,EAAA;AAACzC,QAAAA,IAAI,EAAEA,IAAK;QAAA2B,QAAA,EAAA,cAC5BF,cAAA,CAACiB,mBAAW,EAAA;AACVT,UAAAA,EAAE,EAAEA,EAAG;AACPG,UAAAA,cAAc,EAAEA,cAAe;AAC/BO,UAAAA,YAAY,EAAE9D,KAAM;AACpBG,UAAAA,IAAI,EAAEA,IAAK;AACXG,UAAAA,WAAW,EAAEA,WAAY;AACzBC,UAAAA,KAAK,EAAEA,KAAM;AACbC,UAAAA,WAAW,EAAEA,WAAY;UACzBG,QAAQ,EAAEA,QAAQ,IAAI,KAAM;UAC5BoD,OAAO,EAAE,IAAI,CAAC5C,IAAK;UACnB6C,OAAO,EAAE,CAACrD,QAAQ,IAAIC,SAAS,IAAIZ,KAAK,GAAG,IAAI,CAACiD,WAAW,GAAGgB;AAAU,SAAA,CAE1E,eAAArB,cAAA,CAACsB,uBAAe,EAAA;UACdC,SAAS,EAAE,IAAI,CAACtD,OAAQ;AACxBM,UAAAA,IAAI,EAAEA,IAAK;AACX0B,UAAAA,SAAS,EAAC,qBAAqB;UAC/BuB,QAAQ,EAAEC,iBAAQ,CAACC,MAAO;UAC1BC,cAAc,EAAA,IAAA;UACdC,OAAO,EAAE,IAAI,CAAC7C,OAAQ;AAAAmB,UAAAA,QAAA,EAErB,IAAI,CAACH,WAAW;AAAE,SACJ,CACnB;OAAmB;AACrB,KAAK,CAAC;AAEV,EAAA;;AAKF,MAAM8B,iBAAiB,GAAGC,4BAAmB,CAC3C7E,UAAqE,EACrE;AAAE8E,EAAAA,YAAY,EAAE;AAAI,CAAE;AAExBF,iBAAiB,CAACG,WAAW,GAAG,YAAY;;;;"}
1
+ {"version":3,"file":"DateLookup.js","sources":["../../src/dateLookup/DateLookup.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { createRef, PureComponent, KeyboardEvent } from 'react';\nimport { Breakpoint } from '@transferwise/neptune-tokens';\n\nimport {\n Size,\n MonthFormat,\n Position,\n type SizeSmall,\n type SizeMedium,\n type SizeLarge,\n} from '../common';\nimport { isWithinRange, moveToWithinRange, returnDateView } from '../common/dateUtils';\nimport ResponsivePanel from '../common/responsivePanel';\nimport { WithInputAttributesProps, withInputAttributes } from '../inputs/contexts';\nimport { OverlayIdProvider } from '../provider/overlay/OverlayIdProvider';\nimport DateTrigger from './dateTrigger';\nimport DayCalendar from './dayCalendar';\nimport { getStartOfDay } from './getStartOfDay';\nimport MonthCalendar from './monthCalendar';\nimport YearCalendar from './yearCalendar';\n\nexport interface DateLookupProps {\n id?: string;\n value: Date | null;\n min?: Date | null;\n max?: Date | null;\n size?: SizeSmall | SizeMedium | SizeLarge;\n placeholder?: string;\n label?: string;\n 'aria-labelledby'?: string;\n monthFormat?: `${MonthFormat}`;\n disabled?: boolean;\n clearable?: boolean;\n onChange: (date: Date | null) => void;\n onFocus?: () => void;\n onBlur?: () => void;\n}\n\ntype DateLookupPropsWithInputAttributes = DateLookupProps & Partial<WithInputAttributesProps>;\n\ninterface DateLookupState {\n selectedDate: Date | null;\n originalDate: Date | null;\n min: Date | null;\n max: Date | null;\n viewMonth: number;\n viewYear: number;\n open: boolean;\n mode: 'day' | 'month' | 'year';\n isMobile: boolean;\n}\n\nclass DateLookup extends PureComponent<DateLookupPropsWithInputAttributes, DateLookupState> {\n declare props: DateLookupPropsWithInputAttributes &\n Required<Pick<DateLookupPropsWithInputAttributes, keyof typeof DateLookup.defaultProps>>;\n\n static defaultProps = {\n value: null,\n min: null,\n max: null,\n size: Size.MEDIUM,\n placeholder: '',\n label: '',\n monthFormat: MonthFormat.LONG,\n disabled: false,\n clearable: false,\n } satisfies Partial<DateLookupPropsWithInputAttributes>;\n\n element = createRef<HTMLDivElement>();\n dropdown = createRef<HTMLDivElement>();\n\n constructor(props: DateLookup['props']) {\n super(props);\n const dateView = returnDateView(props.value, props.min, props.max);\n this.state = {\n selectedDate: getStartOfDay(props.value),\n originalDate: null,\n min: getStartOfDay(props.min),\n max: getStartOfDay(props.max),\n viewMonth: dateView.getMonth(),\n viewYear: dateView.getFullYear(),\n open: false,\n mode: 'day',\n isMobile: false,\n };\n }\n\n static getDerivedStateFromProps(props: DateLookup['props'], state: DateLookupState) {\n const propsSelected = getStartOfDay(props.value);\n const propsMin = getStartOfDay(props.min);\n const propsMax = getStartOfDay(props.max);\n const hasSelectedChanged = state.selectedDate?.getTime() !== propsSelected?.getTime();\n const hasMinChanged = state.min?.getTime() !== propsMin?.getTime();\n const hasMaxChanged = state.max?.getTime() !== propsMax?.getTime();\n if (hasSelectedChanged || hasMinChanged || hasMaxChanged) {\n const selectedDate = hasSelectedChanged ? propsSelected : state.selectedDate;\n const min = hasMinChanged ? propsMin : state.min;\n const max = hasMaxChanged ? propsMax : state.max;\n if (selectedDate && !isWithinRange(selectedDate, min, max)) {\n props.onChange(moveToWithinRange(selectedDate, min, max));\n return null;\n }\n const viewDateThatIsWithinRange: Date = returnDateView(selectedDate, min, max);\n const viewMonth = viewDateThatIsWithinRange.getMonth();\n const viewYear = viewDateThatIsWithinRange.getFullYear();\n return { selectedDate, min, max, viewMonth, viewYear };\n }\n return null;\n }\n\n componentDidUpdate(previousProps: DateLookupPropsWithInputAttributes) {\n if (this.props.value?.getTime() !== previousProps.value?.getTime() && this.state.open) {\n this.focusOn('.active');\n }\n const mediaQuery = window.matchMedia(`(max-width: ${Breakpoint.SMALL}px)`);\n this.setState({ isMobile: mediaQuery.matches });\n }\n\n componentWillUnmount() {\n // Prevents memory leak by cleaning state.\n this.setState = () => {};\n }\n\n open = () => {\n const { onFocus } = this.props;\n\n this.setState({ open: true, mode: 'day' });\n if (onFocus) {\n onFocus();\n }\n };\n\n discard = () => {\n const { originalDate } = this.state;\n if (originalDate !== null) {\n this.props.onChange(originalDate);\n }\n this.close();\n };\n\n close = () => {\n const { onBlur } = this.props;\n this.setState({ open: false, originalDate: null });\n if (onBlur) {\n onBlur();\n }\n };\n\n handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n const { open, originalDate } = this.state;\n switch (event.key) {\n case 'ArrowLeft':\n if (open) {\n this.adjustDate(-1, -1, -1);\n } else {\n this.open();\n }\n event.preventDefault();\n break;\n case 'ArrowUp':\n if (open) {\n this.adjustDate(-7, -4, -4);\n } else {\n this.open();\n }\n event.preventDefault();\n break;\n case 'ArrowRight':\n if (open) {\n this.adjustDate(1, 1, 1);\n } else {\n this.open();\n }\n event.preventDefault();\n break;\n case 'ArrowDown':\n if (open) {\n this.adjustDate(7, 4, 4);\n } else {\n this.open();\n }\n event.preventDefault();\n break;\n case 'Escape':\n if (originalDate !== null) {\n this.props.onChange(originalDate);\n }\n this.close();\n event.preventDefault();\n break;\n default:\n break;\n }\n };\n\n adjustDate = (daysToAdd: number, monthsToAdd: number, yearsToAdd: number) => {\n const { selectedDate, min, max, mode, originalDate } = this.state;\n if (originalDate === null) {\n this.setState({ originalDate: selectedDate });\n }\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 this.props.onChange(date);\n }\n };\n\n focusOn = (preferredElement: string, fallbackElement?: string) => {\n const element = this.element.current?.querySelector(preferredElement) as HTMLElement | null;\n if (element) {\n element.focus();\n } else if (fallbackElement) {\n this.focusOn(fallbackElement);\n }\n };\n\n switchMode = (mode: 'day' | 'month' | 'year') => {\n this.setState({ mode }, () => {\n this.focusOn('.active', '.today');\n });\n };\n\n switchToDays = () => this.switchMode('day');\n\n switchToMonths = () => this.switchMode('month');\n\n switchToYears = () => this.switchMode('year');\n\n handleSelectedDateUpdate = (selectedDate: Date) => {\n this.setState({ selectedDate }, () => {\n this.props.onChange(selectedDate);\n this.close();\n this.focusOn('.btn');\n });\n };\n\n handleViewDateUpdate = ({ month = this.state.viewMonth, year = this.state.viewYear }) => {\n this.setState({ viewMonth: month, viewYear: year });\n };\n\n getCalendar = () => {\n const { selectedDate, min, max, viewMonth, viewYear, mode, isMobile } = this.state;\n const { placeholder, monthFormat } = this.props;\n return (\n <div className={clsx({ 'p-a-1': !isMobile })}>\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={this.handleSelectedDateUpdate}\n onLabelClick={this.switchToYears}\n onViewDateUpdate={this.handleViewDateUpdate}\n />\n )}\n {mode === 'month' && (\n <MonthCalendar\n selectedDate={selectedDate}\n min={min}\n max={max}\n viewYear={viewYear}\n placeholder={placeholder}\n onSelect={this.switchToDays}\n onLabelClick={this.switchToYears}\n onViewDateUpdate={this.handleViewDateUpdate}\n />\n )}\n {mode === 'year' && (\n <YearCalendar\n selectedDate={selectedDate}\n min={min}\n max={max}\n viewYear={viewYear}\n placeholder={placeholder}\n onSelect={this.switchToMonths}\n onViewDateUpdate={this.handleViewDateUpdate}\n />\n )}\n </div>\n );\n };\n\n handleClear = () => {\n this.props.onChange(null);\n this.focusOn('.np-date-trigger');\n };\n\n render() {\n const { selectedDate, open } = this.state;\n\n const {\n inputAttributes,\n id: idProp,\n 'aria-labelledby': ariaLabelledByProp,\n size,\n placeholder,\n label,\n monthFormat,\n disabled,\n clearable,\n value,\n } = this.props;\n const id = idProp ?? inputAttributes?.id;\n const ariaLabelledBy = ariaLabelledByProp ?? inputAttributes?.['aria-labelledby'];\n\n return (\n <div\n ref={this.element}\n aria-labelledby={id}\n aria-invalid={inputAttributes?.['aria-invalid']}\n aria-describedby={inputAttributes?.['aria-describedby']}\n className={clsx('input-group', disabled && 'disabled')}\n onKeyDown={this.handleKeyDown}\n >\n <OverlayIdProvider open={open}>\n <DateTrigger\n id={id}\n ariaLabelledBy={ariaLabelledBy}\n selectedDate={selectedDate}\n size={size}\n placeholder={placeholder}\n label={label}\n monthFormat={monthFormat}\n disabled={disabled || false}\n onClick={this.open}\n onClear={!disabled && clearable && value ? this.handleClear : undefined}\n />\n <ResponsivePanel\n anchorRef={this.element}\n open={open}\n className=\"tw-date-lookup-menu\"\n position={Position.BOTTOM}\n considerHeight\n onClose={this.discard}\n >\n {this.getCalendar()}\n </ResponsivePanel>\n </OverlayIdProvider>\n </div>\n );\n }\n}\n\nexport const DateLookupWithoutInputAttributes = DateLookup;\n\nconst WrappedDateLookup = withInputAttributes(\n DateLookup as React.ComponentType<DateLookupPropsWithInputAttributes>,\n { nonLabelable: true },\n);\nWrappedDateLookup.displayName = 'DateLookup';\n\nexport default WrappedDateLookup;\n"],"names":["DateLookup","PureComponent","defaultProps","value","min","max","size","Size","MEDIUM","placeholder","label","monthFormat","MonthFormat","LONG","disabled","clearable","element","createRef","dropdown","constructor","props","dateView","returnDateView","state","selectedDate","getStartOfDay","originalDate","viewMonth","getMonth","viewYear","getFullYear","open","mode","isMobile","getDerivedStateFromProps","propsSelected","propsMin","propsMax","hasSelectedChanged","getTime","hasMinChanged","hasMaxChanged","isWithinRange","onChange","moveToWithinRange","viewDateThatIsWithinRange","componentDidUpdate","previousProps","focusOn","mediaQuery","window","matchMedia","Breakpoint","SMALL","setState","matches","componentWillUnmount","onFocus","discard","close","onBlur","handleKeyDown","event","key","adjustDate","preventDefault","daysToAdd","monthsToAdd","yearsToAdd","date","Date","getDate","preferredElement","fallbackElement","current","querySelector","focus","switchMode","switchToDays","switchToMonths","switchToYears","handleSelectedDateUpdate","handleViewDateUpdate","month","year","getCalendar","_jsxs","className","clsx","children","_jsx","DayCalendar","onSelect","onLabelClick","onViewDateUpdate","MonthCalendar","YearCalendar","handleClear","render","inputAttributes","id","idProp","ariaLabelledByProp","ariaLabelledBy","ref","onKeyDown","OverlayIdProvider","DateTrigger","onClick","onClear","undefined","ResponsivePanel","anchorRef","position","Position","BOTTOM","considerHeight","onClose","WrappedDateLookup","withInputAttributes","nonLabelable","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,MAAMA,UAAW,SAAQC,mBAAkE,CAAA;AAIzF,EAAA,OAAOC,YAAY,GAAG;AACpBC,IAAAA,KAAK,EAAE,IAAI;AACXC,IAAAA,GAAG,EAAE,IAAI;AACTC,IAAAA,GAAG,EAAE,IAAI;IACTC,IAAI,EAAEC,SAAI,CAACC,MAAM;AACjBC,IAAAA,WAAW,EAAE,EAAE;AACfC,IAAAA,KAAK,EAAE,EAAE;IACTC,WAAW,EAAEC,uBAAW,CAACC,IAAI;AAC7BC,IAAAA,QAAQ,EAAE,KAAK;AACfC,IAAAA,SAAS,EAAE;GAC0C;EAEvDC,OAAO,gBAAGC,eAAS,EAAkB;EACrCC,QAAQ,gBAAGD,eAAS,EAAkB;EAEtCE,WAAAA,CAAYC,KAA0B,EAAA;IACpC,KAAK,CAACA,KAAK,CAAC;AACZ,IAAA,MAAMC,QAAQ,GAAGC,0BAAc,CAACF,KAAK,CAACjB,KAAK,EAAEiB,KAAK,CAAChB,GAAG,EAAEgB,KAAK,CAACf,GAAG,CAAC;IAClE,IAAI,CAACkB,KAAK,GAAG;AACXC,MAAAA,YAAY,EAAEC,2BAAa,CAACL,KAAK,CAACjB,KAAK,CAAC;AACxCuB,MAAAA,YAAY,EAAE,IAAI;AAClBtB,MAAAA,GAAG,EAAEqB,2BAAa,CAACL,KAAK,CAAChB,GAAG,CAAC;AAC7BC,MAAAA,GAAG,EAAEoB,2BAAa,CAACL,KAAK,CAACf,GAAG,CAAC;AAC7BsB,MAAAA,SAAS,EAAEN,QAAQ,CAACO,QAAQ,EAAE;AAC9BC,MAAAA,QAAQ,EAAER,QAAQ,CAACS,WAAW,EAAE;AAChCC,MAAAA,IAAI,EAAE,KAAK;AACXC,MAAAA,IAAI,EAAE,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AACJ,WAAW;AAAE,SACJ,CACnB;OAAmB;AACrB,KAAK,CAAC;AAEV,EAAA;;AAKF,MAAMiC,iBAAiB,GAAGC,4BAAmB,CAC3CvH,UAAqE,EACrE;AAAEwH,EAAAA,YAAY,EAAE;AAAI,CAAE;AAExBF,iBAAiB,CAACG,WAAW,GAAG,YAAY;;;;"}
@@ -32,4 +32,4 @@ var messages = reactIntl.defineMessages({
32
32
  });
33
33
 
34
34
  exports.default = messages;
35
- //# sourceMappingURL=CalendarInput.messages.js.map
35
+ //# sourceMappingURL=DateLookup.messages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DateLookup.messages.js","sources":["../../src/dateLookup/DateLookup.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;;;;"}
@@ -28,4 +28,4 @@ var messages = defineMessages({
28
28
  });
29
29
 
30
30
  export { messages as default };
31
- //# sourceMappingURL=CalendarInput.messages.mjs.map
31
+ //# sourceMappingURL=DateLookup.messages.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DateLookup.messages.mjs","sources":["../../src/dateLookup/DateLookup.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;;;;"}