@transferwise/components 46.144.0 → 46.145.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (329) hide show
  1. package/README.md +2 -2
  2. package/build/actionOption/ActionOption.js.map +1 -1
  3. package/build/actionOption/ActionOption.mjs.map +1 -1
  4. package/build/calendar/Calendar.js +159 -0
  5. package/build/calendar/Calendar.js.map +1 -0
  6. package/build/{dateLookup/DateLookup.messages.js → calendar/Calendar.messages.js} +1 -1
  7. package/build/calendar/Calendar.messages.js.map +1 -0
  8. package/build/{dateLookup/DateLookup.messages.mjs → calendar/Calendar.messages.mjs} +1 -1
  9. package/build/calendar/Calendar.messages.mjs.map +1 -0
  10. package/build/calendar/Calendar.mjs +155 -0
  11. package/build/calendar/Calendar.mjs.map +1 -0
  12. package/build/{dateLookup → calendar}/dateHeader/DateHeader.js +4 -4
  13. package/build/calendar/dateHeader/DateHeader.js.map +1 -0
  14. package/build/{dateLookup → calendar}/dateHeader/DateHeader.mjs +1 -1
  15. package/build/calendar/dateHeader/DateHeader.mjs.map +1 -0
  16. package/build/{dateLookup → calendar}/dayCalendar/DayCalendar.js +2 -2
  17. package/build/calendar/dayCalendar/DayCalendar.js.map +1 -0
  18. package/build/{dateLookup → calendar}/dayCalendar/DayCalendar.mjs +1 -1
  19. package/build/calendar/dayCalendar/DayCalendar.mjs.map +1 -0
  20. package/build/calendar/dayCalendar/table/DayCalendarTable.js.map +1 -0
  21. package/build/calendar/dayCalendar/table/DayCalendarTable.mjs.map +1 -0
  22. package/build/calendar/getFocusableTime/getFocusableTime.js.map +1 -0
  23. package/build/calendar/getFocusableTime/getFocusableTime.mjs.map +1 -0
  24. package/build/calendar/getStartOfDay/getStartOfDay.js.map +1 -0
  25. package/build/calendar/getStartOfDay/getStartOfDay.mjs.map +1 -0
  26. package/build/{dateLookup → calendar}/monthCalendar/MonthCalendar.js +2 -2
  27. package/build/calendar/monthCalendar/MonthCalendar.js.map +1 -0
  28. package/build/{dateLookup → calendar}/monthCalendar/MonthCalendar.mjs +1 -1
  29. package/build/calendar/monthCalendar/MonthCalendar.mjs.map +1 -0
  30. package/build/calendar/monthCalendar/table/MonthCalendarTable.js.map +1 -0
  31. package/build/calendar/monthCalendar/table/MonthCalendarTable.mjs.map +1 -0
  32. package/build/{dateLookup → calendar}/tableLink/TableLink.js +2 -2
  33. package/build/calendar/tableLink/TableLink.js.map +1 -0
  34. package/build/{dateLookup → calendar}/tableLink/TableLink.mjs +1 -1
  35. package/build/calendar/tableLink/TableLink.mjs.map +1 -0
  36. package/build/{dateLookup → calendar}/yearCalendar/YearCalendar.js +2 -2
  37. package/build/calendar/yearCalendar/YearCalendar.js.map +1 -0
  38. package/build/{dateLookup → calendar}/yearCalendar/YearCalendar.mjs +1 -1
  39. package/build/calendar/yearCalendar/YearCalendar.mjs.map +1 -0
  40. package/build/calendar/yearCalendar/table/YearCalendarTable.js.map +1 -0
  41. package/build/calendar/yearCalendar/table/YearCalendarTable.mjs.map +1 -0
  42. package/build/checkboxOption/CheckboxOption.js.map +1 -1
  43. package/build/checkboxOption/CheckboxOption.mjs.map +1 -1
  44. package/build/container/Container.js.map +1 -1
  45. package/build/container/Container.mjs.map +1 -1
  46. package/build/dateLookup/DateLookup.js +28 -168
  47. package/build/dateLookup/DateLookup.js.map +1 -1
  48. package/build/dateLookup/DateLookup.mjs +29 -169
  49. package/build/dateLookup/DateLookup.mjs.map +1 -1
  50. package/build/index.js +2 -0
  51. package/build/index.js.map +1 -1
  52. package/build/index.mjs +1 -0
  53. package/build/index.mjs.map +1 -1
  54. package/build/legacylistItem/LegacyListItem.js.map +1 -1
  55. package/build/legacylistItem/LegacyListItem.mjs.map +1 -1
  56. package/build/listItem/AvatarLayout/ListItemAvatarLayout.js.map +1 -1
  57. package/build/listItem/AvatarLayout/ListItemAvatarLayout.mjs.map +1 -1
  58. package/build/listItem/AvatarView/ListItemAvatarView.js.map +1 -1
  59. package/build/listItem/AvatarView/ListItemAvatarView.mjs.map +1 -1
  60. package/build/listItem/Button/ListItemButton.js.map +1 -1
  61. package/build/listItem/Button/ListItemButton.mjs.map +1 -1
  62. package/build/listItem/Checkbox/ListItemCheckbox.js.map +1 -1
  63. package/build/listItem/Checkbox/ListItemCheckbox.mjs.map +1 -1
  64. package/build/listItem/IconButton/ListItemIconButton.js.map +1 -1
  65. package/build/listItem/IconButton/ListItemIconButton.mjs.map +1 -1
  66. package/build/listItem/Image/ListItemImage.js.map +1 -1
  67. package/build/listItem/Image/ListItemImage.mjs.map +1 -1
  68. package/build/listItem/ListItem.js.map +1 -1
  69. package/build/listItem/ListItem.mjs.map +1 -1
  70. package/build/listItem/Navigation/ListItemNavigation.js.map +1 -1
  71. package/build/listItem/Navigation/ListItemNavigation.mjs.map +1 -1
  72. package/build/listItem/Prompt/ListItemPrompt.js.map +1 -1
  73. package/build/listItem/Prompt/ListItemPrompt.mjs.map +1 -1
  74. package/build/listItem/Radio/ListItemRadio.js.map +1 -1
  75. package/build/listItem/Radio/ListItemRadio.mjs.map +1 -1
  76. package/build/listItem/Switch/ListItemSwitch.js.map +1 -1
  77. package/build/listItem/Switch/ListItemSwitch.mjs.map +1 -1
  78. package/build/loader/Loader.js +1 -1
  79. package/build/loader/Loader.js.map +1 -1
  80. package/build/loader/Loader.mjs +1 -1
  81. package/build/loader/Loader.mjs.map +1 -1
  82. package/build/logo/Logo.js +1 -1
  83. package/build/logo/Logo.js.map +1 -1
  84. package/build/logo/Logo.mjs +1 -1
  85. package/build/logo/Logo.mjs.map +1 -1
  86. package/build/main.css +108 -117
  87. package/build/navigationOption/NavigationOption.js.map +1 -1
  88. package/build/navigationOption/NavigationOption.mjs.map +1 -1
  89. package/build/navigationOptionsList/NavigationOptionsList.js.map +1 -1
  90. package/build/navigationOptionsList/NavigationOptionsList.mjs.map +1 -1
  91. package/build/prompt/ActionPrompt/ActionPrompt.js.map +1 -1
  92. package/build/prompt/ActionPrompt/ActionPrompt.mjs.map +1 -1
  93. package/build/prompt/CriticalBanner/CriticalBanner.js.map +1 -1
  94. package/build/prompt/CriticalBanner/CriticalBanner.mjs.map +1 -1
  95. package/build/prompt/InfoPrompt/InfoPrompt.js.map +1 -1
  96. package/build/prompt/InfoPrompt/InfoPrompt.mjs.map +1 -1
  97. package/build/radioOption/RadioOption.js.map +1 -1
  98. package/build/radioOption/RadioOption.mjs.map +1 -1
  99. package/build/segmentedControl/SegmentedControl.js +1 -1
  100. package/build/segmentedControl/SegmentedControl.js.map +1 -1
  101. package/build/segmentedControl/SegmentedControl.mjs +1 -1
  102. package/build/segmentedControl/SegmentedControl.mjs.map +1 -1
  103. package/build/styles/calendar/Calendar.css +83 -0
  104. package/build/styles/css/neptune.css +11 -11
  105. package/build/styles/dateLookup/DateLookup.css +0 -90
  106. package/build/styles/less/legacy-variables.less +1 -1
  107. package/build/styles/less/neptune-tokens.less +2 -2
  108. package/build/styles/main.css +108 -117
  109. package/build/styles/props/custom-media.css +1 -1
  110. package/build/styles/props/neptune-tokens.css +1 -1
  111. package/build/styles/styles/less/neptune.css +11 -11
  112. package/build/summary/Summary.js +1 -1
  113. package/build/summary/Summary.js.map +1 -1
  114. package/build/summary/Summary.mjs +1 -1
  115. package/build/summary/Summary.mjs.map +1 -1
  116. package/build/switchOption/SwitchOption.js +1 -1
  117. package/build/switchOption/SwitchOption.js.map +1 -1
  118. package/build/switchOption/SwitchOption.mjs +1 -1
  119. package/build/switchOption/SwitchOption.mjs.map +1 -1
  120. package/build/types/actionOption/ActionOption.d.ts +1 -1
  121. package/build/types/calendar/Calendar.d.ts +13 -0
  122. package/build/types/calendar/Calendar.d.ts.map +1 -0
  123. package/build/types/{dateLookup/DateLookup.messages.d.ts → calendar/Calendar.messages.d.ts} +1 -1
  124. package/build/types/calendar/Calendar.messages.d.ts.map +1 -0
  125. package/build/types/calendar/dateHeader/DateHeader.d.ts.map +1 -0
  126. package/build/types/calendar/dateHeader/index.d.ts.map +1 -0
  127. package/build/types/calendar/dayCalendar/DayCalendar.d.ts.map +1 -0
  128. package/build/types/calendar/dayCalendar/index.d.ts.map +1 -0
  129. package/build/types/calendar/dayCalendar/table/DayCalendarTable.d.ts.map +1 -0
  130. package/build/types/calendar/dayCalendar/table/index.d.ts.map +1 -0
  131. package/build/types/calendar/getFocusableTime/getFocusableTime.d.ts.map +1 -0
  132. package/build/types/calendar/getStartOfDay/getStartOfDay.d.ts.map +1 -0
  133. package/build/types/calendar/getStartOfDay/index.d.ts.map +1 -0
  134. package/build/types/calendar/index.d.ts +3 -0
  135. package/build/types/calendar/index.d.ts.map +1 -0
  136. package/build/types/{dateLookup → calendar}/monthCalendar/MonthCalendar.d.ts +1 -1
  137. package/build/types/calendar/monthCalendar/MonthCalendar.d.ts.map +1 -0
  138. package/build/types/calendar/monthCalendar/index.d.ts.map +1 -0
  139. package/build/types/{dateLookup → calendar}/monthCalendar/table/MonthCalendarTable.d.ts +1 -1
  140. package/build/types/calendar/monthCalendar/table/MonthCalendarTable.d.ts.map +1 -0
  141. package/build/types/calendar/monthCalendar/table/index.d.ts.map +1 -0
  142. package/build/types/calendar/tableLink/TableLink.d.ts.map +1 -0
  143. package/build/types/calendar/tableLink/index.d.ts.map +1 -0
  144. package/build/types/{dateLookup → calendar}/yearCalendar/YearCalendar.d.ts +1 -1
  145. package/build/types/calendar/yearCalendar/YearCalendar.d.ts.map +1 -0
  146. package/build/types/calendar/yearCalendar/index.d.ts.map +1 -0
  147. package/build/types/{dateLookup → calendar}/yearCalendar/table/YearCalendarTable.d.ts +1 -1
  148. package/build/types/calendar/yearCalendar/table/YearCalendarTable.d.ts.map +1 -0
  149. package/build/types/calendar/yearCalendar/table/index.d.ts.map +1 -0
  150. package/build/types/checkboxOption/CheckboxOption.d.ts +1 -1
  151. package/build/types/container/Container.d.ts +1 -1
  152. package/build/types/dateLookup/DateLookup.d.ts +2 -26
  153. package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
  154. package/build/types/index.d.ts +2 -0
  155. package/build/types/index.d.ts.map +1 -1
  156. package/build/types/legacylistItem/LegacyListItem.d.ts +1 -1
  157. package/build/types/listItem/AvatarLayout/ListItemAvatarLayout.d.ts +1 -1
  158. package/build/types/listItem/AvatarView/ListItemAvatarView.d.ts +1 -1
  159. package/build/types/listItem/Button/ListItemButton.d.ts +1 -1
  160. package/build/types/listItem/Checkbox/ListItemCheckbox.d.ts +1 -1
  161. package/build/types/listItem/IconButton/ListItemIconButton.d.ts +1 -1
  162. package/build/types/listItem/Image/ListItemImage.d.ts +1 -1
  163. package/build/types/listItem/ListItem.d.ts +1 -1
  164. package/build/types/listItem/Navigation/ListItemNavigation.d.ts +1 -1
  165. package/build/types/listItem/Prompt/ListItemPrompt.d.ts +1 -1
  166. package/build/types/listItem/Radio/ListItemRadio.d.ts +1 -1
  167. package/build/types/listItem/Switch/ListItemSwitch.d.ts +1 -1
  168. package/build/types/logo/Logo.d.ts +1 -1
  169. package/build/types/navigationOption/NavigationOption.d.ts +1 -1
  170. package/build/types/navigationOptionsList/NavigationOptionsList.d.ts +1 -1
  171. package/build/types/prompt/ActionPrompt/ActionPrompt.d.ts +1 -1
  172. package/build/types/prompt/CriticalBanner/CriticalBanner.d.ts +1 -1
  173. package/build/types/prompt/InfoPrompt/InfoPrompt.d.ts +1 -1
  174. package/build/types/radioOption/RadioOption.d.ts +1 -1
  175. package/build/types/summary/Summary.d.ts +1 -1
  176. package/build/types/switchOption/SwitchOption.d.ts +1 -1
  177. package/package.json +22 -23
  178. package/src/actionButton/ActionButton.story.tsx +1 -1
  179. package/src/actionOption/ActionOption.tsx +1 -1
  180. package/src/button/_stories/Button.accessibility.docs.mdx +1 -1
  181. package/src/button/_stories/Button.story.tsx +6 -6
  182. package/src/calendar/Calendar.css +83 -0
  183. package/src/calendar/Calendar.less +79 -0
  184. package/src/calendar/Calendar.story.tsx +92 -0
  185. package/src/calendar/Calendar.test.tsx +138 -0
  186. package/src/calendar/Calendar.tsx +165 -0
  187. package/src/{dateLookup → calendar}/dateHeader/DateHeader.tsx +1 -1
  188. package/src/{dateLookup → calendar}/dayCalendar/DayCalendar.tsx +1 -1
  189. package/src/calendar/index.ts +2 -0
  190. package/src/{dateLookup → calendar}/monthCalendar/MonthCalendar.tsx +2 -2
  191. package/src/{dateLookup → calendar}/monthCalendar/table/MonthCalendarTable.tsx +1 -1
  192. package/src/{dateLookup → calendar}/tableLink/TableLink.tsx +1 -1
  193. package/src/{dateLookup → calendar}/yearCalendar/YearCalendar.tsx +2 -2
  194. package/src/{dateLookup → calendar}/yearCalendar/table/YearCalendarTable.tsx +1 -1
  195. package/src/checkboxButton/CheckboxButton.story.tsx +1 -1
  196. package/src/checkboxOption/CheckboxOption.tsx +1 -1
  197. package/src/chips/Chips.story.tsx +3 -3
  198. package/src/circularButton/CircularButton.story.tsx +4 -4
  199. package/src/container/Container.tsx +1 -1
  200. package/src/dateLookup/DateLookup.css +0 -90
  201. package/src/dateLookup/DateLookup.less +0 -91
  202. package/src/dateLookup/DateLookup.test.tsx +0 -124
  203. package/src/dateLookup/DateLookup.tsx +31 -161
  204. package/src/divider/Divider.story.tsx +2 -2
  205. package/src/header/Header.accessibility.docs.mdx +1 -1
  206. package/src/header/Header.story.tsx +1 -1
  207. package/src/iconButton/IconButton.story.tsx +4 -4
  208. package/src/index.ts +2 -0
  209. package/src/legacylistItem/LegacyListItem.tsx +1 -1
  210. package/src/listItem/AdditionalInfo/ListItemAdditionalInfo.story.tsx +1 -1
  211. package/src/listItem/AvatarLayout/ListItemAvatarLayout.story.tsx +1 -1
  212. package/src/listItem/AvatarLayout/ListItemAvatarLayout.tsx +1 -1
  213. package/src/listItem/AvatarView/ListItemAvatarView.story.tsx +3 -3
  214. package/src/listItem/AvatarView/ListItemAvatarView.tsx +1 -1
  215. package/src/listItem/Button/ListItemButton.story.tsx +3 -3
  216. package/src/listItem/Button/ListItemButton.tsx +1 -1
  217. package/src/listItem/Checkbox/ListItemCheckbox.tsx +1 -1
  218. package/src/listItem/IconButton/ListItemIconButton.story.tsx +4 -4
  219. package/src/listItem/IconButton/ListItemIconButton.tsx +1 -1
  220. package/src/listItem/Image/ListItemImage.tsx +1 -1
  221. package/src/listItem/ListItem.tsx +1 -1
  222. package/src/listItem/Navigation/ListItemNavigation.tsx +1 -1
  223. package/src/listItem/Prompt/ListItemPrompt.tsx +1 -1
  224. package/src/listItem/Radio/ListItemRadio.tsx +1 -1
  225. package/src/listItem/Switch/ListItemSwitch.tsx +1 -1
  226. package/src/listItem/_stories/ListItem.disabled.story.tsx +1 -1
  227. package/src/listItem/_stories/ListItem.story.tsx +5 -5
  228. package/src/loader/Loader.tsx +1 -1
  229. package/src/logo/Logo.story.tsx +1 -1
  230. package/src/logo/Logo.tsx +1 -1
  231. package/src/main.css +108 -117
  232. package/src/main.less +1 -0
  233. package/src/navigationOption/NavigationOption.tsx +1 -1
  234. package/src/navigationOptionsList/NavigationOptionsList.tsx +1 -1
  235. package/src/prompt/ActionPrompt/ActionPrompt.story.tsx +1 -1
  236. package/src/prompt/ActionPrompt/ActionPrompt.tsx +1 -1
  237. package/src/prompt/CriticalBanner/CriticalBanner.story.tsx +1 -1
  238. package/src/prompt/CriticalBanner/CriticalBanner.tsx +1 -1
  239. package/src/prompt/InfoPrompt/InfoPrompt.story.tsx +1 -1
  240. package/src/prompt/InfoPrompt/InfoPrompt.tsx +1 -1
  241. package/src/radioOption/RadioOption.tsx +1 -1
  242. package/src/segmentedControl/SegmentedControl.test.tsx +1 -1
  243. package/src/segmentedControl/SegmentedControl.tsx +1 -1
  244. package/src/styles/less/neptune.css +11 -11
  245. package/src/summary/Summary.tsx +1 -1
  246. package/src/switch/Switch.story.tsx +1 -1
  247. package/src/switchOption/SwitchOption.tsx +1 -1
  248. package/build/dateLookup/DateLookup.messages.js.map +0 -1
  249. package/build/dateLookup/DateLookup.messages.mjs.map +0 -1
  250. package/build/dateLookup/dateHeader/DateHeader.js.map +0 -1
  251. package/build/dateLookup/dateHeader/DateHeader.mjs.map +0 -1
  252. package/build/dateLookup/dayCalendar/DayCalendar.js.map +0 -1
  253. package/build/dateLookup/dayCalendar/DayCalendar.mjs.map +0 -1
  254. package/build/dateLookup/dayCalendar/table/DayCalendarTable.js.map +0 -1
  255. package/build/dateLookup/dayCalendar/table/DayCalendarTable.mjs.map +0 -1
  256. package/build/dateLookup/getFocusableTime/getFocusableTime.js.map +0 -1
  257. package/build/dateLookup/getFocusableTime/getFocusableTime.mjs.map +0 -1
  258. package/build/dateLookup/getStartOfDay/getStartOfDay.js.map +0 -1
  259. package/build/dateLookup/getStartOfDay/getStartOfDay.mjs.map +0 -1
  260. package/build/dateLookup/monthCalendar/MonthCalendar.js.map +0 -1
  261. package/build/dateLookup/monthCalendar/MonthCalendar.mjs.map +0 -1
  262. package/build/dateLookup/monthCalendar/table/MonthCalendarTable.js.map +0 -1
  263. package/build/dateLookup/monthCalendar/table/MonthCalendarTable.mjs.map +0 -1
  264. package/build/dateLookup/tableLink/TableLink.js.map +0 -1
  265. package/build/dateLookup/tableLink/TableLink.mjs.map +0 -1
  266. package/build/dateLookup/yearCalendar/YearCalendar.js.map +0 -1
  267. package/build/dateLookup/yearCalendar/YearCalendar.mjs.map +0 -1
  268. package/build/dateLookup/yearCalendar/table/YearCalendarTable.js.map +0 -1
  269. package/build/dateLookup/yearCalendar/table/YearCalendarTable.mjs.map +0 -1
  270. package/build/types/dateLookup/DateLookup.messages.d.ts.map +0 -1
  271. package/build/types/dateLookup/dateHeader/DateHeader.d.ts.map +0 -1
  272. package/build/types/dateLookup/dateHeader/index.d.ts.map +0 -1
  273. package/build/types/dateLookup/dayCalendar/DayCalendar.d.ts.map +0 -1
  274. package/build/types/dateLookup/dayCalendar/index.d.ts.map +0 -1
  275. package/build/types/dateLookup/dayCalendar/table/DayCalendarTable.d.ts.map +0 -1
  276. package/build/types/dateLookup/dayCalendar/table/index.d.ts.map +0 -1
  277. package/build/types/dateLookup/getFocusableTime/getFocusableTime.d.ts.map +0 -1
  278. package/build/types/dateLookup/getStartOfDay/getStartOfDay.d.ts.map +0 -1
  279. package/build/types/dateLookup/getStartOfDay/index.d.ts.map +0 -1
  280. package/build/types/dateLookup/monthCalendar/MonthCalendar.d.ts.map +0 -1
  281. package/build/types/dateLookup/monthCalendar/index.d.ts.map +0 -1
  282. package/build/types/dateLookup/monthCalendar/table/MonthCalendarTable.d.ts.map +0 -1
  283. package/build/types/dateLookup/monthCalendar/table/index.d.ts.map +0 -1
  284. package/build/types/dateLookup/tableLink/TableLink.d.ts.map +0 -1
  285. package/build/types/dateLookup/tableLink/index.d.ts.map +0 -1
  286. package/build/types/dateLookup/yearCalendar/YearCalendar.d.ts.map +0 -1
  287. package/build/types/dateLookup/yearCalendar/index.d.ts.map +0 -1
  288. package/build/types/dateLookup/yearCalendar/table/YearCalendarTable.d.ts.map +0 -1
  289. package/build/types/dateLookup/yearCalendar/table/index.d.ts.map +0 -1
  290. /package/build/{dateLookup → calendar}/dayCalendar/table/DayCalendarTable.js +0 -0
  291. /package/build/{dateLookup → calendar}/dayCalendar/table/DayCalendarTable.mjs +0 -0
  292. /package/build/{dateLookup → calendar}/getFocusableTime/getFocusableTime.js +0 -0
  293. /package/build/{dateLookup → calendar}/getFocusableTime/getFocusableTime.mjs +0 -0
  294. /package/build/{dateLookup → calendar}/getStartOfDay/getStartOfDay.js +0 -0
  295. /package/build/{dateLookup → calendar}/getStartOfDay/getStartOfDay.mjs +0 -0
  296. /package/build/{dateLookup → calendar}/monthCalendar/table/MonthCalendarTable.js +0 -0
  297. /package/build/{dateLookup → calendar}/monthCalendar/table/MonthCalendarTable.mjs +0 -0
  298. /package/build/{dateLookup → calendar}/yearCalendar/table/YearCalendarTable.js +0 -0
  299. /package/build/{dateLookup → calendar}/yearCalendar/table/YearCalendarTable.mjs +0 -0
  300. /package/build/types/{dateLookup → calendar}/dateHeader/DateHeader.d.ts +0 -0
  301. /package/build/types/{dateLookup → calendar}/dateHeader/index.d.ts +0 -0
  302. /package/build/types/{dateLookup → calendar}/dayCalendar/DayCalendar.d.ts +0 -0
  303. /package/build/types/{dateLookup → calendar}/dayCalendar/index.d.ts +0 -0
  304. /package/build/types/{dateLookup → calendar}/dayCalendar/table/DayCalendarTable.d.ts +0 -0
  305. /package/build/types/{dateLookup → calendar}/dayCalendar/table/index.d.ts +0 -0
  306. /package/build/types/{dateLookup → calendar}/getFocusableTime/getFocusableTime.d.ts +0 -0
  307. /package/build/types/{dateLookup → calendar}/getStartOfDay/getStartOfDay.d.ts +0 -0
  308. /package/build/types/{dateLookup → calendar}/getStartOfDay/index.d.ts +0 -0
  309. /package/build/types/{dateLookup → calendar}/monthCalendar/index.d.ts +0 -0
  310. /package/build/types/{dateLookup → calendar}/monthCalendar/table/index.d.ts +0 -0
  311. /package/build/types/{dateLookup → calendar}/tableLink/TableLink.d.ts +0 -0
  312. /package/build/types/{dateLookup → calendar}/tableLink/index.d.ts +0 -0
  313. /package/build/types/{dateLookup → calendar}/yearCalendar/index.d.ts +0 -0
  314. /package/build/types/{dateLookup → calendar}/yearCalendar/table/index.d.ts +0 -0
  315. /package/src/{dateLookup/DateLookup.messages.ts → calendar/Calendar.messages.ts} +0 -0
  316. /package/src/{dateLookup → calendar}/dateHeader/index.ts +0 -0
  317. /package/src/{dateLookup → calendar}/dayCalendar/index.ts +0 -0
  318. /package/src/{dateLookup → calendar}/dayCalendar/table/DayCalendarTable.tsx +0 -0
  319. /package/src/{dateLookup → calendar}/dayCalendar/table/index.ts +0 -0
  320. /package/src/{dateLookup → calendar}/getFocusableTime/getFocusable.test.ts +0 -0
  321. /package/src/{dateLookup → calendar}/getFocusableTime/getFocusableTime.tsx +0 -0
  322. /package/src/{dateLookup → calendar}/getStartOfDay/getStartOfDay.test.js +0 -0
  323. /package/src/{dateLookup → calendar}/getStartOfDay/getStartOfDay.tsx +0 -0
  324. /package/src/{dateLookup → calendar}/getStartOfDay/index.ts +0 -0
  325. /package/src/{dateLookup → calendar}/monthCalendar/index.ts +0 -0
  326. /package/src/{dateLookup → calendar}/monthCalendar/table/index.ts +0 -0
  327. /package/src/{dateLookup → calendar}/tableLink/index.ts +0 -0
  328. /package/src/{dateLookup → calendar}/yearCalendar/index.ts +0 -0
  329. /package/src/{dateLookup → calendar}/yearCalendar/table/index.ts +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "46.144.0",
