@transferwise/components 0.0.0-experimental-ef0d459 → 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 (198) 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 +514 -569
  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/less/legacy-variables.less +1 -1
  50. package/build/styles/less/neptune-tokens.less +2 -2
  51. package/build/styles/main.css +514 -569
  52. package/build/styles/props/custom-media.css +1 -1
  53. package/build/styles/props/neptune-tokens.css +1 -1
  54. package/build/styles/sentimentSurface/SentimentSurface.css +325 -337
  55. package/build/styles/styles/less/neptune.css +11 -11
  56. package/build/types/dateLookup/DateLookup.d.ts +25 -2
  57. package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
  58. package/build/types/{calendarInput/CalendarInput.messages.d.ts → dateLookup/DateLookup.messages.d.ts} +1 -1
  59. package/build/types/dateLookup/DateLookup.messages.d.ts.map +1 -0
  60. package/build/types/dateLookup/dateHeader/DateHeader.d.ts.map +1 -0
  61. package/build/types/dateLookup/dateHeader/index.d.ts.map +1 -0
  62. package/build/types/dateLookup/dayCalendar/DayCalendar.d.ts.map +1 -0
  63. package/build/types/dateLookup/dayCalendar/index.d.ts.map +1 -0
  64. package/build/types/dateLookup/dayCalendar/table/DayCalendarTable.d.ts.map +1 -0
  65. package/build/types/dateLookup/dayCalendar/table/index.d.ts.map +1 -0
  66. package/build/types/dateLookup/getFocusableTime/getFocusableTime.d.ts.map +1 -0
  67. package/build/types/dateLookup/getStartOfDay/getStartOfDay.d.ts.map +1 -0
  68. package/build/types/dateLookup/getStartOfDay/index.d.ts.map +1 -0
  69. package/build/types/dateLookup/monthCalendar/MonthCalendar.d.ts.map +1 -0
  70. package/build/types/dateLookup/monthCalendar/index.d.ts.map +1 -0
  71. package/build/types/dateLookup/monthCalendar/table/MonthCalendarTable.d.ts.map +1 -0
  72. package/build/types/dateLookup/monthCalendar/table/index.d.ts.map +1 -0
  73. package/build/types/dateLookup/tableLink/TableLink.d.ts.map +1 -0
  74. package/build/types/dateLookup/tableLink/index.d.ts.map +1 -0
  75. package/build/types/dateLookup/yearCalendar/YearCalendar.d.ts.map +1 -0
  76. package/build/types/dateLookup/yearCalendar/index.d.ts.map +1 -0
  77. package/build/types/dateLookup/yearCalendar/table/YearCalendarTable.d.ts.map +1 -0
  78. package/build/types/dateLookup/yearCalendar/table/index.d.ts.map +1 -0
  79. package/build/types/index.d.ts +0 -2
  80. package/build/types/index.d.ts.map +1 -1
  81. package/build/types/sentimentSurface/SentimentSurface.d.ts.map +1 -1
  82. package/package.json +2 -2
  83. package/src/criticalBanner/CriticalCommsBanner.test.tsx +1 -1
  84. package/src/dateLookup/DateLookup.tsx +157 -30
  85. package/src/{calendarInput → dateLookup}/dateHeader/DateHeader.tsx +1 -1
  86. package/src/{calendarInput → dateLookup}/dayCalendar/DayCalendar.tsx +1 -1
  87. package/src/{calendarInput → dateLookup}/monthCalendar/MonthCalendar.tsx +1 -1
  88. package/src/{calendarInput → dateLookup}/tableLink/TableLink.tsx +1 -1
  89. package/src/{calendarInput → dateLookup}/yearCalendar/YearCalendar.tsx +1 -1
  90. package/src/index.ts +0 -2
  91. package/src/main.css +514 -569
  92. package/src/sentimentSurface/SentimentSurface.css +325 -337
  93. package/src/sentimentSurface/SentimentSurface.docs.mdx +2 -0
  94. package/src/sentimentSurface/SentimentSurface.less +2 -322
  95. package/src/sentimentSurface/SentimentSurface.story.tsx +4 -0
  96. package/src/sentimentSurface/SentimentSurface.test.story.tsx +1 -5
  97. package/src/sentimentSurface/SentimentSurface.test.tsx +84 -3
  98. package/src/sentimentSurface/SentimentSurface.tsx +10 -2
  99. package/src/styles/less/neptune.css +11 -11
  100. package/build/calendarInput/CalendarInput.js +0 -154
  101. package/build/calendarInput/CalendarInput.js.map +0 -1
  102. package/build/calendarInput/CalendarInput.messages.js.map +0 -1
  103. package/build/calendarInput/CalendarInput.messages.mjs.map +0 -1
  104. package/build/calendarInput/CalendarInput.mjs +0 -150
  105. package/build/calendarInput/CalendarInput.mjs.map +0 -1
  106. package/build/calendarInput/dateHeader/DateHeader.js.map +0 -1
  107. package/build/calendarInput/dateHeader/DateHeader.mjs.map +0 -1
  108. package/build/calendarInput/dayCalendar/DayCalendar.js.map +0 -1
  109. package/build/calendarInput/dayCalendar/DayCalendar.mjs.map +0 -1
  110. package/build/calendarInput/dayCalendar/table/DayCalendarTable.js.map +0 -1
  111. package/build/calendarInput/dayCalendar/table/DayCalendarTable.mjs.map +0 -1
  112. package/build/calendarInput/getFocusableTime/getFocusableTime.js.map +0 -1
  113. package/build/calendarInput/getFocusableTime/getFocusableTime.mjs.map +0 -1
  114. package/build/calendarInput/getStartOfDay/getStartOfDay.js.map +0 -1
  115. package/build/calendarInput/getStartOfDay/getStartOfDay.mjs.map +0 -1
  116. package/build/calendarInput/monthCalendar/MonthCalendar.js.map +0 -1
  117. package/build/calendarInput/monthCalendar/MonthCalendar.mjs.map +0 -1
  118. package/build/calendarInput/monthCalendar/table/MonthCalendarTable.js.map +0 -1
  119. package/build/calendarInput/monthCalendar/table/MonthCalendarTable.mjs.map +0 -1
  120. package/build/calendarInput/tableLink/TableLink.js.map +0 -1
  121. package/build/calendarInput/tableLink/TableLink.mjs.map +0 -1
  122. package/build/calendarInput/yearCalendar/YearCalendar.js.map +0 -1
  123. package/build/calendarInput/yearCalendar/YearCalendar.mjs.map +0 -1
  124. package/build/calendarInput/yearCalendar/table/YearCalendarTable.js.map +0 -1
  125. package/build/calendarInput/yearCalendar/table/YearCalendarTable.mjs.map +0 -1
  126. package/build/types/calendarInput/CalendarInput.d.ts +0 -12
  127. package/build/types/calendarInput/CalendarInput.d.ts.map +0 -1
  128. package/build/types/calendarInput/CalendarInput.messages.d.ts.map +0 -1
  129. package/build/types/calendarInput/dateHeader/DateHeader.d.ts.map +0 -1
  130. package/build/types/calendarInput/dateHeader/index.d.ts.map +0 -1
  131. package/build/types/calendarInput/dayCalendar/DayCalendar.d.ts.map +0 -1
  132. package/build/types/calendarInput/dayCalendar/index.d.ts.map +0 -1
  133. package/build/types/calendarInput/dayCalendar/table/DayCalendarTable.d.ts.map +0 -1
  134. package/build/types/calendarInput/dayCalendar/table/index.d.ts.map +0 -1
  135. package/build/types/calendarInput/getFocusableTime/getFocusableTime.d.ts.map +0 -1
  136. package/build/types/calendarInput/getStartOfDay/getStartOfDay.d.ts.map +0 -1
  137. package/build/types/calendarInput/getStartOfDay/index.d.ts.map +0 -1
  138. package/build/types/calendarInput/index.d.ts +0 -3
  139. package/build/types/calendarInput/index.d.ts.map +0 -1
  140. package/build/types/calendarInput/monthCalendar/MonthCalendar.d.ts.map +0 -1
  141. package/build/types/calendarInput/monthCalendar/index.d.ts.map +0 -1
  142. package/build/types/calendarInput/monthCalendar/table/MonthCalendarTable.d.ts.map +0 -1
  143. package/build/types/calendarInput/monthCalendar/table/index.d.ts.map +0 -1
  144. package/build/types/calendarInput/tableLink/TableLink.d.ts.map +0 -1
  145. package/build/types/calendarInput/tableLink/index.d.ts.map +0 -1
  146. package/build/types/calendarInput/yearCalendar/YearCalendar.d.ts.map +0 -1
  147. package/build/types/calendarInput/yearCalendar/index.d.ts.map +0 -1
  148. package/build/types/calendarInput/yearCalendar/table/YearCalendarTable.d.ts.map +0 -1
  149. package/build/types/calendarInput/yearCalendar/table/index.d.ts.map +0 -1
  150. package/src/calendarInput/CalendarInput.story.tsx +0 -57
  151. package/src/calendarInput/CalendarInput.tsx +0 -163
  152. package/src/calendarInput/index.ts +0 -2
  153. /package/build/{calendarInput → dateLookup}/dayCalendar/table/DayCalendarTable.js +0 -0
  154. /package/build/{calendarInput → dateLookup}/dayCalendar/table/DayCalendarTable.mjs +0 -0
  155. /package/build/{calendarInput → dateLookup}/getFocusableTime/getFocusableTime.js +0 -0
  156. /package/build/{calendarInput → dateLookup}/getFocusableTime/getFocusableTime.mjs +0 -0
  157. /package/build/{calendarInput → dateLookup}/getStartOfDay/getStartOfDay.js +0 -0
  158. /package/build/{calendarInput → dateLookup}/getStartOfDay/getStartOfDay.mjs +0 -0
  159. /package/build/{calendarInput → dateLookup}/monthCalendar/table/MonthCalendarTable.js +0 -0
  160. /package/build/{calendarInput → dateLookup}/monthCalendar/table/MonthCalendarTable.mjs +0 -0
  161. /package/build/{calendarInput → dateLookup}/yearCalendar/table/YearCalendarTable.js +0 -0
  162. /package/build/{calendarInput → dateLookup}/yearCalendar/table/YearCalendarTable.mjs +0 -0
  163. /package/build/types/{calendarInput → dateLookup}/dateHeader/DateHeader.d.ts +0 -0
  164. /package/build/types/{calendarInput → dateLookup}/dateHeader/index.d.ts +0 -0
  165. /package/build/types/{calendarInput → dateLookup}/dayCalendar/DayCalendar.d.ts +0 -0
  166. /package/build/types/{calendarInput → dateLookup}/dayCalendar/index.d.ts +0 -0
  167. /package/build/types/{calendarInput → dateLookup}/dayCalendar/table/DayCalendarTable.d.ts +0 -0
  168. /package/build/types/{calendarInput → dateLookup}/dayCalendar/table/index.d.ts +0 -0
  169. /package/build/types/{calendarInput → dateLookup}/getFocusableTime/getFocusableTime.d.ts +0 -0
  170. /package/build/types/{calendarInput → dateLookup}/getStartOfDay/getStartOfDay.d.ts +0 -0
  171. /package/build/types/{calendarInput → dateLookup}/getStartOfDay/index.d.ts +0 -0
  172. /package/build/types/{calendarInput → dateLookup}/monthCalendar/MonthCalendar.d.ts +0 -0
  173. /package/build/types/{calendarInput → dateLookup}/monthCalendar/index.d.ts +0 -0
  174. /package/build/types/{calendarInput → dateLookup}/monthCalendar/table/MonthCalendarTable.d.ts +0 -0
  175. /package/build/types/{calendarInput → dateLookup}/monthCalendar/table/index.d.ts +0 -0
  176. /package/build/types/{calendarInput → dateLookup}/tableLink/TableLink.d.ts +0 -0
  177. /package/build/types/{calendarInput → dateLookup}/tableLink/index.d.ts +0 -0
  178. /package/build/types/{calendarInput → dateLookup}/yearCalendar/YearCalendar.d.ts +0 -0
  179. /package/build/types/{calendarInput → dateLookup}/yearCalendar/index.d.ts +0 -0
  180. /package/build/types/{calendarInput → dateLookup}/yearCalendar/table/YearCalendarTable.d.ts +0 -0
  181. /package/build/types/{calendarInput → dateLookup}/yearCalendar/table/index.d.ts +0 -0
  182. /package/src/{calendarInput/CalendarInput.messages.ts → dateLookup/DateLookup.messages.ts} +0 -0
  183. /package/src/{calendarInput → dateLookup}/dateHeader/index.ts +0 -0
  184. /package/src/{calendarInput → dateLookup}/dayCalendar/index.ts +0 -0
  185. /package/src/{calendarInput → dateLookup}/dayCalendar/table/DayCalendarTable.tsx +0 -0
  186. /package/src/{calendarInput → dateLookup}/dayCalendar/table/index.ts +0 -0
  187. /package/src/{calendarInput → dateLookup}/getFocusableTime/getFocusable.test.ts +0 -0
  188. /package/src/{calendarInput → dateLookup}/getFocusableTime/getFocusableTime.tsx +0 -0
  189. /package/src/{calendarInput → dateLookup}/getStartOfDay/getStartOfDay.test.js +0 -0
  190. /package/src/{calendarInput → dateLookup}/getStartOfDay/getStartOfDay.tsx +0 -0
  191. /package/src/{calendarInput → dateLookup}/getStartOfDay/index.ts +0 -0
  192. /package/src/{calendarInput → dateLookup}/monthCalendar/index.ts +0 -0
  193. /package/src/{calendarInput → dateLookup}/monthCalendar/table/MonthCalendarTable.tsx +0 -0
  194. /package/src/{calendarInput → dateLookup}/monthCalendar/table/index.ts +0 -0
  195. /package/src/{calendarInput → dateLookup}/tableLink/index.ts +0 -0
  196. /package/src/{calendarInput → dateLookup}/yearCalendar/index.ts +0 -0
  197. /package/src/{calendarInput → dateLookup}/yearCalendar/table/YearCalendarTable.tsx +0 -0
  198. /package/src/{calendarInput → dateLookup}/yearCalendar/table/index.ts +0 -0
@@ -1,7 +1,7 @@
1
1
  import { formatDate } from '@transferwise/formatting';
2
2
  import { PureComponent } from 'react';
3
3
  import { injectIntl } from 'react-intl';
4
- import messages from '../CalendarInput.messages.mjs';
4
+ import messages from '../DateLookup.messages.mjs';
5
5
  import DateHeader from '../dateHeader/DateHeader.mjs';
6
6
  import MonthCalendarTable from './table/MonthCalendarTable.mjs';
7
7
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MonthCalendar.mjs","sources":["../../../src/dateLookup/monthCalendar/MonthCalendar.tsx"],"sourcesContent":["import { formatDate } from '@transferwise/formatting';\nimport { PureComponent } from 'react';\nimport { injectIntl, WrappedComponentProps } from 'react-intl';\n\nimport messages from '../DateLookup.messages';\nimport DateHeader from '../dateHeader';\n\nimport MonthCalendarTable from './table';\n\ninterface MonthCalendarProps extends WrappedComponentProps {\n selectedDate: Date | null;\n min: Date | null;\n max: Date | null;\n viewYear: number;\n placeholder: string;\n onSelect: () => void;\n onLabelClick: () => void;\n onViewDateUpdate: (date: { year?: number; month?: number }) => void;\n}\n\nclass MonthCalendar extends PureComponent<MonthCalendarProps> {\n onMonthSelect = (month: number) => {\n this.props.onViewDateUpdate({ month });\n this.props.onSelect();\n };\n\n selectPreviousYear = () => {\n this.props.onViewDateUpdate({ year: this.props.viewYear - 1 });\n };\n\n selectNextYear = () => {\n this.props.onViewDateUpdate({ year: this.props.viewYear + 1 });\n };\n\n render() {\n const {\n selectedDate,\n min,\n max,\n viewYear,\n intl: { locale, formatMessage },\n placeholder,\n onLabelClick,\n } = this.props;\n return (\n <>\n <DateHeader\n dateMode={formatMessage(messages.year)}\n label={formatDate(new Date(viewYear, 0), locale, { year: 'numeric' })}\n onLabelClick={onLabelClick}\n onPreviousClick={this.selectPreviousYear}\n onNextClick={this.selectNextYear}\n />\n <MonthCalendarTable\n selectedDate={selectedDate}\n min={min}\n max={max}\n viewYear={viewYear}\n placeholder={placeholder}\n onSelect={this.onMonthSelect}\n />\n </>\n );\n }\n}\n\nexport default injectIntl(MonthCalendar);\n"],"names":["MonthCalendar","PureComponent","onMonthSelect","month","props","onViewDateUpdate","onSelect","selectPreviousYear","year","viewYear","selectNextYear","render","selectedDate","min","max","intl","locale","formatMessage","placeholder","onLabelClick","_jsxs","_Fragment","children","_jsx","DateHeader","dateMode","messages","label","formatDate","Date","onPreviousClick","onNextClick","MonthCalendarTable","injectIntl"],"mappings":";;;;;;;;AAoBA,MAAMA,aAAc,SAAQC,aAAiC,CAAA;EAC3DC,aAAa,GAAIC,KAAa,IAAI;AAChC,IAAA,IAAI,CAACC,KAAK,CAACC,gBAAgB,CAAC;AAAEF,MAAAA;AAAK,KAAE,CAAC;AACtC,IAAA,IAAI,CAACC,KAAK,CAACE,QAAQ,EAAE;EACvB,CAAC;EAEDC,kBAAkB,GAAGA,MAAK;AACxB,IAAA,IAAI,CAACH,KAAK,CAACC,gBAAgB,CAAC;AAAEG,MAAAA,IAAI,EAAE,IAAI,CAACJ,KAAK,CAACK,QAAQ,GAAG;AAAC,KAAE,CAAC;EAChE,CAAC;EAEDC,cAAc,GAAGA,MAAK;AACpB,IAAA,IAAI,CAACN,KAAK,CAACC,gBAAgB,CAAC;AAAEG,MAAAA,IAAI,EAAE,IAAI,CAACJ,KAAK,CAACK,QAAQ,GAAG;AAAC,KAAE,CAAC;EAChE,CAAC;AAEDE,EAAAA,MAAMA,GAAA;IACJ,MAAM;MACJC,YAAY;MACZC,GAAG;MACHC,GAAG;MACHL,QAAQ;AACRM,MAAAA,IAAI,EAAE;QAAEC,MAAM;AAAEC,QAAAA;OAAe;MAC/BC,WAAW;AACXC,MAAAA;KACD,GAAG,IAAI,CAACf,KAAK;IACd,oBACEgB,IAAA,CAAAC,QAAA,EAAA;MAAAC,QAAA,EAAA,cACEC,GAAA,CAACC,UAAU,EAAA;AACTC,QAAAA,QAAQ,EAAER,aAAa,CAACS,QAAQ,CAAClB,IAAI,CAAE;AACvCmB,QAAAA,KAAK,EAAEC,UAAU,CAAC,IAAIC,IAAI,CAACpB,QAAQ,EAAE,CAAC,CAAC,EAAEO,MAAM,EAAE;AAAER,UAAAA,IAAI,EAAE;AAAS,SAAE,CAAE;AACtEW,QAAAA,YAAY,EAAEA,YAAa;QAC3BW,eAAe,EAAE,IAAI,CAACvB,kBAAmB;QACzCwB,WAAW,EAAE,IAAI,CAACrB;AAAe,OAAA,CAEnC,eAAAa,GAAA,CAACS,kBAAkB,EAAA;AACjBpB,QAAAA,YAAY,EAAEA,YAAa;AAC3BC,QAAAA,GAAG,EAAEA,GAAI;AACTC,QAAAA,GAAG,EAAEA,GAAI;AACTL,QAAAA,QAAQ,EAAEA,QAAS;AACnBS,QAAAA,WAAW,EAAEA,WAAY;QACzBZ,QAAQ,EAAE,IAAI,CAACJ;AAAc,OAAA,CAEjC;AAAA,KAAA,CAAG;AAEP,EAAA;AACD;AAED,sBAAe+B,UAAU,CAACjC,aAAa,CAAC;;;;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MonthCalendarTable.js","sources":["../../../../src/dateLookup/monthCalendar/table/MonthCalendarTable.tsx"],"sourcesContent":["import { formatDate } from '@transferwise/formatting';\nimport { useIntl } from 'react-intl';\n\nimport { getFocusableTime } from '../../getFocusableTime/getFocusableTime';\nimport TableLink from '../../tableLink';\n\ninterface MonthCalendarTableProps {\n selectedDate: Date | null;\n min: Date | null;\n max: Date | null;\n viewYear: number;\n placeholder: string;\n onSelect: (date: number) => void;\n}\n\nconst ROWS = 3;\nconst COLS = 4;\nconst MONTH_ONLY_FORMAT: Intl.DateTimeFormatOptions = { month: 'short' };\n\nconst MonthCalendarTable = ({\n selectedDate,\n min,\n max,\n viewYear,\n placeholder,\n onSelect,\n}: MonthCalendarTableProps) => {\n const { locale } = useIntl();\n\n const getLink = (month: number) => {\n return (\n <TableLink\n item={month}\n type=\"month\"\n title={formatDate(new Date(viewYear, month), locale, MONTH_ONLY_FORMAT)}\n active={isActive(month)}\n disabled={isDisabled(month)}\n today={viewYear === new Date().getFullYear() && month === new Date().getMonth()}\n autofocus={autofocusMonth === month}\n onClick={onSelect}\n />\n );\n };\n\n const isActive = (month: number) => {\n return !!(month === selectedDate?.getMonth() && viewYear === selectedDate?.getFullYear());\n };\n\n const isThisMonth = (month: number) => {\n return viewYear === new Date().getFullYear() && month === new Date().getMonth();\n };\n\n const isDisabled = (month: number) => {\n const date = new Date(viewYear, month);\n return !!(\n (min && date < new Date(min.getFullYear(), min.getMonth())) ||\n (max && date > new Date(max.getFullYear(), max.getMonth()))\n );\n };\n\n const autofocusMonth = (() => {\n const months = Array.from({ length: ROWS * COLS }, (_, index) => index);\n return getFocusableTime({ isActive, isNow: isThisMonth, isDisabled, timeSpan: months });\n })();\n\n return (\n <table className=\"table table-condensed table-bordered tw-date-lookup-calendar np-text-body-default-bold m-b-0\">\n <thead className=\"sr-only\">\n <tr>\n <th colSpan={COLS}>{placeholder}</th>\n </tr>\n </thead>\n <tbody>\n {Array.from({ length: ROWS }, (_, rowIndex) => (\n <tr key={rowIndex}>\n {Array.from({ length: COLS }, (_, colIndex) => (\n <td key={colIndex}>{getLink(rowIndex * COLS + colIndex)}</td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n );\n};\n\nexport default MonthCalendarTable;\n"],"names":["ROWS","COLS","MONTH_ONLY_FORMAT","month","MonthCalendarTable","selectedDate","min","max","viewYear","placeholder","onSelect","locale","useIntl","getLink","_jsx","TableLink","item","type","title","formatDate","Date","active","isActive","disabled","isDisabled","today","getFullYear","getMonth","autofocus","autofocusMonth","onClick","isThisMonth","date","months","Array","from","length","_","index","getFocusableTime","isNow","timeSpan","_jsxs","className","children","colSpan","rowIndex","colIndex"],"mappings":";;;;;;;;;;AAeA,MAAMA,IAAI,GAAG,CAAC;AACd,MAAMC,IAAI,GAAG,CAAC;AACd,MAAMC,iBAAiB,GAA+B;AAAEC,EAAAA,KAAK,EAAE;CAAS;AAExE,MAAMC,kBAAkB,GAAGA,CAAC;EAC1BC,YAAY;EACZC,GAAG;EACHC,GAAG;EACHC,QAAQ;EACRC,WAAW;AACXC,EAAAA;AAAQ,CACgB,KAAI;EAC5B,MAAM;AAAEC,IAAAA;GAAQ,GAAGC,iBAAO,EAAE;EAE5B,MAAMC,OAAO,GAAIV,KAAa,IAAI;IAChC,oBACEW,cAAA,CAACC,iBAAS,EAAA;AACRC,MAAAA,IAAI,EAAEb,KAAM;AACZc,MAAAA,IAAI,EAAC,OAAO;AACZC,MAAAA,KAAK,EAAEC,qBAAU,CAAC,IAAIC,IAAI,CAACZ,QAAQ,EAAEL,KAAK,CAAC,EAAEQ,MAAM,EAAET,iBAAiB,CAAE;AACxEmB,MAAAA,MAAM,EAAEC,QAAQ,CAACnB,KAAK,CAAE;AACxBoB,MAAAA,QAAQ,EAAEC,UAAU,CAACrB,KAAK,CAAE;MAC5BsB,KAAK,EAAEjB,QAAQ,KAAK,IAAIY,IAAI,EAAE,CAACM,WAAW,EAAE,IAAIvB,KAAK,KAAK,IAAIiB,IAAI,EAAE,CAACO,QAAQ,EAAG;MAChFC,SAAS,EAAEC,cAAc,KAAK1B,KAAM;AACpC2B,MAAAA,OA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C,IAAAA,QAAA,gBAC7G9B,cAAA,CAAA,OAAA,EAAA;AAAO6B,MAAAA,SAAS,EAAC,SAAS;AAAAC,MAAAA,QAAA,eACxB9B,cAAA,CAAA,IAAA,EAAA;AAAA8B,QAAAA,QAAA,eACE9B,cAAA,CAAA,IAAA,EAAA;AAAI+B,UAAAA,OAAO,EAAE5C,IAAK;AAAA2C,UAAAA,QAAA,EAAEnC;SAAgB;OAClC;KACC,CACP,eAAAK,cAAA,CAAA,OAAA,EAAA;AAAA8B,MAAAA,QAAA,EACGV,KAAK,CAACC,IAAI,CAAC;AAAEC,QAAAA,MAAM,EAAEpC;AAAI,OAAE,EAAE,CAACqC,CAAC,EAAES,QAAQ,kBACxChC,cAAA,CAAA,IAAA,EAAA;AAAA8B,QAAAA,QAAA,EACGV,KAAK,CAACC,IAAI,CAAC;AAAEC,UAAAA,MAAM,EAAEnC;AAAI,SAAE,EAAE,CAACoC,CAAC,EAAEU,QAAQ,kBACxCjC,cAAA,CAAA,IAAA,EAAA;AAAA8B,UAAAA,QAAA,EAAoB/B,OAAO,CAACiC,QAAQ,GAAG7C,IAAI,GAAG8C,QAAQ;AAAC,SAAA,EAA9CA,QAAmD,CAC7D;AAAC,OAAA,EAHKD,QAIL,CACL;AAAC,KACG,CACT;AAAA,GAAO,CAAC;AAEZ;;;;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MonthCalendarTable.mjs","sources":["../../../../src/dateLookup/monthCalendar/table/MonthCalendarTable.tsx"],"sourcesContent":["import { formatDate } from '@transferwise/formatting';\nimport { useIntl } from 'react-intl';\n\nimport { getFocusableTime } from '../../getFocusableTime/getFocusableTime';\nimport TableLink from '../../tableLink';\n\ninterface MonthCalendarTableProps {\n selectedDate: Date | null;\n min: Date | null;\n max: Date | null;\n viewYear: number;\n placeholder: string;\n onSelect: (date: number) => void;\n}\n\nconst ROWS = 3;\nconst COLS = 4;\nconst MONTH_ONLY_FORMAT: Intl.DateTimeFormatOptions = { month: 'short' };\n\nconst MonthCalendarTable = ({\n selectedDate,\n min,\n max,\n viewYear,\n placeholder,\n onSelect,\n}: MonthCalendarTableProps) => {\n const { locale } = useIntl();\n\n const getLink = (month: number) => {\n return (\n <TableLink\n item={month}\n type=\"month\"\n title={formatDate(new Date(viewYear, month), locale, MONTH_ONLY_FORMAT)}\n active={isActive(month)}\n disabled={isDisabled(month)}\n today={viewYear === new Date().getFullYear() && month === new Date().getMonth()}\n autofocus={autofocusMonth === month}\n onClick={onSelect}\n />\n );\n };\n\n const isActive = (month: number) => {\n return !!(month === selectedDate?.getMonth() && viewYear === selectedDate?.getFullYear());\n };\n\n const isThisMonth = (month: number) => {\n return viewYear === new Date().getFullYear() && month === new Date().getMonth();\n };\n\n const isDisabled = (month: number) => {\n const date = new Date(viewYear, month);\n return !!(\n (min && date < new Date(min.getFullYear(), min.getMonth())) ||\n (max && date > new Date(max.getFullYear(), max.getMonth()))\n );\n };\n\n const autofocusMonth = (() => {\n const months = Array.from({ length: ROWS * COLS }, (_, index) => index);\n return getFocusableTime({ isActive, isNow: isThisMonth, isDisabled, timeSpan: months });\n })();\n\n return (\n <table className=\"table table-condensed table-bordered tw-date-lookup-calendar np-text-body-default-bold m-b-0\">\n <thead className=\"sr-only\">\n <tr>\n <th colSpan={COLS}>{placeholder}</th>\n </tr>\n </thead>\n <tbody>\n {Array.from({ length: ROWS }, (_, rowIndex) => (\n <tr key={rowIndex}>\n {Array.from({ length: COLS }, (_, colIndex) => (\n <td key={colIndex}>{getLink(rowIndex * COLS + colIndex)}</td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n );\n};\n\nexport default MonthCalendarTable;\n"],"names":["ROWS","COLS","MONTH_ONLY_FORMAT","month","MonthCalendarTable","selectedDate","min","max","viewYear","placeholder","onSelect","locale","useIntl","getLink","_jsx","TableLink","item","type","title","formatDate","Date","active","isActive","disabled","isDisabled","today","getFullYear","getMonth","autofocus","autofocusMonth","onClick","isThisMonth","date","months","Array","from","length","_","index","getFocusableTime","isNow","tim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A;AAAA8B,MAAAA,QAAA,EACGV,KAAK,CAACC,IAAI,CAAC;AAAEC,QAAAA,MAAM,EAAEpC;AAAI,OAAE,EAAE,CAACqC,CAAC,EAAES,QAAQ,kBACxChC,GAAA,CAAA,IAAA,EAAA;AAAA8B,QAAAA,QAAA,EACGV,KAAK,CAACC,IAAI,CAAC;AAAEC,UAAAA,MAAM,EAAEnC;AAAI,SAAE,EAAE,CAACoC,CAAC,EAAEU,QAAQ,kBACxCjC,GAAA,CAAA,IAAA,EAAA;AAAA8B,UAAAA,QAAA,EAAoB/B,OAAO,CAACiC,QAAQ,GAAG7C,IAAI,GAAG8C,QAAQ;AAAC,SAAA,EAA9CA,QAAmD,CAC7D;AAAC,OAAA,EAHKD,QAIL,CACL;AAAC,KACG,CACT;AAAA,GAAO,CAAC;AAEZ;;;;"}
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var clsx = require('clsx');
6
6
  var React = require('react');
7
7
  var reactIntl = require('react-intl');
8
- var CalendarInput_messages = require('../CalendarInput.messages.js');
8
+ var DateLookup_messages = require('../DateLookup.messages.js');
9
9
  var jsxRuntime = require('react/jsx-runtime');
10
10
 
11
11
  const TableLink = ({
@@ -36,7 +36,7 @@ const TableLink = ({
36
36
  };
37
37
  const calculateAriaLabel = () => {
38
38
  if (active) {
39
- return `${longTitle || title || ''}, ${intl.formatMessage(CalendarInput_messages.default.selected)} ${intl.formatMessage(CalendarInput_messages.default[type])}`;
39
+ return `${longTitle || title || ''}, ${intl.formatMessage(DateLookup_messages.default.selected)} ${intl.formatMessage(DateLookup_messages.default[type])}`;
40
40
  }
41
41
  return longTitle || title;
42
42
  };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableLink.js","sources":["../../../src/dateLookup/tableLink/TableLink.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useEffect, useRef } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport messages from '../DateLookup.messages';\n\ninterface TableLinkProps {\n item: number;\n type: 'day' | 'month' | 'year';\n title?: string;\n longTitle?: string;\n active: boolean;\n disabled: boolean;\n today: boolean;\n autofocus?: boolean;\n onClick: (item: number) => void;\n}\n\nconst TableLink = ({\n item,\n type,\n title,\n longTitle,\n active,\n disabled,\n today,\n autofocus,\n onClick,\n}: TableLinkProps) => {\n const buttonRef = useRef<HTMLButtonElement>(null);\n const intl = useIntl();\n\n useEffect(() => {\n if (autofocus) {\n setTimeout(() => {\n buttonRef.current?.focus();\n }, 0);\n }\n }, [autofocus]);\n\n const onCalendarClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n event.preventDefault();\n if (!disabled) {\n onClick(item);\n }\n };\n\n const calculateAriaLabel = () => {\n if (active) {\n return `${longTitle || title || ''}, ${intl.formatMessage(\n messages.selected,\n )} ${intl.formatMessage(messages[type])}`;\n }\n return longTitle || title;\n };\n\n return (\n <button\n ref={buttonRef}\n type=\"button\"\n className={clsx(\n `tw-date-lookup-${type}-option np-text-body-default-bold`,\n { active: !!active },\n { today: !!today },\n )}\n disabled={disabled}\n tabIndex={autofocus ? 0 : -1}\n aria-label={calculateAriaLabel()}\n aria-pressed={active}\n onClick={onCalendarClick}\n >\n {title || item}\n </button>\n );\n};\n\nexport default TableLink;\n"],"names":["TableLink","item","type","title","longTitle","active","disabled","today","autofocus","onClick","buttonRef","useRef","intl","useIntl","useEffect","setTimeout","current","focus","onCalendarClick","event","preventDefault","calculateAriaLabel","formatMessage","messages","selected","_jsx","ref","className","clsx","tabIndex","children"],"mappings":";;;;;;;;;;AAkBA,MAAMA,SAAS,GAAGA,CAAC;EACjBC,IAAI;EACJC,IAAI;EACJC,KAAK;EACLC,SAAS;EACTC,MAAM;EACNC,QAAQ;EACRC,KAAK;EACLC,SAAS;AACTC,EAAAA;AAAO,CACQ,KAAI;AACnB,EAAA,MAAMC,SAAS,GAAGC,YAAM,CAAoB,IAAI,CAAC;AACjD,EAAA,MAAMC,IAAI,GAAGC,iBAAO,EAAE;AAEtBC,EAAAA,eA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R,CAAC;AAEb;;;;"}
@@ -1,7 +1,7 @@
1
1
  import { clsx } from 'clsx';
2
2
  import { useRef, useEffect } from 'react';
3
3
  import { useIntl } from 'react-intl';
4
- import messages from '../CalendarInput.messages.mjs';
4
+ import messages from '../DateLookup.messages.mjs';
5
5
  import { jsx } from 'react/jsx-runtime';
6
6
 
7
7
  const TableLink = ({
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableLink.mjs","sources":["../../../src/dateLookup/tableLink/TableLink.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useEffect, useRef } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport messages from '../DateLookup.messages';\n\ninterface TableLinkProps {\n item: number;\n type: 'day' | 'month' | 'year';\n title?: string;\n longTitle?: string;\n active: boolean;\n disabled: boolean;\n today: boolean;\n autofocus?: boolean;\n onClick: (item: number) => void;\n}\n\nconst TableLink = ({\n item,\n type,\n title,\n longTitle,\n active,\n disabled,\n today,\n autofocus,\n onClick,\n}: TableLinkProps) => {\n const buttonRef = useRef<HTMLButtonElement>(null);\n const intl = useIntl();\n\n useEffect(() => {\n if (autofocus) {\n setTimeout(() => {\n buttonRef.current?.focus();\n }, 0);\n }\n }, [autofocus]);\n\n const onCalendarClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n event.preventDefault();\n if (!disabled) {\n onClick(item);\n }\n };\n\n const calculateAriaLabel = () => {\n if (active) {\n return `${longTitle || title || ''}, ${intl.formatMessage(\n messages.selected,\n )} ${intl.formatMessage(messages[type])}`;\n }\n return longTitle || title;\n };\n\n return (\n <button\n ref={buttonRef}\n type=\"button\"\n className={clsx(\n `tw-date-lookup-${type}-option np-text-body-default-bold`,\n { active: !!active },\n { today: !!today },\n )}\n disabled={disabled}\n tabIndex={autofocus ? 0 : -1}\n aria-label={calculateAriaLabel()}\n aria-pressed={active}\n onClick={onCalendarClick}\n >\n {title || item}\n </button>\n );\n};\n\nexport default TableLink;\n"],"names":["TableLink","item","type","title","longTitle","active","disabled","today","autofocus","onClick","buttonRef","useRef","intl","useIntl","useEffect","setTimeout","current","focus","onCalendarClick","event","preventDefault","calculateAriaLabel","formatMessage","messages","selected","_jsx","ref","className","clsx","tabIndex","children"],"mappings":";;;;;;AAkBA,MAAMA,SAAS,GAAGA,CAAC;EACjBC,IAAI;EACJC,IAAI;EACJC,KAAK;EACLC,SAAS;EACTC,MAAM;EACNC,QAAQ;EACRC,KAAK;EACLC,SAAS;AACTC,EAAAA;AAAO,CACQ,KAAI;AACnB,EAAA,MAAMC,SAAS,GAAGC,MAAM,CAAoB,IAAI,CAAC;AACjD,EAAA,MAAMC,IAAI,GAAGC,OAAO,EAAE;AAEtBC,EAAAA,SAAS,CAAC,MAAK;AACb,IAAA,IAAIN,SAAS,EAAE;AACbO,MAAAA,UAAU,CAAC,MAAK;AACdL,QAAAA,SAAS,CAACM,OAAO,EAAEC,KAAK,EAAE;MAC5B,CAAC,EAAE,CAAC,CAAC;AACP,IAAA;AACF,EAAA,CAAC,EAAE,CAACT,SAAS,CAAC,CAAC;EAEf,MAAMU,eAAe,GAAIC,KAA0C,IAAI;IACrEA,KAAK,CAACC,cAAc,EAAE;IACtB,IAAI,CAACd,QAAQ,EAAE;MACbG,OAAO,CAACR,IAAI,CAAC;AACf,IAAA;EACF,CAAC;EAED,MAAMoB,kBAAkB,GAAGA,MAAK;AAC9B,IAAA,IAAIhB,MAAM,EAAE;MACV,OAAO,CAAA,EAAGD,SAAS,IAAID,KAAK,IAAI,EAAE,CAAA,EAAA,EAAKS,IAAI,CAACU,aAAa,CACvDC,QAAQ,CAACC,QAAQ,CAClB,CAAA,CAAA,EAAIZ,IAAI,CAACU,aAAa,CAACC,QAAQ,CAACrB,IAAI,CAAC,CAAC,CAAA,CAAE;AAC3C,IAAA;IACA,OAAOE,SAAS,IAAID,KAAK;EAC3B,CAAC;AAED,EAAA,oBACEsB,GAAA,CAAA,QAAA,EAAA;AACEC,IAAAA,GAAG,EAAEhB,SAAU;AACfR,IAAAA,IAAI,EAAC,QAAQ;AACbyB,IAAAA,SAAS,EAAEC,IAAI,CACb,CAAA,eAAA,EAAkB1B,IAAI,mCAAmC,EACzD;MAAEG,MAAM,EAAE,CAAC,CAACA;AAAM,KAAE,EACpB;MAAEE,KAAK,EAAE,CAAC,CAACA;KAAO,CAClB;AACFD,IAAAA,QAAQ,EAAEA,QAAS;AACnBuB,IAAAA,QAAQ,EAAErB,SAAS,GAAG,CAAC,GAAG,EAAG;IAC7B,YAAA,EAAYa,kBAAkB,EAAG;AACjC,IAAA,cAAA,EAAchB,MAAO;AACrBI,IAAAA,OAAO,EAAES,eAAgB;IAAAY,QAAA,EAExB3B,KAAK,IAAIF;AAAI,GACR,CAAC;AAEb;;;;"}
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
6
  var reactIntl = require('react-intl');
7
- var CalendarInput_messages = require('../CalendarInput.messages.js');
7
+ var DateLookup_messages = require('../DateLookup.messages.js');
8
8
  var DateHeader = require('../dateHeader/DateHeader.js');
9
9
  var YearCalendarTable = require('./table/YearCalendarTable.js');
10
10
  var jsxRuntime = require('react/jsx-runtime');
@@ -39,7 +39,7 @@ let YearCalendar$1 = class YearCalendar extends React.PureComponent {
39
39
  } = this.props;
40
40
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
41
41
  children: [/*#__PURE__*/jsxRuntime.jsx(DateHeader.default, {
42
- dateMode: formatMessage(CalendarInput_messages.default.twentyYears),
42
+ dateMode: formatMessage(DateLookup_messages.default.twentyYears),
43
43
  onPreviousClick: this.selectPreviousYears,
44
44
  onNextClick: this.selectNextYears
45
45
  }), /*#__PURE__*/jsxRuntime.jsx(YearCalendarTable.default, {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"YearCalendar.js","sources":["../../../src/dateLookup/yearCalendar/YearCalendar.tsx"],"sourcesContent":["import { PureComponent } from 'react';\nimport { injectIntl, WrappedComponentProps } from 'react-intl';\n\nimport messages from '../DateLookup.messages';\nimport DateHeader from '../dateHeader';\n\nimport YearCalendarTable from './table';\n\ninterface YearCalendarProps extends WrappedComponentProps {\n selectedDate: Date | null;\n min: Date | null;\n max: Date | null;\n viewYear: number;\n placeholder: string;\n onSelect: () => void;\n onViewDateUpdate: (date: { year: number }) => void;\n}\n\nclass YearCalendar extends PureComponent<YearCalendarProps> {\n onYearSelect = (year: number) => {\n this.props.onViewDateUpdate({ year });\n this.props.onSelect();\n };\n\n selectPreviousYears = () => {\n this.props.onViewDateUpdate({ year: this.props.viewYear - 20 });\n };\n\n selectNextYears = () => {\n this.props.onViewDateUpdate({ year: this.props.viewYear + 20 });\n };\n\n render() {\n const {\n selectedDate,\n min,\n max,\n viewYear,\n placeholder,\n intl: { formatMessage },\n } = this.props;\n return (\n <>\n <DateHeader\n dateMode={formatMessage(messages.twentyYears)}\n onPreviousClick={this.selectPreviousYears}\n onNextClick={this.selectNextYears}\n />\n <YearCalendarTable\n selectedDate={selectedDate}\n min={min}\n max={max}\n viewYear={viewYear}\n placeholder={placeholder}\n onSelect={this.onYearSelect}\n />\n </>\n );\n }\n}\n\nexport default injectIntl(YearCalendar);\n"],"names":["YearCalendar","PureComponent","onYearSelect","year","props","onViewDateUpdate","onSelect","selectPreviousYears","viewYear","selectNextYears","render","selectedDate","min","max","placeholder","intl","formatMessage","_jsxs","_Fragment","children","_jsx","DateHeader","dateMode","messages","twentyYears","onPreviousClick","onNextClick","YearCalendarTable","injectIntl"],"mappings":";;;;;;;;;;;qBAkBA,MAAMA,YAAa,SAAQC,mBAAgC,CAAA;EACzDC,YAAY,GAAIC,IAAY,IAAI;AAC9B,IAAA,IAAI,CAACC,KAAK,CAACC,gBAAgB,CAAC;AAAEF,MAAAA;AAAI,KAAE,CAAC;AACrC,IAAA,IAAI,CAACC,KAAK,CAACE,QAAQ,EAAE;EACvB,CAAC;EAEDC,mBAAmB,GAAGA,MAAK;AACzB,IAAA,IAAI,CAACH,KAAK,CAACC,gBAAgB,CAAC;AAAEF,MAAAA,IAAI,EAAE,IAAI,CAACC,KAAK,CAACI,QAAQ,GAAG;AAAE,KAAE,CAAC;EACjE,CAAC;EAEDC,eAAe,GAAGA,MAAK;AACrB,IAAA,IAAI,CAACL,KAAK,CAACC,gBAAgB,CAAC;AAAEF,MAAAA,IAAI,EAAE,IAAI,CAACC,KAAK,CAACI,QAAQ,GAAG;AAAE,KAAE,CAAC;EACjE,CAAC;AAEDE,EAAAA,MAAMA,GAAA;IACJ,MAAM;MACJC,YAAY;MACZC,GAAG;MACHC,GAAG;MACHL,QAAQ;MACRM,WAAW;AACXC,MAAAA,IAAI,EAAE;AAAEC,QAAAA;AAAa;KACtB,GAAG,IAAI,CAACZ,KAAK;IACd,oBACEa,eAAA,CAAAC,mBAAA,EAAA;MAAAC,QAAA,EAAA,cACEC,cAAA,CAACC,kBAAU,EAAA;AACTC,QAAAA,QAAQ,EAAEN,aAAa,CAACO,2BAAQ,CAACC,WAAW,CAAE;QAC9CC,eAAe,EAAE,IAAI,CAAClB,mBAAoB;QAC1CmB,WAAW,EAAE,IAAI,CAACjB;AAAgB,OAAA,CAEpC,eAAAW,cAAA,CAACO,yBAAiB,EAAA;AAChBhB,QAAAA,YAAY,EAAEA,YAAa;AAC3BC,QAAAA,GAAG,EAAEA,GAAI;AACTC,QAAAA,GAAG,EAAEA,GAAI;AACTL,QAAAA,QAAQ,EAAEA,QAAS;AACnBM,QAAAA,WAAW,EAAEA,WAAY;QACzBR,QAAQ,EAAE,IAAI,CAACJ;AAAa,OAAA,CAEhC;AAAA,KAAA,CAAG;AAEP,EAAA;AACD;AAED,mBAAe0B,oBAAU,CAAC5B,cAAY,CAAC;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { PureComponent } from 'react';
2
2
  import { injectIntl } from 'react-intl';
3
- import messages from '../CalendarInput.messages.mjs';
3
+ import messages from '../DateLookup.messages.mjs';
4
4
  import DateHeader from '../dateHeader/DateHeader.mjs';
5
5
  import YearCalendarTable from './table/YearCalendarTable.mjs';
6
6
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
@@ -0,0 +1 @@
1
+ {"version":3,"file":"YearCalendar.mjs","sources":["../../../src/dateLookup/yearCalendar/YearCalendar.tsx"],"sourcesContent":["import { PureComponent } from 'react';\nimport { injectIntl, WrappedComponentProps } from 'react-intl';\n\nimport messages from '../DateLookup.messages';\nimport DateHeader from '../dateHeader';\n\nimport YearCalendarTable from './table';\n\ninterface YearCalendarProps extends WrappedComponentProps {\n selectedDate: Date | null;\n min: Date | null;\n max: Date | null;\n viewYear: number;\n placeholder: string;\n onSelect: () => void;\n onViewDateUpdate: (date: { year: number }) => void;\n}\n\nclass YearCalendar extends PureComponent<YearCalendarProps> {\n onYearSelect = (year: number) => {\n this.props.onViewDateUpdate({ year });\n this.props.onSelect();\n };\n\n selectPreviousYears = () => {\n this.props.onViewDateUpdate({ year: this.props.viewYear - 20 });\n };\n\n selectNextYears = () => {\n this.props.onViewDateUpdate({ year: this.props.viewYear + 20 });\n };\n\n render() {\n const {\n selectedDate,\n min,\n max,\n viewYear,\n placeholder,\n intl: { formatMessage },\n } = this.props;\n return (\n <>\n <DateHeader\n dateMode={formatMessage(messages.twentyYears)}\n onPreviousClick={this.selectPreviousYears}\n onNextClick={this.selectNextYears}\n />\n <YearCalendarTable\n selectedDate={selectedDate}\n min={min}\n max={max}\n viewYear={viewYear}\n placeholder={placeholder}\n onSelect={this.onYearSelect}\n />\n </>\n );\n }\n}\n\nexport default injectIntl(YearCalendar);\n"],"names":["YearCalendar","PureComponent","onYearSelect","year","props","onViewDateUpdate","onSelect","selectPreviousYears","viewYear","selectNextYears","render","selectedDate","min","max","placeholder","intl","formatMessage","_jsxs","_Fragment","children","_jsx","DateHeader","dateMode","messages","twentyYears","onPreviousClick","onNextClick","YearCalendarTable","injectIntl"],"mappings":";;;;;;;AAkBA,MAAMA,YAAa,SAAQC,aAAgC,CAAA;EACzDC,YAAY,GAAIC,IAAY,IAAI;AAC9B,IAAA,IAAI,CAACC,KAAK,CA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+1 @@
1
+ {"version":3,"file":"YearCalendarTable.js","sources":["../../../../src/dateLookup/yearCalendar/table/YearCalendarTable.tsx"],"sourcesContent":["import { formatDate } from '@transferwise/formatting';\nimport { useIntl } from 'react-intl';\n\nimport { getFocusableTime } from '../../getFocusableTime/getFocusableTime';\nimport TableLink from '../../tableLink';\n\ninterface YearCalendarTableProps {\n selectedDate: Date | null;\n min: Date | null;\n max: Date | null;\n viewYear: number;\n placeholder: string;\n onSelect: (year: number) => void;\n}\n\nconst ROWS = 5;\nconst COLS = 4;\nconst YEAR_ONLY_FORMAT: Intl.DateTimeFormatOptions = { year: 'numeric' };\n\nconst YearCalendarTable = ({\n selectedDate,\n min,\n max,\n viewYear,\n placeholder,\n onSelect,\n}: YearCalendarTableProps) => {\n const { locale } = useIntl();\n const startYear = viewYear - (viewYear % 20);\n const getLink = (year: number) => {\n return (\n <TableLink\n item={year}\n type=\"year\"\n title={formatDate(new Date(year, 0), locale, YEAR_ONLY_FORMAT)}\n active={isActive(year)}\n disabled={isDisabled(year)}\n today={isThisYear(year)}\n autofocus={autofocusYear === year}\n onClick={onSelect}\n />\n );\n };\n\n const isActive = (year: number) => {\n return !!(year === selectedDate?.getFullYear());\n };\n\n const isThisYear = (year: number) => {\n return year === new Date().getFullYear();\n };\n\n const isDisabled = (year: number) => {\n return !!((min && year < min.getFullYear()) || (max && year > max.getFullYear()));\n };\n\n const autofocusYear = (() => {\n const years = Array.from({ length: ROWS * COLS }, (_, index) => startYear + index);\n return getFocusableTime({ isActive, isNow: isThisYear, isDisabled, timeSpan: years });\n })();\n\n return (\n <table className=\"table table-condensed table-bordered tw-date-lookup-calendar m-b-0\">\n <thead className=\"sr-only\">\n <tr>\n <th colSpan={COLS}>{placeholder}</th>\n </tr>\n </thead>\n <tbody>\n {Array.from({ length: ROWS }, (_, rowIndex) => (\n <tr key={rowIndex}>\n {Array.from({ length: COLS }, (_, colIndex) => (\n <td key={colIndex}>{getLink(startYear + rowIndex * COLS + colIndex)}</td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n );\n};\n\nexport default YearCalendarTable;\n"],"names":["ROWS","COLS","YEAR_ONLY_FORMAT","year","YearCalendarTable","selectedDate","min","max","viewYear","placeholder","onSelect","locale","useIntl","startYear","getLink","_jsx","TableLink","item","type","title","formatDate","Date","active","isActive","disabled","isDisabled","today","isThisYear","autofocus","autofocusYear","onClick","getFullYear","years","Array","from","length","_","index","getFocusableTime","isNow","timeSpan","_jsxs","className","children","colSpan","rowIndex","colIndex"],"mappings":";;;;;;;;;;AAeA,MAAMA,IAAI,GAAG,CAAC;AACd,MAAMC,IAAI,GAAG,CAAC;AACd,MAAMC,gBAAgB,GAA+B;AAAEC,EAAAA,IAAI,EAAE;CAAW;AAExE,MAAMC,iBAAiB,GAAGA,CAAC;EACzBC,YAAY;EACZC,GAAG;EACHC,GAAG;EACHC,QAAQ;EACRC,WAAW;AACXC,EAAAA;AAAQ,CACe,KAAI;EAC3B,MAAM;AAAEC,IAAAA;GAAQ,GAAGC,iBAAO,EAAE;AAC5B,EAAA,MAAMC,SAAS,GAAGL,QAAQ,GAAIA,QAAQ,GAAG,EAAG;EAC5C,MAAMM,OAAO,GAAIX,IAAY,IAAI;IAC/B,oBACEY,cAAA,CAACC,iBAAS,EAAA;AACRC,MAAAA,IAAI,EAAEd,IAAK;AACXe,MAAAA,IAAI,EAAC,MAAM;AACXC,MAAAA,KAAK,EAAEC,qBAAU,CAAC,IAAIC,IAAI,CAAClB,IAAI,EAAE,CAAC,CAAC,EAAEQ,MAAM,EAAET,gBAAgB,CAAE;AAC/DoB,MAAAA,MAAM,EAAEC,QAAQ,CAACpB,IAAI,CAAE;AACvBqB,MAAAA,QAAQ,EAAEC,UAAU,CAACtB,IAAI,CAAE;AAC3BuB,MAAAA,KAAK,EAAEC,UAAU,CAACxB,IAAI,CAAE;MACxByB,SAAS,EAAEC,aAAa,KAAK1B,IAAK;AAClC2B,MAAAA,OAAO,EAAEpB;AAAS,KAAA,CAClB;EAEN,C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CAACC,IAAI,CAAC;AAAEC,QAAAA,MAAM,EAAEnC;AAAI,OAAE,EAAE,CAACoC,CAAC,EAAES,QAAQ,kBACxC9B,cAAA,CAAA,IAAA,EAAA;AAAA4B,QAAAA,QAAA,EACGV,KAAK,CAACC,IAAI,CAAC;AAAEC,UAAAA,MAAM,EAAElC;AAAI,SAAE,EAAE,CAACmC,CAAC,EAAEU,QAAQ,kBACxC/B,cAAA,CAAA,IAAA,EAAA;UAAA4B,QAAA,EAAoB7B,OAAO,CAACD,SAAS,GAAGgC,QAAQ,GAAG5C,IAAI,GAAG6C,QAAQ;AAAC,SAAA,EAA1DA,QAA+D,CACzE;AAAC,OAAA,EAHKD,QAIL,CACL;AAAC,KACG,CACT;AAAA,GAAO,CAAC;AAEZ;;;;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"YearCalendarTable.mjs","sources":["../../../../src/dateLookup/yearCalendar/table/YearCalendarTable.tsx"],"sourcesContent":["import { formatDate } from '@transferwise/formatting';\nimport { useIntl } from 'react-intl';\n\nimport { getFocusableTime } from '../../getFocusableTime/getFocusableTime';\nimport TableLink from '../../tableLink';\n\ninterface YearCalendarTableProps {\n selectedDate: Date | null;\n min: Date | null;\n max: Date | null;\n viewYear: number;\n placeholder: string;\n onSelect: (year: number) => void;\n}\n\nconst ROWS = 5;\nconst COLS = 4;\nconst YEAR_ONLY_FORMAT: Intl.DateTimeFormatOptions = { year: 'numeric' };\n\nconst YearCalendarTable = ({\n selectedDate,\n min,\n max,\n viewYear,\n placeholder,\n onSelect,\n}: YearCalendarTableProps) => {\n const { locale } = useIntl();\n const startYear = viewYear - (viewYear % 20);\n const getLink = (year: number) => {\n return (\n <TableLink\n item={year}\n type=\"year\"\n title={formatDate(new Date(year, 0), locale, YEAR_ONLY_FORMAT)}\n active={isActive(year)}\n disabled={isDisabled(year)}\n today={isThisYear(year)}\n autofocus={autofocusYear === year}\n onClick={onSelect}\n />\n );\n };\n\n const isActive = (year: number) => {\n return !!(year === selectedDate?.getFullYear());\n };\n\n const isThisYear = (year: number) => {\n return year === new Date().getFullYear();\n };\n\n const isDisabled = (year: number) => {\n return !!((min && year < min.getFullYear()) || (max && year > max.getFullYear()));\n };\n\n const autofocusYear = (() => {\n const years = Array.from({ length: ROWS * COLS }, (_, index) => startYear + index);\n return getFocusableTime({ isActive, isNow: isThisYear, isDisabled, timeSpan: years });\n })();\n\n return (\n <table className=\"table table-condensed table-bordered tw-date-lookup-calendar m-b-0\">\n <thead className=\"sr-only\">\n <tr>\n <th colSpan={COLS}>{placeholder}</th>\n </tr>\n </thead>\n <tbody>\n {Array.from({ length: ROWS }, (_, rowIndex) => (\n <tr key={rowIndex}>\n {Array.from({ length: COLS }, (_, colIndex) => (\n <td key={colIndex}>{getLink(startYear + rowIndex * COLS + colIndex)}</td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n );\n};\n\nexport default YearCalendarTable;\n"],"names":["ROWS","COLS","YEAR_ONLY_FORMAT","year","YearCalendarTable","selectedDate","min","max","viewYear","placeholder","onSelect","locale","useIntl","startYear","getLink","_jsx","TableLink","item","type","title","formatDate","Date","active","isActive","disabled","isDisabled","today","isThisYear","autofocus","autofocusYear","onClick","getFullYear","years","Array","from","length","_","index","getFocusableTime","isNow","timeSpan","_jsxs","className","children","colSpan","rowIndex","colIndex"],"mappings":";;;;;;AAeA,MAAMA,IAAI,GAAG,CAAC;AACd,MAAMC,IAAI,GAAG,CAAC;AACd,MAAMC,gBAAgB,GAA+B;AAAEC,EAAAA,IAAI,EAAE;CAAW;AAExE,MAAMC,iBAAiB,GAAGA,CAAC;EACzBC,YAAY;EACZC,GAAG;EACHC,GAAG;EACHC,QAAQ;EACRC,WAAW;AACXC,EAAAA;AAAQ,CACe,KAAI;EAC3B,MAAM;AAAEC,IAAAA;GAAQ,GAAGC,OAAO,EAAE;AAC5B,EAAA,MAAMC,SAAS,GAAGL,QAAQ,GAAIA,QAAQ,GAAG,EAAG;EAC5C,MAAMM,OAAO,GAAIX,IAAY,IA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MAAAA,QAAQ,EAAER;AAAK,KAAE,CAAC;AACvF,EAAA,CAAC,GAAG;AAEJ,EAAA,oBACES,IAAA,CAAA,OAAA,EAAA;AAAOC,IAAAA,SAAS,EAAC,oEAAoE;AAAAC,IAAAA,QAAA,gBACnF5B,GAAA,CAAA,OAAA,EAAA;AAAO2B,MAAAA,SAAS,EAAC,SAAS;AAAAC,MAAAA,QAAA,eACxB5B,GAAA,CAAA,IAAA,EAAA;AAAA4B,QAAAA,QAAA,eACE5B,GAAA,CAAA,IAAA,EAAA;AAAI6B,UAAAA,OAAO,EAAE3C,IAAK;AAAA0C,UAAAA,QAAA,EAAElC;SAAgB;OAClC;KACC,CACP,eAAAM,GAAA,CAAA,OAAA,EAAA;AAAA4B,MAAAA,QAAA,EACGV,KAAK,CAACC,IAAI,CAAC;AAAEC,QAAAA,MAAM,EAAEnC;AAAI,OAAE,EAAE,CAACoC,CAAC,EAAES,QAAQ,kBACxC9B,GAAA,CAAA,IAAA,EAAA;AAAA4B,QAAAA,QAAA,EACGV,KAAK,CAACC,IAAI,CAAC;AAAEC,UAAAA,MAAM,EAAElC;AAAI,SAAE,EAAE,CAACmC,CAAC,EAAEU,QAAQ,kBACxC/B,GAAA,CAAA,IAAA,EAAA;UAAA4B,QAAA,EAAoB7B,OAAO,CAACD,SAAS,GAAGgC,QAAQ,GAAG5C,IAAI,GAAG6C,QAAQ;AAAC,SAAA,EAA1DA,QAA+D,CACzE;AAAC,OAAA,EAHKD,QAIL,CACL;AAAC,KACG,CACT;AAAA,GAAO,CAAC;AAEZ;;;;"}
package/build/index.js CHANGED
@@ -38,7 +38,6 @@ var BaseCard = require('./common/baseCard/BaseCard.js');
38
38
  var CriticalCommsBanner = require('./criticalBanner/CriticalCommsBanner.js');
39
39
  var DateInput = require('./dateInput/DateInput.js');
40
40
  var DateLookup = require('./dateLookup/DateLookup.js');
41
- var CalendarInput = require('./calendarInput/CalendarInput.js');
42
41
  var Decision = require('./decision/Decision.js');
43
42
  var DefinitionList = require('./definitionList/DefinitionList.js');
44
43
  var Dimmer = require('./dimmer/Dimmer.js');
@@ -197,7 +196,6 @@ exports.BaseCard = BaseCard.default;
197
196
  exports.CriticalCommsBanner = CriticalCommsBanner.default;
198
197
  exports.DateInput = DateInput.default;
199
198
  exports.DateLookup = DateLookup.default;
200
- exports.CalendarInput = CalendarInput.default;
201
199
  exports.Decision = Decision.default;
202
200
  Object.defineProperty(exports, "DecisionPresentation", {
203
201
  enumerable: true,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/build/index.mjs CHANGED
@@ -36,7 +36,6 @@ export { default as BaseCard } from './common/baseCard/BaseCard.mjs';
36
36
  export { default as CriticalCommsBanner } from './criticalBanner/CriticalCommsBanner.mjs';
37
37
  export { default as DateInput } from './dateInput/DateInput.mjs';
38
38
  export { default as DateLookup } from './dateLookup/DateLookup.mjs';
39
- export { default as CalendarInput } from './calendarInput/CalendarInput.mjs';
40
39
  export { default as Decision, DecisionPresentation, DecisionType } from './decision/Decision.mjs';
41
40
  export { default as DefinitionList } from './definitionList/DefinitionList.mjs';
42
41
  export { default as Dimmer } from './dimmer/Dimmer.mjs';
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}