3
+ "version": "46.145.0",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -41,20 +41,20 @@
41
41
  "devDependencies": {
42
42
  "@babel/core": "^7.29.0",
43
43
  "@babel/plugin-transform-runtime": "^7.29.0",
44
- "@babel/preset-env": "^7.29.3",
44
+ "@babel/preset-env": "^7.29.5",
45
45
  "@babel/preset-react": "^7.28.5",
46
46
  "@babel/preset-typescript": "^7.28.5",
47
- "@formatjs/cli": "^6.14.4",
47
+ "@formatjs/cli": "^6.16.0",
48
48
  "@rollup/plugin-babel": "^7.0.0",
49
49
  "@rollup/plugin-json": "^6.1.0",
50
50
  "@rollup/plugin-node-resolve": "^16.0.3",
51
51
  "@rollup/plugin-typescript": "^12.3.0",
52
52
  "@rollup/plugin-url": "^8.0.2",
53
- "@storybook/addon-a11y": "^10.3.6",
54
- "@storybook/addon-docs": "^10.3.6",
53
+ "@storybook/addon-a11y": "^10.4.0",
54
+ "@storybook/addon-docs": "^10.4.0",
55
55
  "@storybook/addon-mcp": "^0.6.0",
56
56
  "@storybook/addon-webpack5-compiler-babel": "^4.0.1",
57
- "@storybook/react-webpack5": "^10.3.6",
57
+ "@storybook/react-webpack5": "^10.4.0",
58
58
  "@testing-library/dom": "^10.4.1",
59
59
  "@testing-library/jest-dom": "^6.9.1",
60
60
  "@testing-library/react": "^16.3.2",
@@ -63,7 +63,7 @@
63
63
  "@tsconfig/recommended": "^1.0.13",
64
64
  "@types/babel__core": "^7.20.5",
65
65
  "@types/commonmark": "^0.27.10",
66
- "@types/jest": "^30.0.0",
66
+ "@types/jest": "^29.5.14",
67
67
  "@types/lodash": "4.17.24",
68
68
  "@types/lodash.clamp": "^4.0.9",
69
69
  "@types/lodash.debounce": "^4.0.9",
@@ -73,32 +73,31 @@
73
73
  "@monaco-editor/react": "^4.7.0",
74
74
  "monaco-editor": "^0.55.1",
75
75
  "monaco-editor-webpack-plugin": "^7.1.1",
76
- "@wise/art": "^2.30.1",
76
+ "@wise/art": "^2.30.3",
77
77
  "@wise/eslint-config": "^14.2.1",
78
78
  "babel-plugin-formatjs": "^10.5.41",
79
79
  "eslint": "^9.39.4",
80
- "eslint-plugin-storybook": "^10.3.6",
80
+ "eslint-plugin-storybook": "^10.4.0",
81
81
  "gulp": "^5.0.1",
82
- "jest": "^30.3.0",
82
+ "jest": "^29.7.0",
83
83
  "jest-environment-jsdom": "^29.7.0",
84
84
  "jest-fetch-mock": "^3.0.3",
85
85
  "jsdom-testing-mocks": "^1.16.0",
86
86
  "lodash.times": "^4.3.2",
87
87
  "react-intl": "^7.1.14",
88
88
  "react-live": "^4.1.8",
89
- "rollup": "^4.60.2",
89
+ "rollup": "^4.60.4",
90
90
  "rollup-preserve-directives": "^1.1.3",
91
- "storybook": "^10.3.6",
91
+ "storybook": "^10.4.0",
92
92
  "storybook-addon-tag-badges": "^3.1.0",
93
93
  "storybook-addon-test-codegen": "^3.0.1",
94
94
  "@transferwise/less-config": "3.1.2",
95
- "@transferwise/neptune-css": "14.28.0",
96
- "@wise/components-theming": "1.10.2",
97
- "@wise/wds-configs": "0.0.0"
95
+ "@wise/wds-configs": "0.0.0",
96
+ "@wise/components-theming": "1.10.2"
98
97
  },
99
98
  "peerDependencies": {
100
99
  "@transferwise/icons": "^3 || ^4",
101
- "@wise/art": "^2.30",
100
+ "@wise/art": "^2.30.3",
102
101
  "@wise/components-theming": "^1.10.1",
103
102
  "framer-motion": "^12.23.26",
104
103
  "react": ">=18",
@@ -112,8 +111,8 @@
112
111
  "@react-aria/focus": "^3.22.0",
113
112
  "@react-aria/overlays": "^3.32.0",
114
113
  "@transferwise/formatting": "^2.14.1",
115
- "@transferwise/neptune-tokens": "^8.23.0",
116
- "@transferwise/neptune-validation": "^3.3.3",
114
+ "@transferwise/neptune-tokens": "^8.24.0",
115
+ "@transferwise/neptune-validation": "^3.3.4",
117
116
  "clsx": "^2.1.1",
118
117
  "commonmark": "^0.31.2",
119
118
  "core-js": "^3.49.0",
@@ -134,18 +133,18 @@
134
133
  "dev:translations": "pnpm build:crowdin-source-file",
135
134
  "storybook:dev": "storybook dev -p 4477",
136
135
  "storybook:build": "storybook build --stats-json",
137
- "build:css": "gulp compileLess --dest=src",
138
136
  "build": "npm-run-all build:*",
139
137
  "build:clean": "rm -rf lib build",
138
+ "build:css-main": "gulp compileLess --dest=src",
139
+ "build:css-utils": "npm-run-all build:css-utils:*",
140
+ "build:css-utils:copy-brand-assets": "cpx 'src/styles/img/**' build/styles/img && cpx 'src/styles/fonts/*' build/styles/fonts",
141
+ "build:css-utils:compile": "gulp compileLess --src='src/styles/less' --dest=build/styles/css",
142
+ "build:css-utils:copy-vars": "gulp copyPropsAndVars --src='src/styles/props' --dest='build/styles/props' && gulp copyPropsAndVars --src='src/styles/variables' --dest='build/styles/less'",
140
143
  "build:crowdin-source-file": "formatjs extract 'src/**/*.messages.+(js|ts|tsx)' --out-file src/i18n/en.json --format simple && prettier --write src/i18n/*.json",
141
144
  "build:js": "rollup --config --sourcemap",
142
145
  "build:copy-files": "cpx 'src/**/!(db)/*.{json,svg}' build",
143
146
  "build:copy-css": "cpx 'src/main.css' build/ & cpx 'src/**/*.css' build/styles/",
144
147
  "build:copy-lang": "cpx 'src/i18n/*.json' build/i18n && cpx 'src/i18n/index.js' build/i18n",
145
- "build:neptune-css": "npm-run-all build:neptune-css:*",
146
- "build:neptune-css:copy-brand-assets": "cpx 'src/styles/img/**' build/styles/img && cpx 'src/styles/fonts/*' build/styles/fonts",
147
- "build:neptune-css:compile": "gulp compileLess --src='src/styles/less' --dest=build/styles/css",
148
- "build:neptune-css:copy-vars": "gulp copyPropsAndVars --src='src/styles/props' --dest='build/styles/props' && gulp copyPropsAndVars --src='src/styles/variables' --dest='build/styles/less'",
149
148
  "docs": "pnpm build",
150
149
  "test": "TZ=UTC jest",
151
150
  "test:watch": "TZ=UTC jest --watch",
@@ -7,7 +7,7 @@ import { withVariantConfig } from '../../.storybook/helpers';
7
7
  /**
8
8
  * This component is deprecated please use new [Button](?path=/docs/actions-button--docs).
9
9
  *
10
- * For more details please refer to the [release notes](https://transferwise.atlassian.net/wiki/spaces/DS/pages/3542158737/Button+Updates+New+sizes+Loader+and+Cue) and the [design spec](https://wise.design/components/button).
10
+ * For more details please refer to the [release notes](https://transferwise.atlassian.net/wiki/spaces/DS/pages/3542158737/Button+Updates+New+sizes+Loader+and+Cue) and the [design spec](https://docs.wise.design/components/button).
11
11
  */
12
12
  export default {
13
13
  component: ActionButton,
@@ -40,7 +40,7 @@ export type ActionOptionProps = {
40
40
  * @deprecatedSince 46.104.0
41
41
  * @see [Source](../listItem/ListItem.tsx)
42
42
  * @see [Storybook](https://storybook.wise.design/?path=/docs/content-listitem--docs)
43
- * @see [Design docs](https://wise.design/components/list-item)
43
+ * @see [Design docs](https://docs.wise.design/components/list-item)
44
44
  * @see [Release notes](https://transferwise.atlassian.net/wiki/spaces/DS/pages/3647251055/List+Item+release+notes)
45
45
  */
46
46
  const ActionOption = ({
@@ -12,7 +12,7 @@ Given the `Button` is a widely used and highly sensitive component, there are so
12
12
  <ListItem
13
13
  title="Design guidance"
14
14
  subtitle="Before you start, familiarise yourself with the dedicated accessibility documentation."
15
- control={<ListItem.Navigation href="https://wise.design/components/button#accessibility" />}
15
+ control={<ListItem.Navigation href="https://docs.wise.design/components/button#accessibility" />}
16
16
  media={
17
17
  <ListItem.AvatarView>
18
18
  <Bulb />
@@ -149,7 +149,7 @@ const getPropsForPreview = (args: PreviewStoryArgs) => {
149
149
  };
150
150
 
151
151
  /**
152
- * The stories below document the new Button API, which requires `v2` prop to function. <br />For more details please refer to the [release notes](https://transferwise.atlassian.net/wiki/spaces/DS/pages/3542158737/Button+Updates+New+sizes+Loader+and+Cue) and the [design spec](https://wise.design/components/button). <br />
152
+ * The stories below document the new Button API, which requires `v2` prop to function. <br />For more details please refer to the [release notes](https://transferwise.atlassian.net/wiki/spaces/DS/pages/3542158737/Button+Updates+New+sizes+Loader+and+Cue) and the [design spec](https://docs.wise.design/components/button). <br />
153
153
  * You can still find the old Button documentation under [Legacy Button](?path=/docs/actions-button-legacy--docs)
154
154
  *
155
155
  *
@@ -331,7 +331,7 @@ export const Sandbox = createSandboxStory({
331
331
  /**
332
332
  * There are two different types of button – default and negative – designed to emphasise the nature of the action. <br />
333
333
  * **NB:** Sentiment only applies to `primary` and `secondary` priorities. <br />
334
- * [Design documentation](https://wise.design/components/button#types)
334
+ * [Design documentation](https://docs.wise.design/components/button#types)
335
335
  */
336
336
  export const Sentiment: StoryObj<PreviewStoryArgs> = {
337
337
  render: function Render(args: PreviewStoryArgs) {
@@ -377,7 +377,7 @@ export const Sentiment: StoryObj<PreviewStoryArgs> = {
377
377
  /**
378
378
  * Priorities set a visual hierarchy amongst the buttons displayed on the
379
379
  * screen to help more important buttons to take precedence over others. <br />
380
- * [Design documentation](https://wise.design/components/button#priorities)
380
+ * [Design documentation](https://docs.wise.design/components/button#priorities)
381
381
  */
382
382
  export const Priority: StoryObj<PreviewStoryArgs> = {
383
383
  render: function Render(args: PreviewStoryArgs) {
@@ -413,7 +413,7 @@ export const Priority: StoryObj<PreviewStoryArgs> = {
413
413
 
414
414
  /**
415
415
  * There are three different button sizes – small (`sm`), medium (`md`) and large (`lg`) – each used for different purposes. <br />
416
- * [Design documentation](https://wise.design/components/button#sizes)
416
+ * [Design documentation](https://docs.wise.design/components/button#sizes)
417
417
  */
418
418
  export const Size: StoryObj<PreviewStoryArgs> = {
419
419
  render: function Render(args: PreviewStoryArgs) {
@@ -536,7 +536,7 @@ export const DisplayBlock: StoryObj<PreviewStoryArgs> = {
536
536
 
537
537
  /**
538
538
  * Icons are only supported for `sm` and `md` size Buttons. <br />
539
- * [Design documentation](https://wise.design/components/button#accessories)
539
+ * [Design documentation](https://docs.wise.design/components/button#accessories)
540
540
  */
541
541
  export const WithIcons: StoryObj<PreviewStoryArgs> = {
542
542
  render: function Render(args: PreviewStoryArgs) {
@@ -595,7 +595,7 @@ export const WithIcons: StoryObj<PreviewStoryArgs> = {
595
595
 
596
596
  /**
597
597
  * Avatars are only supported by the `md` size Buttons and are only allowed before the label. <br />
598
- * [Design documentation](https://wise.design/components/button#accessories)
598
+ * [Design documentation](https://docs.wise.design/components/button#accessories)
599
599
  */
600
600
  export const WithAvatars: StoryObj<PreviewStoryArgs> = {
601
601
  render: function Render(args: PreviewStoryArgs) {
@@ -0,0 +1,83 @@
1
+ .tw-date-lookup-calendar {
2
+ min-width: 300px;
3
+ text-align: center;
4
+ table-layout: fixed;
5
+ border: none;
6
+ background-color: inherit;
7
+ }
8
+ .tw-date-lookup-calendar thead {
9
+ background-color: transparent;
10
+ background-color: initial;
11
+ }
12
+ .tw-date-lookup-calendar > tbody > tr > td.weekend button {
13
+ color: #5d7079;
14
+ color: var(--color-content-secondary);
15
+ }
16
+ .tw-date-lookup-calendar > tbody > tr > td {
17
+ border: none;
18
+ padding: 4px;
19
+ padding: var(--size-4);
20
+ }
21
+ @media (max-width: 320px) {
22
+ .tw-date-lookup-calendar > tbody > tr > td {
23
+ padding: 0;
24
+ }
25
+ }
26
+ .tw-date-lookup-calendar > tbody > tr > td:has(.tw-date-lookup-day-option) {
27
+ padding: 1px;
28
+ }
29
+ .tw-date-lookup-calendar > tbody > tr > td button {
30
+ width: 100%;
31
+ padding: 4px 0;
32
+ padding: var(--size-4) 0;
33
+ color: #0097c7;
34
+ color: var(--color-content-accent);
35
+ border: transparent;
36
+ border-radius: 10px;
37
+ border-radius: var(--radius-small);
38
+ background-color: transparent;
39
+ font-weight: 600;
40
+ font-weight: var(--font-weight-semi-bold);
41
+ color: #37517e;
42
+ color: var(--color-content-primary);
43
+ }
44
+ @media (max-width: 320px) {
45
+ .tw-date-lookup-calendar > tbody > tr > td button {
46
+ padding: 0;
47
+ }
48
+ }
49
+ .tw-date-lookup-calendar > tbody > tr > td button.tw-date-lookup-day-option {
50
+ height: 40px;
51
+ height: var(--size-40);
52
+ border-radius: 9999px;
53
+ border-radius: var(--radius-full);
54
+ line-height: 40px;
55
+ line-height: var(--size-40);
56
+ width: 40px;
57
+ width: var(--size-40);
58
+ padding: 0;
59
+ display: inline-flex;
60
+ align-items: center;
61
+ justify-content: center;
62
+ }
63
+ .tw-date-lookup-calendar > tbody > tr > td button.tw-date-lookup-day-option.today {
64
+ -webkit-text-decoration: underline;
65
+ text-decoration: underline;
66
+ text-decoration-thickness: 2px;
67
+ text-underline-offset: 4px;
68
+ }
69
+ .tw-date-lookup-calendar > tbody > tr > td:not(.disabled):not(:disabled) button.show-focus,
70
+ .tw-date-lookup-calendar > tbody > tr > td:hover button:not(.disabled):not(:disabled) {
71
+ background-color: var(--color-background-screen-hover);
72
+ }
73
+ .tw-date-lookup-calendar > tbody > tr > td:not(.disabled):not(:disabled) button.active {
74
+ background-color: var(--color-interactive-primary);
75
+ color: var(--color-interactive-contrast);
76
+ }
77
+ .tw-date-lookup-calendar abbr {
78
+ -webkit-text-decoration: none;
79
+ text-decoration: none;
80
+ }
81
+ .tw-date-lookup-header-current-container {
82
+ display: inline;
83
+ }
@@ -0,0 +1,79 @@
1
+ @import (reference) "./../styles/variables/neptune-tokens.less";
2
+
3
+ .tw-date-lookup-calendar {
4
+ min-width: 300px;
5
+ text-align: center;
6
+ table-layout: fixed;
7
+ border: none;
8
+
9
+ thead {
10
+ background-color: unset;
11
+ }
12
+
13
+ > tbody > tr > td.weekend button {
14
+ color: var(--color-content-secondary);
15
+ }
16
+
17
+ > tbody > tr > td {
18
+ border: none;
19
+ padding: var(--size-4);
20
+ @media (--screen-400-zoom) {
21
+ padding: 0;
22
+ }
23
+
24
+ &:has(.tw-date-lookup-day-option) {
25
+ padding: 1px;
26
+ }
27
+
28
+ button {
29
+ width: 100%;
30
+ padding: var(--size-4) 0;
31
+ @media (--screen-400-zoom) {
32
+ padding: 0;
33
+ }
34
+ color: var(--color-content-accent);
35
+ border: transparent;
36
+ border-radius: var(--radius-small);
37
+ background-color: transparent;
38
+ font-weight: var(--font-weight-semi-bold);
39
+ color: var(--color-content-primary);
40
+
41
+ &.tw-date-lookup-day-option {
42
+ height: var(--size-40);
43
+ border-radius: var(--radius-full);
44
+ line-height: var(--size-40);
45
+ width: var(--size-40);
46
+ padding: 0;
47
+ display: inline-flex;
48
+ align-items: center;
49
+ justify-content: center;
50
+
51
+ &.today {
52
+ text-decoration: underline;
53
+ text-decoration-thickness: 2px;
54
+ text-underline-offset: 4px;
55
+ }
56
+ }
57
+ }
58
+
59
+ &:not(.disabled, :disabled) button.show-focus,
60
+ &:hover button:not(.disabled, :disabled) {
61
+ background-color: var(--color-background-screen-hover);
62
+ }
63
+
64
+ &:not(.disabled, :disabled) button.active {
65
+ background-color: var(--color-interactive-primary);
66
+ color: var(--color-interactive-contrast);
67
+ }
68
+ }
69
+
70
+ abbr {
71
+ text-decoration: none;
72
+ }
73
+
74
+ background-color: inherit;
75
+ }
76
+
77
+ .tw-date-lookup-header-current-container {
78
+ display: inline;
79
+ }
@@ -0,0 +1,92 @@
1
+ import { useState } from 'react';
2
+ import { StoryObj } from '@storybook/react-webpack5';
3
+ import { userEvent, within } from 'storybook/test';
4
+ import Calendar, { type CalendarProps } from './Calendar';
5
+ import Modal from '../modal';
6
+ import Button from '../button';
7
+
8
+ /** Inline calendar for selecting a single date, with optional min/max bounds. */
9
+ export default {
10
+ component: Calendar,
11
+ title: 'Forms/Calendar',
12
+ decorators: [
13
+ (Story: React.ComponentType) => (
14
+ <div style={{ maxWidth: 500, margin: '0 auto' }}>
15
+ <Story />
16
+ </div>
17
+ ),
18
+ ],
19
+ argTypes: {
20
+ monthFormat: { control: 'select', options: ['long', 'short'] },
21
+ min: { control: 'date' },
22
+ max: { control: 'date' },
23
+ },
24
+ };
25
+
26
+ type Story = StoryObj<typeof Calendar>;
27
+
28
+ const epoch = new Date('2011-01-01');
29
+ const theFuture = new Date(epoch);
30
+ theFuture.setUTCDate(epoch.getUTCDate() + 10);
31
+ const thePast = new Date(epoch);
32
+ thePast.setUTCDate(epoch.getUTCDate() - 10);
33
+
34
+ export const Basic: Story = {
35
+ render: (args: CalendarProps) => {
36
+ const [value, setValue] = useState<Date | null>(epoch);
37
+ return (
38
+ <Calendar
39
+ {...args}
40
+ min={args.min ? new Date(args.min) : thePast}
41
+ max={args.max ? new Date(args.max) : theFuture}
42
+ value={value}
43
+ onChange={(v) => setValue(v)}
44
+ />
45
+ );
46
+ },
47
+ args: {
48
+ monthFormat: 'long',
49
+ min: thePast,
50
+ max: theFuture,
51
+ },
52
+ };
53
+
54
+ export const WithoutConstraints: Story = {
55
+ render: () => {
56
+ const [value, setValue] = useState<Date | null>(epoch);
57
+ return <Calendar value={value} onChange={(v) => setValue(v)} />;
58
+ },
59
+ };
60
+
61
+ export const NullValue: Story = {
62
+ render: () => {
63
+ const [value, setValue] = useState<Date | null>(null);
64
+ return <Calendar value={value} min={thePast} max={theFuture} onChange={(v) => setValue(v)} />;
65
+ },
66
+ };
67
+
68
+ export const InsideModal: Story = {
69
+ render: () => {
70
+ const [open, setOpen] = useState(false);
71
+ const [value, setValue] = useState<Date | null>(epoch);
72
+ return (
73
+ <>
74
+ <Button size="sm" v2 type="button" onClick={() => setOpen(true)}>
75
+ Open modal
76
+ </Button>
77
+ <Modal
78
+ open={open}
79
+ title="Select a date"
80
+ body={
81
+ <Calendar value={value} min={thePast} max={theFuture} onChange={(v) => setValue(v)} />
82
+ }
83
+ onClose={() => setOpen(false)}
84
+ />
85
+ </>
86
+ );
87
+ },
88
+ play: async ({ canvasElement }) => {
89
+ const canvas = within(canvasElement);
90
+ await userEvent.click(canvas.getByRole('button', { name: 'Open modal' }));
91
+ },
92
+ };
@@ -0,0 +1,138 @@
1
+ import { mockMatchMedia, render, screen, userEvent } from '../test-utils';
2
+ import Calendar from './Calendar';
3
+
4
+ mockMatchMedia();
5
+
6
+ const user = userEvent.setup();
7
+
8
+ const initialValue = new Date(2000, 0, 1);
9
+
10
+ describe('Calendar', () => {
11
+ describe('in day view', () => {
12
+ it.each([
13
+ ['{ArrowLeft}', -1],
14
+ ['{ArrowRight}', +1],
15
+ ['{ArrowUp}', -7],
16
+ ['{ArrowDown}', +7],
17
+ ])("handles '%s' to step %d day(s)", async (text: string, step: number) => {
18
+ const handleChange = jest.fn();
19
+ render(<Calendar value={initialValue} onChange={handleChange} />);
20
+
21
+ await user.click(screen.getByRole('button', { name: /selected day/iu }));
22
+ await user.keyboard(text);
23
+
24
+ const expected = new Date(initialValue);
25
+ expected.setDate(initialValue.getDate() + step);
26
+ expect(handleChange).toHaveBeenCalledWith(expected);
27
+ });
28
+
29
+ it('selects a day on click', async () => {
30
+ const handleChange = jest.fn();
31
+ render(<Calendar value={initialValue} onChange={handleChange} />);
32
+
33
+ await user.click(screen.getByText('15'));
34
+
35
+ expect(handleChange).toHaveBeenCalledWith(new Date(2000, 0, 15));
36
+ });
37
+
38
+ it('calls onSelect instead of onChange when clicking a day', async () => {
39
+ const handleChange = jest.fn();
40
+ const handleSelect = jest.fn();
41
+ render(<Calendar value={initialValue} onChange={handleChange} onSelect={handleSelect} />);
42
+
43
+ await user.click(screen.getByText('15'));
44
+
45
+ expect(handleSelect).toHaveBeenCalledWith(new Date(2000, 0, 15));
46
+ expect(handleChange).not.toHaveBeenCalled();
47
+ });
48
+ });
49
+
50
+ describe('in year view', () => {
51
+ it.each([
52
+ ['{ArrowLeft}', -1],
53
+ ['{ArrowRight}', +1],
54
+ ['{ArrowUp}', -4],
55
+ ['{ArrowDown}', +4],
56
+ ])("handles '%s' to step %d year(s)", async (text: string, step: number) => {
57
+ const handleChange = jest.fn();
58
+ render(<Calendar value={initialValue} onChange={handleChange} />);
59
+
60
+ await user.click(screen.getByRole('button', { name: /year view/iu }));
61
+ await user.keyboard(text);
62
+
63
+ const expected = new Date(initialValue);
64
+ expected.setFullYear(initialValue.getFullYear() + step);
65
+ expect(handleChange).toHaveBeenCalledWith(expected);
66
+ });
67
+ });
68
+
69
+ describe('in month view', () => {
70
+ it.each([
71
+ ['{ArrowLeft}', -1],
72
+ ['{ArrowRight}', +1],
73
+ ['{ArrowUp}', -4],
74
+ ['{ArrowDown}', +4],
75
+ ])("handles '%s' to step %d month(s)", async (text: string, step: number) => {
76
+ const handleChange = jest.fn();
77
+ render(<Calendar value={initialValue} onChange={handleChange} />);
78
+
79
+ await user.click(screen.getByRole('button', { name: /year view/iu }));
80
+ await user.keyboard(' ');
81
+ await user.keyboard(text);
82
+
83
+ const expected = new Date(initialValue);
84
+ expected.setMonth(initialValue.getMonth() + step);
85
+ expect(handleChange).toHaveBeenCalledWith(expected);
86
+ });
87
+ });
88
+
89
+ describe('min/max clamping', () => {
90
+ it('limits navigation to min value', async () => {
91
+ const min = new Date(initialValue);
92
+ min.setDate(min.getDate() - 1);
93
+ const handleChange = jest.fn();
94
+ render(<Calendar value={initialValue} min={min} onChange={handleChange} />);
95
+
96
+ await user.click(screen.getByRole('button', { name: /selected day/iu }));
97
+ await user.keyboard('{ArrowLeft}{ArrowLeft}');
98
+
99
+ expect(handleChange).toHaveBeenLastCalledWith(min);
100
+ });
101
+
102
+ it('limits navigation to max value', async () => {
103
+ const max = new Date(initialValue);
104
+ max.setDate(max.getDate() + 1);
105
+ const handleChange = jest.fn();
106
+ render(<Calendar value={initialValue} max={max} onChange={handleChange} />);
107
+
108
+ await user.click(screen.getByRole('button', { name: /selected day/iu }));
109
+ await user.keyboard('{ArrowRight}{ArrowRight}');
110
+
111
+ expect(handleChange).toHaveBeenLastCalledWith(max);
112
+ });
113
+
114
+ it('clamps value to range when value is outside min/max', () => {
115
+ const min = new Date(2000, 0, 5);
116
+ const max = new Date(2000, 0, 20);
117
+ const handleChange = jest.fn();
118
+ render(<Calendar value={initialValue} min={min} max={max} onChange={handleChange} />);
119
+
120
+ expect(handleChange).toHaveBeenCalledWith(min);
121
+ });
122
+ });
123
+
124
+ describe('view switching', () => {
125
+ it('switches to year view and back to day view', async () => {
126
+ render(<Calendar value={initialValue} onChange={jest.fn()} />);
127
+
128
+ await user.click(screen.getByRole('button', { name: /year view/iu }));
129
+ expect(screen.getByRole('button', { name: /selected year/iu })).toBeInTheDocument();
130
+
131
+ await user.click(screen.getByRole('button', { name: /selected year/iu }));
132
+ expect(screen.getByRole('button', { name: /selected month/iu })).toBeInTheDocument();
133
+
134
+ await user.click(screen.getByRole('button', { name: /selected month/iu }));
135
+ expect(screen.getByRole('button', { name: /next month/iu })).toBeInTheDocument();
136
+ });
137
+ });
138
+ });