@qite/tide-booking-component 1.4.17 → 1.4.19

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 (396) hide show
  1. package/.husky/pre-commit +2 -0
  2. package/.prettierrc +9 -0
  3. package/README.md +9 -2
  4. package/package.json +7 -4
  5. package/rollup.config.js +11 -18
  6. package/src/booking-product/components/age-select.tsx +4 -4
  7. package/src/booking-product/components/amount-input.tsx +11 -38
  8. package/src/booking-product/components/date-range-picker/calendar-day.tsx +12 -25
  9. package/src/booking-product/components/date-range-picker/calendar.tsx +20 -43
  10. package/src/booking-product/components/date-range-picker/index.tsx +12 -36
  11. package/src/booking-product/components/dates.tsx +31 -42
  12. package/src/booking-product/components/footer.tsx +11 -26
  13. package/src/booking-product/components/header.tsx +10 -32
  14. package/src/booking-product/components/icon.tsx +45 -96
  15. package/src/booking-product/components/product.tsx +57 -144
  16. package/src/booking-product/components/rating.tsx +3 -3
  17. package/src/booking-product/components/rooms.tsx +21 -49
  18. package/src/booking-product/index.tsx +6 -15
  19. package/src/booking-product/settings-context.ts +5 -5
  20. package/src/booking-product/utils/api.ts +5 -10
  21. package/src/booking-product/utils/price.ts +3 -6
  22. package/src/booking-wizard/api-settings-slice.ts +7 -7
  23. package/src/booking-wizard/components/icon.tsx +72 -182
  24. package/src/booking-wizard/components/labeled-input.tsx +7 -15
  25. package/src/booking-wizard/components/labeled-select.tsx +8 -23
  26. package/src/booking-wizard/components/message.tsx +8 -21
  27. package/src/booking-wizard/components/multi-range-filter.tsx +6 -20
  28. package/src/booking-wizard/components/phone-input.tsx +25 -60
  29. package/src/booking-wizard/components/print-offer-button.tsx +10 -20
  30. package/src/booking-wizard/components/product-card.tsx +4 -18
  31. package/src/booking-wizard/components/step-indicator.tsx +10 -13
  32. package/src/booking-wizard/components/step-route.tsx +2 -2
  33. package/src/booking-wizard/declarations.d.ts +1 -1
  34. package/src/booking-wizard/features/booking/api.ts +8 -19
  35. package/src/booking-wizard/features/booking/booking-self-contained.tsx +60 -153
  36. package/src/booking-wizard/features/booking/booking-slice.ts +171 -267
  37. package/src/booking-wizard/features/booking/booking.tsx +62 -145
  38. package/src/booking-wizard/features/booking/selectors.ts +139 -253
  39. package/src/booking-wizard/features/confirmation/confirmation.tsx +18 -37
  40. package/src/booking-wizard/features/error/error.tsx +12 -23
  41. package/src/booking-wizard/features/flight-options/flight-filter.tsx +61 -122
  42. package/src/booking-wizard/features/flight-options/flight-option-flight.tsx +16 -47
  43. package/src/booking-wizard/features/flight-options/flight-option-modal.tsx +12 -30
  44. package/src/booking-wizard/features/flight-options/flight-option.tsx +13 -38
  45. package/src/booking-wizard/features/flight-options/flight-utils.ts +74 -173
  46. package/src/booking-wizard/features/flight-options/index.tsx +34 -89
  47. package/src/booking-wizard/features/price-details/price-details-api.ts +5 -9
  48. package/src/booking-wizard/features/price-details/price-details-slice.ts +60 -120
  49. package/src/booking-wizard/features/price-details/util.ts +29 -69
  50. package/src/booking-wizard/features/product-options/no-options.tsx +5 -8
  51. package/src/booking-wizard/features/product-options/none-option.tsx +16 -64
  52. package/src/booking-wizard/features/product-options/option-booking-airline-group.tsx +12 -23
  53. package/src/booking-wizard/features/product-options/option-booking-group.tsx +37 -101
  54. package/src/booking-wizard/features/product-options/option-item.tsx +47 -132
  55. package/src/booking-wizard/features/product-options/option-pax-card.tsx +24 -66
  56. package/src/booking-wizard/features/product-options/option-pax-group.tsx +29 -82
  57. package/src/booking-wizard/features/product-options/option-room.tsx +53 -157
  58. package/src/booking-wizard/features/product-options/option-unit-group.tsx +33 -93
  59. package/src/booking-wizard/features/product-options/option-units-card.tsx +23 -60
  60. package/src/booking-wizard/features/product-options/options-form.tsx +65 -179
  61. package/src/booking-wizard/features/room-options/index.tsx +30 -86
  62. package/src/booking-wizard/features/room-options/room-utils.ts +26 -65
  63. package/src/booking-wizard/features/room-options/room.tsx +20 -58
  64. package/src/booking-wizard/features/room-options/traveler-rooms.tsx +10 -21
  65. package/src/booking-wizard/features/sidebar/index.tsx +17 -29
  66. package/src/booking-wizard/features/sidebar/sidebar-flight.tsx +13 -24
  67. package/src/booking-wizard/features/sidebar/sidebar-util.ts +52 -95
  68. package/src/booking-wizard/features/sidebar/sidebar.tsx +52 -167
  69. package/src/booking-wizard/features/summary/summary-booking-option-pax.tsx +5 -7
  70. package/src/booking-wizard/features/summary/summary-booking-option-unit.tsx +5 -7
  71. package/src/booking-wizard/features/summary/summary-flight.tsx +11 -19
  72. package/src/booking-wizard/features/summary/summary-per-booking-option-group.tsx +11 -20
  73. package/src/booking-wizard/features/summary/summary-per-pax-option-group.tsx +7 -14
  74. package/src/booking-wizard/features/summary/summary-per-unit-option-group.tsx +9 -17
  75. package/src/booking-wizard/features/summary/summary-slice.ts +7 -8
  76. package/src/booking-wizard/features/summary/summary.tsx +105 -315
  77. package/src/booking-wizard/features/travelers-form/controls/gender-control.tsx +10 -22
  78. package/src/booking-wizard/features/travelers-form/travelers-form-slice.ts +44 -52
  79. package/src/booking-wizard/features/travelers-form/travelers-form-util.ts +2 -3
  80. package/src/booking-wizard/features/travelers-form/travelers-form.tsx +176 -371
  81. package/src/booking-wizard/features/travelers-form/type-ahead-input.tsx +8 -24
  82. package/src/booking-wizard/features/travelers-form/validate-form.ts +50 -165
  83. package/src/booking-wizard/index.tsx +8 -17
  84. package/src/booking-wizard/settings-context.ts +22 -22
  85. package/src/booking-wizard/store.ts +10 -15
  86. package/src/booking-wizard/types.ts +3 -1
  87. package/src/booking-wizard/use-offer-printer.ts +24 -33
  88. package/src/content/components/LanguageSwitcher.tsx +158 -0
  89. package/src/content/components/breadcrumb.tsx +70 -0
  90. package/src/content/components/contact.tsx +211 -0
  91. package/src/content/components/footer.tsx +191 -0
  92. package/src/content/components/gallery.tsx +145 -0
  93. package/src/content/components/header.tsx +69 -0
  94. package/src/content/components/icon.tsx +695 -0
  95. package/src/content/components/image-with-text.tsx +118 -0
  96. package/src/content/components/personal-contact-form.tsx +809 -0
  97. package/src/content/components/slider.tsx +237 -0
  98. package/src/content/features/content-page/content-page-self-contained.tsx +815 -0
  99. package/src/content/navbar/index.tsx +303 -0
  100. package/src/content/navbar/placeholderData.tsx +162 -0
  101. package/src/content/navbar/types.ts +34 -0
  102. package/src/index.ts +6 -3
  103. package/src/qsm/components/QSMContainer/qsm-container.tsx +171 -0
  104. package/src/qsm/components/date-picker/index.tsx +152 -0
  105. package/src/qsm/components/date-range-picker/calendar-day.tsx +49 -0
  106. package/src/qsm/components/date-range-picker/calendar.tsx +211 -0
  107. package/src/qsm/components/date-range-picker/index.tsx +404 -0
  108. package/src/qsm/components/double-search-input-group/index.tsx +139 -0
  109. package/src/qsm/components/icon.tsx +338 -0
  110. package/src/qsm/components/item-picker/index.tsx +77 -0
  111. package/src/qsm/components/mobile-filter-modal/index.tsx +247 -0
  112. package/src/qsm/components/search-input/index.tsx +62 -0
  113. package/src/qsm/components/search-input-group/index.tsx +163 -0
  114. package/src/qsm/components/travel-class-picker/index.tsx +24 -0
  115. package/src/qsm/components/travel-input/index.tsx +237 -0
  116. package/src/qsm/components/travel-input-group/index.tsx +96 -0
  117. package/src/qsm/components/travel-type-picker/index.tsx +24 -0
  118. package/src/qsm/index.tsx +26 -0
  119. package/src/qsm/qsm-configuration-context.ts +39 -0
  120. package/src/qsm/store/qsm-slice.ts +262 -0
  121. package/src/qsm/store/qsm-store.ts +13 -0
  122. package/src/qsm/types.ts +123 -0
  123. package/src/search-results/components/filters/filters.tsx +388 -0
  124. package/src/search-results/components/filters/utility.tsx +20 -0
  125. package/src/search-results/components/flight/flight-accommodation-results.tsx +582 -0
  126. package/src/search-results/components/flight/flight-banner.tsx +35 -0
  127. package/src/search-results/components/flight/flight-card.tsx +38 -0
  128. package/src/search-results/components/flight/flight-leg.tsx +61 -0
  129. package/src/search-results/components/flight/flight-path.tsx +23 -0
  130. package/src/search-results/components/flight/flight-results.tsx +1137 -0
  131. package/src/search-results/components/hotel/hotel-accommodation-results.tsx +114 -0
  132. package/src/search-results/components/hotel/hotel-card.tsx +42 -0
  133. package/src/search-results/components/icon.tsx +609 -0
  134. package/src/search-results/components/item-picker/index.tsx +77 -0
  135. package/src/search-results/components/itinerary/index.tsx +208 -0
  136. package/src/search-results/components/multi-range-filter.tsx +104 -0
  137. package/src/search-results/components/round-trip/round-trip-results.tsx +175 -0
  138. package/src/search-results/components/search-results-container/search-results-container.tsx +342 -0
  139. package/src/search-results/components/spinner/spinner.tsx +14 -0
  140. package/src/search-results/components/tab-views/index.tsx +25 -0
  141. package/src/search-results/features/flight-options/flight-filter.tsx +371 -0
  142. package/src/search-results/features/flight-options/flight-option-flight.tsx +354 -0
  143. package/src/search-results/features/flight-options/flight-option-modal.tsx +211 -0
  144. package/src/search-results/features/flight-options/flight-option.tsx +56 -0
  145. package/src/search-results/features/flight-options/flight-utils.ts +417 -0
  146. package/src/search-results/features/flight-options/index.tsx +141 -0
  147. package/src/search-results/features/flights/flight-search-results-self-contained.tsx +301 -0
  148. package/src/search-results/features/hotels/hotel-flight-search-results-self-contained.tsx +128 -0
  149. package/src/search-results/features/hotels/hotel-search-results-self-contained.tsx +227 -0
  150. package/src/search-results/features/roundtrips/roundtrip-search-results-self-contained.tsx +51 -0
  151. package/src/search-results/index.tsx +24 -0
  152. package/src/search-results/search-results-configuration-context.ts +6 -0
  153. package/src/search-results/store/search-results-slice.ts +63 -0
  154. package/src/search-results/store/search-results-store.ts +13 -0
  155. package/src/search-results/types.ts +161 -0
  156. package/src/shared/components/loader.tsx +1 -1
  157. package/src/shared/utils/class-util.ts +3 -5
  158. package/src/shared/utils/localization-util.ts +37 -28
  159. package/src/shared/utils/query-string-util.ts +20 -48
  160. package/src/shared/utils/tide-api-utils.ts +9 -11
  161. package/src/shared/utils/use-media-query-util.ts +19 -0
  162. package/styles/abstracts/_mixins.scss +74 -0
  163. package/styles/abstracts/_variables.scss +57 -0
  164. package/styles/base/_fonts.scss +2 -0
  165. package/styles/base/_normalize.scss +227 -0
  166. package/styles/base/_typography.scss +35 -0
  167. package/styles/booking-joker-variables.scss +596 -0
  168. package/styles/booking-product-variables.scss +69 -133
  169. package/styles/booking-product.scss +16 -24
  170. package/styles/booking-qsm-variables.scss +501 -0
  171. package/styles/booking-qsm.scss +52 -0
  172. package/styles/booking-search-results-variables.scss +728 -0
  173. package/styles/booking-search-results.scss +51 -0
  174. package/styles/booking-wizard-variables.scss +152 -422
  175. package/styles/booking-wizard.scss +24 -23
  176. package/styles/components/_booking.scss +23 -30
  177. package/styles/components/_breadcrumb.scss +75 -0
  178. package/styles/components/_button.scss +9 -9
  179. package/styles/components/_checkbox.scss +28 -17
  180. package/styles/components/_contact.scss +239 -0
  181. package/styles/components/_content.scss +467 -0
  182. package/styles/components/_cta.scss +40 -10
  183. package/styles/components/_date-list.scss +1 -1
  184. package/styles/components/_date-range-picker.scss +1 -3
  185. package/styles/components/_dropdown.scss +1 -1
  186. package/styles/components/_flight-option.scss +54 -64
  187. package/styles/components/_form.scss +4 -8
  188. package/styles/components/_gallery.scss +314 -0
  189. package/styles/components/_header.scss +113 -0
  190. package/styles/components/_image-with-text.scss +209 -0
  191. package/styles/components/_img-slider.scss +175 -0
  192. package/styles/components/_info-message.scss +4 -0
  193. package/styles/components/_input.scss +12 -2
  194. package/styles/components/_list.scss +4 -6
  195. package/styles/components/_loader.scss +3 -5
  196. package/styles/components/_mixins.scss +41 -12
  197. package/styles/components/_navbar.scss +740 -0
  198. package/styles/components/_passenger-picker.scss +305 -0
  199. package/styles/components/_placeholders.scss +3 -4
  200. package/styles/components/_pricing-summary.scss +1 -2
  201. package/styles/components/_radiobutton.scss +7 -7
  202. package/styles/components/_search.scss +2317 -0
  203. package/styles/components/_select-wrapper.scss +10 -14
  204. package/styles/components/_slider.scss +128 -0
  205. package/styles/components/_step-indicators.scss +9 -17
  206. package/styles/components/_tree.scss +151 -29
  207. package/styles/components/_typeahead.scss +3 -9
  208. package/styles/components/_variables.scss +3 -3
  209. package/styles/content-blocks-variables.scss +507 -0
  210. package/styles/content-blocks.scss +58 -0
  211. package/styles/font.scss +2 -0
  212. package/styles/qsm/_calendar.scss +274 -0
  213. package/styles/qsm/_qsm.scss +1033 -0
  214. package/styles/search.scss +1200 -0
  215. package/build/build-cjs/booking-product/components/age-select.d.ts +0 -8
  216. package/build/build-cjs/booking-product/components/amount-input.d.ts +0 -10
  217. package/build/build-cjs/booking-product/components/date-range-picker/calendar-day.d.ts +0 -12
  218. package/build/build-cjs/booking-product/components/date-range-picker/calendar.d.ts +0 -19
  219. package/build/build-cjs/booking-product/components/date-range-picker/index.d.ts +0 -20
  220. package/build/build-cjs/booking-product/components/dates.d.ts +0 -9
  221. package/build/build-cjs/booking-product/components/footer.d.ts +0 -10
  222. package/build/build-cjs/booking-product/components/header.d.ts +0 -11
  223. package/build/build-cjs/booking-product/components/icon.d.ts +0 -10
  224. package/build/build-cjs/booking-product/components/product.d.ts +0 -9
  225. package/build/build-cjs/booking-product/components/rating.d.ts +0 -6
  226. package/build/build-cjs/booking-product/components/rooms.d.ts +0 -10
  227. package/build/build-cjs/booking-product/index.d.ts +0 -10
  228. package/build/build-cjs/booking-product/settings-context.d.ts +0 -5
  229. package/build/build-cjs/booking-product/types.d.ts +0 -25
  230. package/build/build-cjs/booking-product/utils/api.d.ts +0 -16
  231. package/build/build-cjs/booking-product/utils/price.d.ts +0 -10
  232. package/build/build-cjs/booking-wizard/api-settings-slice.d.ts +0 -14
  233. package/build/build-cjs/booking-wizard/components/icon.d.ts +0 -10
  234. package/build/build-cjs/booking-wizard/components/labeled-input.d.ts +0 -18
  235. package/build/build-cjs/booking-wizard/components/labeled-select.d.ts +0 -21
  236. package/build/build-cjs/booking-wizard/components/message.d.ts +0 -9
  237. package/build/build-cjs/booking-wizard/components/multi-range-filter.d.ts +0 -11
  238. package/build/build-cjs/booking-wizard/components/phone-input.d.ts +0 -17
  239. package/build/build-cjs/booking-wizard/components/print-offer-button.d.ts +0 -17
  240. package/build/build-cjs/booking-wizard/components/product-card.d.ts +0 -8
  241. package/build/build-cjs/booking-wizard/components/step-indicator.d.ts +0 -6
  242. package/build/build-cjs/booking-wizard/components/step-route.d.ts +0 -9
  243. package/build/build-cjs/booking-wizard/features/booking/api.d.ts +0 -29
  244. package/build/build-cjs/booking-wizard/features/booking/booking-self-contained.d.ts +0 -8
  245. package/build/build-cjs/booking-wizard/features/booking/booking-slice.d.ts +0 -182
  246. package/build/build-cjs/booking-wizard/features/booking/booking.d.ts +0 -8
  247. package/build/build-cjs/booking-wizard/features/booking/constants.d.ts +0 -15
  248. package/build/build-cjs/booking-wizard/features/booking/selectors.d.ts +0 -391
  249. package/build/build-cjs/booking-wizard/features/confirmation/confirmation.d.ts +0 -4
  250. package/build/build-cjs/booking-wizard/features/error/error.d.ts +0 -4
  251. package/build/build-cjs/booking-wizard/features/flight-options/flight-filter.d.ts +0 -9
  252. package/build/build-cjs/booking-wizard/features/flight-options/flight-option-flight.d.ts +0 -8
  253. package/build/build-cjs/booking-wizard/features/flight-options/flight-option-modal.d.ts +0 -3
  254. package/build/build-cjs/booking-wizard/features/flight-options/flight-option.d.ts +0 -10
  255. package/build/build-cjs/booking-wizard/features/flight-options/flight-utils.d.ts +0 -16
  256. package/build/build-cjs/booking-wizard/features/flight-options/index.d.ts +0 -4
  257. package/build/build-cjs/booking-wizard/features/price-details/price-details-api.d.ts +0 -15
  258. package/build/build-cjs/booking-wizard/features/price-details/price-details-slice.d.ts +0 -121
  259. package/build/build-cjs/booking-wizard/features/price-details/util.d.ts +0 -5
  260. package/build/build-cjs/booking-wizard/features/product-options/no-options.d.ts +0 -3
  261. package/build/build-cjs/booking-wizard/features/product-options/none-option.d.ts +0 -17
  262. package/build/build-cjs/booking-wizard/features/product-options/option-booking-airline-group.d.ts +0 -17
  263. package/build/build-cjs/booking-wizard/features/product-options/option-booking-group.d.ts +0 -18
  264. package/build/build-cjs/booking-wizard/features/product-options/option-item.d.ts +0 -11
  265. package/build/build-cjs/booking-wizard/features/product-options/option-pax-card.d.ts +0 -13
  266. package/build/build-cjs/booking-wizard/features/product-options/option-pax-group.d.ts +0 -20
  267. package/build/build-cjs/booking-wizard/features/product-options/option-room.d.ts +0 -19
  268. package/build/build-cjs/booking-wizard/features/product-options/option-unit-group.d.ts +0 -20
  269. package/build/build-cjs/booking-wizard/features/product-options/option-units-card.d.ts +0 -9
  270. package/build/build-cjs/booking-wizard/features/product-options/options-form.d.ts +0 -4
  271. package/build/build-cjs/booking-wizard/features/room-options/index.d.ts +0 -4
  272. package/build/build-cjs/booking-wizard/features/room-options/room-utils.d.ts +0 -29
  273. package/build/build-cjs/booking-wizard/features/room-options/room.d.ts +0 -15
  274. package/build/build-cjs/booking-wizard/features/room-options/traveler-rooms.d.ts +0 -13
  275. package/build/build-cjs/booking-wizard/features/sidebar/index.d.ts +0 -7
  276. package/build/build-cjs/booking-wizard/features/sidebar/sidebar-flight.d.ts +0 -8
  277. package/build/build-cjs/booking-wizard/features/sidebar/sidebar-util.d.ts +0 -31
  278. package/build/build-cjs/booking-wizard/features/sidebar/sidebar.d.ts +0 -30
  279. package/build/build-cjs/booking-wizard/features/summary/summary-booking-option-pax.d.ts +0 -7
  280. package/build/build-cjs/booking-wizard/features/summary/summary-booking-option-unit.d.ts +0 -7
  281. package/build/build-cjs/booking-wizard/features/summary/summary-flight.d.ts +0 -8
  282. package/build/build-cjs/booking-wizard/features/summary/summary-per-booking-option-group.d.ts +0 -10
  283. package/build/build-cjs/booking-wizard/features/summary/summary-per-pax-option-group.d.ts +0 -10
  284. package/build/build-cjs/booking-wizard/features/summary/summary-per-unit-option-group.d.ts +0 -10
  285. package/build/build-cjs/booking-wizard/features/summary/summary-slice.d.ts +0 -14
  286. package/build/build-cjs/booking-wizard/features/summary/summary.d.ts +0 -4
  287. package/build/build-cjs/booking-wizard/features/travelers-form/controls/gender-control.d.ts +0 -5
  288. package/build/build-cjs/booking-wizard/features/travelers-form/travelers-form-slice.d.ts +0 -75
  289. package/build/build-cjs/booking-wizard/features/travelers-form/travelers-form-util.d.ts +0 -7
  290. package/build/build-cjs/booking-wizard/features/travelers-form/travelers-form.d.ts +0 -4
  291. package/build/build-cjs/booking-wizard/features/travelers-form/type-ahead-input.d.ts +0 -16
  292. package/build/build-cjs/booking-wizard/features/travelers-form/validate-form.d.ts +0 -11
  293. package/build/build-cjs/booking-wizard/index.d.ts +0 -12
  294. package/build/build-cjs/booking-wizard/settings-context.d.ts +0 -5
  295. package/build/build-cjs/booking-wizard/store.d.ts +0 -44
  296. package/build/build-cjs/booking-wizard/types.d.ts +0 -281
  297. package/build/build-cjs/booking-wizard/use-offer-printer.d.ts +0 -19
  298. package/build/build-cjs/index.d.ts +0 -3
  299. package/build/build-cjs/index.js +0 -25632
  300. package/build/build-cjs/shared/components/loader.d.ts +0 -6
  301. package/build/build-cjs/shared/types.d.ts +0 -4
  302. package/build/build-cjs/shared/utils/class-util.d.ts +0 -1
  303. package/build/build-cjs/shared/utils/localization-util.d.ts +0 -265
  304. package/build/build-cjs/shared/utils/query-string-util.d.ts +0 -29
  305. package/build/build-cjs/shared/utils/tide-api-utils.d.ts +0 -6
  306. package/build/build-esm/booking-product/components/age-select.d.ts +0 -8
  307. package/build/build-esm/booking-product/components/amount-input.d.ts +0 -10
  308. package/build/build-esm/booking-product/components/date-range-picker/calendar-day.d.ts +0 -12
  309. package/build/build-esm/booking-product/components/date-range-picker/calendar.d.ts +0 -19
  310. package/build/build-esm/booking-product/components/date-range-picker/index.d.ts +0 -20
  311. package/build/build-esm/booking-product/components/dates.d.ts +0 -9
  312. package/build/build-esm/booking-product/components/footer.d.ts +0 -10
  313. package/build/build-esm/booking-product/components/header.d.ts +0 -11
  314. package/build/build-esm/booking-product/components/icon.d.ts +0 -10
  315. package/build/build-esm/booking-product/components/product.d.ts +0 -9
  316. package/build/build-esm/booking-product/components/rating.d.ts +0 -6
  317. package/build/build-esm/booking-product/components/rooms.d.ts +0 -10
  318. package/build/build-esm/booking-product/index.d.ts +0 -10
  319. package/build/build-esm/booking-product/settings-context.d.ts +0 -5
  320. package/build/build-esm/booking-product/types.d.ts +0 -25
  321. package/build/build-esm/booking-product/utils/api.d.ts +0 -16
  322. package/build/build-esm/booking-product/utils/price.d.ts +0 -10
  323. package/build/build-esm/booking-wizard/api-settings-slice.d.ts +0 -14
  324. package/build/build-esm/booking-wizard/components/icon.d.ts +0 -10
  325. package/build/build-esm/booking-wizard/components/labeled-input.d.ts +0 -18
  326. package/build/build-esm/booking-wizard/components/labeled-select.d.ts +0 -21
  327. package/build/build-esm/booking-wizard/components/message.d.ts +0 -9
  328. package/build/build-esm/booking-wizard/components/multi-range-filter.d.ts +0 -11
  329. package/build/build-esm/booking-wizard/components/phone-input.d.ts +0 -17
  330. package/build/build-esm/booking-wizard/components/print-offer-button.d.ts +0 -17
  331. package/build/build-esm/booking-wizard/components/product-card.d.ts +0 -8
  332. package/build/build-esm/booking-wizard/components/step-indicator.d.ts +0 -6
  333. package/build/build-esm/booking-wizard/components/step-route.d.ts +0 -9
  334. package/build/build-esm/booking-wizard/features/booking/api.d.ts +0 -29
  335. package/build/build-esm/booking-wizard/features/booking/booking-self-contained.d.ts +0 -8
  336. package/build/build-esm/booking-wizard/features/booking/booking-slice.d.ts +0 -182
  337. package/build/build-esm/booking-wizard/features/booking/booking.d.ts +0 -8
  338. package/build/build-esm/booking-wizard/features/booking/constants.d.ts +0 -15
  339. package/build/build-esm/booking-wizard/features/booking/selectors.d.ts +0 -391
  340. package/build/build-esm/booking-wizard/features/confirmation/confirmation.d.ts +0 -4
  341. package/build/build-esm/booking-wizard/features/error/error.d.ts +0 -4
  342. package/build/build-esm/booking-wizard/features/flight-options/flight-filter.d.ts +0 -9
  343. package/build/build-esm/booking-wizard/features/flight-options/flight-option-flight.d.ts +0 -8
  344. package/build/build-esm/booking-wizard/features/flight-options/flight-option-modal.d.ts +0 -3
  345. package/build/build-esm/booking-wizard/features/flight-options/flight-option.d.ts +0 -10
  346. package/build/build-esm/booking-wizard/features/flight-options/flight-utils.d.ts +0 -16
  347. package/build/build-esm/booking-wizard/features/flight-options/index.d.ts +0 -4
  348. package/build/build-esm/booking-wizard/features/price-details/price-details-api.d.ts +0 -15
  349. package/build/build-esm/booking-wizard/features/price-details/price-details-slice.d.ts +0 -121
  350. package/build/build-esm/booking-wizard/features/price-details/util.d.ts +0 -5
  351. package/build/build-esm/booking-wizard/features/product-options/no-options.d.ts +0 -3
  352. package/build/build-esm/booking-wizard/features/product-options/none-option.d.ts +0 -17
  353. package/build/build-esm/booking-wizard/features/product-options/option-booking-airline-group.d.ts +0 -17
  354. package/build/build-esm/booking-wizard/features/product-options/option-booking-group.d.ts +0 -18
  355. package/build/build-esm/booking-wizard/features/product-options/option-item.d.ts +0 -11
  356. package/build/build-esm/booking-wizard/features/product-options/option-pax-card.d.ts +0 -13
  357. package/build/build-esm/booking-wizard/features/product-options/option-pax-group.d.ts +0 -20
  358. package/build/build-esm/booking-wizard/features/product-options/option-room.d.ts +0 -19
  359. package/build/build-esm/booking-wizard/features/product-options/option-unit-group.d.ts +0 -20
  360. package/build/build-esm/booking-wizard/features/product-options/option-units-card.d.ts +0 -9
  361. package/build/build-esm/booking-wizard/features/product-options/options-form.d.ts +0 -4
  362. package/build/build-esm/booking-wizard/features/room-options/index.d.ts +0 -4
  363. package/build/build-esm/booking-wizard/features/room-options/room-utils.d.ts +0 -29
  364. package/build/build-esm/booking-wizard/features/room-options/room.d.ts +0 -15
  365. package/build/build-esm/booking-wizard/features/room-options/traveler-rooms.d.ts +0 -13
  366. package/build/build-esm/booking-wizard/features/sidebar/index.d.ts +0 -7
  367. package/build/build-esm/booking-wizard/features/sidebar/sidebar-flight.d.ts +0 -8
  368. package/build/build-esm/booking-wizard/features/sidebar/sidebar-util.d.ts +0 -31
  369. package/build/build-esm/booking-wizard/features/sidebar/sidebar.d.ts +0 -30
  370. package/build/build-esm/booking-wizard/features/summary/summary-booking-option-pax.d.ts +0 -7
  371. package/build/build-esm/booking-wizard/features/summary/summary-booking-option-unit.d.ts +0 -7
  372. package/build/build-esm/booking-wizard/features/summary/summary-flight.d.ts +0 -8
  373. package/build/build-esm/booking-wizard/features/summary/summary-per-booking-option-group.d.ts +0 -10
  374. package/build/build-esm/booking-wizard/features/summary/summary-per-pax-option-group.d.ts +0 -10
  375. package/build/build-esm/booking-wizard/features/summary/summary-per-unit-option-group.d.ts +0 -10
  376. package/build/build-esm/booking-wizard/features/summary/summary-slice.d.ts +0 -14
  377. package/build/build-esm/booking-wizard/features/summary/summary.d.ts +0 -4
  378. package/build/build-esm/booking-wizard/features/travelers-form/controls/gender-control.d.ts +0 -5
  379. package/build/build-esm/booking-wizard/features/travelers-form/travelers-form-slice.d.ts +0 -75
  380. package/build/build-esm/booking-wizard/features/travelers-form/travelers-form-util.d.ts +0 -7
  381. package/build/build-esm/booking-wizard/features/travelers-form/travelers-form.d.ts +0 -4
  382. package/build/build-esm/booking-wizard/features/travelers-form/type-ahead-input.d.ts +0 -16
  383. package/build/build-esm/booking-wizard/features/travelers-form/validate-form.d.ts +0 -11
  384. package/build/build-esm/booking-wizard/index.d.ts +0 -12
  385. package/build/build-esm/booking-wizard/settings-context.d.ts +0 -5
  386. package/build/build-esm/booking-wizard/store.d.ts +0 -44
  387. package/build/build-esm/booking-wizard/types.d.ts +0 -281
  388. package/build/build-esm/booking-wizard/use-offer-printer.d.ts +0 -19
  389. package/build/build-esm/index.d.ts +0 -3
  390. package/build/build-esm/index.js +0 -25159
  391. package/build/build-esm/shared/components/loader.d.ts +0 -6
  392. package/build/build-esm/shared/types.d.ts +0 -4
  393. package/build/build-esm/shared/utils/class-util.d.ts +0 -1
  394. package/build/build-esm/shared/utils/localization-util.d.ts +0 -265
  395. package/build/build-esm/shared/utils/query-string-util.d.ts +0 -29
  396. package/build/build-esm/shared/utils/tide-api-utils.d.ts +0 -6
@@ -0,0 +1,2 @@
1
+ npx prettier --write .
2
+ git add -A
package/.prettierrc ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "semi": true,
3
+ "singleQuote": true,
4
+ "tabWidth": 2,
5
+ "printWidth": 160,
6
+ "trailingComma": "none",
7
+ "bracketSpacing": true,
8
+ "bracketSameLine": true
9
+ }
package/README.md CHANGED
@@ -1,8 +1,15 @@
1
1
  # README
2
2
 
3
- This is the unified Tide Booking Component.
3
+ This is the unified Tide Booking component.
4
+
5
+ ## Setup
6
+
7
+ - Use Node version 16.20.2
8
+ - Install node modules with "npm i --legacy-peer-deps"
9
+ - Install node modules with "npm i" in the playground directory
10
+ - Start playground with "npm start"
4
11
 
5
12
  ## Remarks
6
13
 
7
14
  Do not forget to sync React versions when you're doing local changes and when you try to test them in a local React project (check https://reactjs.org/warnings/invalid-hook-call-warning.html#duplicate-react).
8
- If using the playground, after installing it's node modules execute the following command in the root folder `npm link ./playground/node_modules/react`
15
+ If using the playground, after installing its node modules, execute the following command in the root folder `npm link ./playground/node_modules/react`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qite/tide-booking-component",
3
- "version": "1.4.17",
3
+ "version": "1.4.19",
4
4
  "description": "React Booking wizard & Booking product component for Tide",
5
5
  "main": "build/build-cjs/index.js",
6
6
  "module": "build/build-esm/index.js",
@@ -8,7 +8,8 @@
8
8
  "start": "rollup -c -w",
9
9
  "build": "rollup -c",
10
10
  "tsc": "tsc --noEmit",
11
- "format": "prettier --write ."
11
+ "format": "prettier --write .",
12
+ "prepare": "husky"
12
13
  },
13
14
  "repository": {
14
15
  "type": "git",
@@ -20,12 +21,13 @@
20
21
  "react",
21
22
  "component"
22
23
  ],
23
- "author": "Kristof Colpaert <kristof.colpaert@qite.be>",
24
+ "author": "Qite",
24
25
  "license": "OBSD",
25
26
  "homepage": "https://bitbucket.org/qitegeneral/tide-booking-component#readme",
26
27
  "devDependencies": {
27
28
  "@jsonurl/jsonurl": "^1.1.4",
28
29
  "@popperjs/core": "^2.10.2",
30
+ "@qite/tide-client": "^1.1.75",
29
31
  "@reach/router": "^1.3.4",
30
32
  "@reduxjs/toolkit": "^1.6.0",
31
33
  "@rollup/plugin-commonjs": "^19.0.1",
@@ -40,6 +42,7 @@
40
42
  "date-fns": "^2.22.1",
41
43
  "flat": "^5.0.2",
42
44
  "formik": "^2.2.9",
45
+ "husky": "^9.1.7",
43
46
  "lodash": "^4.17.21",
44
47
  "prettier": "^2.3.2",
45
48
  "react-popper": "^2.2.5",
@@ -69,7 +72,7 @@
69
72
  "uuid": "^8.3.2"
70
73
  },
71
74
  "dependencies": {
72
- "@qite/tide-client": "^1.1.106",
75
+ "@qite/tide-client": "^1.1.122",
73
76
  "react-html-comment": "^2.0.16"
74
77
  }
75
78
  }
package/rollup.config.js CHANGED
@@ -1,23 +1,16 @@
1
- import commonjs from "@rollup/plugin-commonjs";
2
- import del from "rollup-plugin-delete";
3
- import json from "@rollup/plugin-json";
4
- import nodeResolve from "@rollup/plugin-node-resolve";
5
- import packageJson from "./package.json";
6
- import peerDepsExternal from "rollup-plugin-peer-deps-external";
7
- import typescript from "rollup-plugin-typescript2";
1
+ import commonjs from '@rollup/plugin-commonjs';
2
+ import del from 'rollup-plugin-delete';
3
+ import json from '@rollup/plugin-json';
4
+ import nodeResolve from '@rollup/plugin-node-resolve';
5
+ import packageJson from './package.json';
6
+ import peerDepsExternal from 'rollup-plugin-peer-deps-external';
7
+ import typescript from 'rollup-plugin-typescript2';
8
8
 
9
9
  export default {
10
- input: "src/index.ts",
10
+ input: 'src/index.ts',
11
11
  output: [
12
- { file: packageJson.main, format: "cjs", banner: "/* eslint-disable */" },
13
- { file: packageJson.module, format: "esm", banner: "/* eslint-disable */" },
14
- ],
15
- plugins: [
16
- peerDepsExternal(),
17
- json(),
18
- nodeResolve(),
19
- commonjs(),
20
- typescript(),
21
- del({ targets: ["build/*"] }),
12
+ { file: packageJson.main, format: 'cjs', banner: '/* eslint-disable */' },
13
+ { file: packageJson.module, format: 'esm', banner: '/* eslint-disable */' }
22
14
  ],
15
+ plugins: [peerDepsExternal(), json(), nodeResolve(), commonjs(), typescript(), del({ targets: ['build/*'] })]
23
16
  };
@@ -1,7 +1,7 @@
1
- import { range } from "lodash";
2
- import React, { useContext } from "react";
3
- import { getTranslations } from "../../shared/utils/localization-util";
4
- import SettingsContext from "../settings-context";
1
+ import { range } from 'lodash';
2
+ import React, { useContext } from 'react';
3
+ import { getTranslations } from '../../shared/utils/localization-util';
4
+ import SettingsContext from '../settings-context';
5
5
 
6
6
  interface AgeSelectProps {
7
7
  value?: number;
@@ -1,8 +1,8 @@
1
- import React, { useContext } from "react";
2
- import { getTranslations } from "../../shared/utils/localization-util";
3
- import SettingsContext from "../settings-context";
4
- import { buildClassName } from "../../shared/utils/class-util";
5
- import Icon from "./icon";
1
+ import React, { useContext } from 'react';
2
+ import { getTranslations } from '../../shared/utils/localization-util';
3
+ import SettingsContext from '../settings-context';
4
+ import { buildClassName } from '../../shared/utils/class-util';
5
+ import Icon from './icon';
6
6
 
7
7
  interface AmountInputProps {
8
8
  label: string;
@@ -12,61 +12,34 @@ interface AmountInputProps {
12
12
  onChange?: (value: number) => void;
13
13
  }
14
14
 
15
- const AmountInput: React.FC<AmountInputProps> = ({
16
- label,
17
- value,
18
- disabled,
19
- min,
20
- onChange,
21
- }) => {
15
+ const AmountInput: React.FC<AmountInputProps> = ({ label, value, disabled, min, onChange }) => {
22
16
  const { language } = useContext(SettingsContext);
23
17
  const translations = getTranslations(language);
24
18
 
25
- const handleIncreaseClick: React.MouseEventHandler<HTMLButtonElement> = (
26
- event
27
- ) => {
19
+ const handleIncreaseClick: React.MouseEventHandler<HTMLButtonElement> = (event) => {
28
20
  if (onChange) {
29
21
  onChange(value + 1);
30
22
  }
31
23
  };
32
24
 
33
- const handleDecreaseClick: React.MouseEventHandler<HTMLButtonElement> = (
34
- event
35
- ) => {
25
+ const handleDecreaseClick: React.MouseEventHandler<HTMLButtonElement> = (event) => {
36
26
  if (onChange) {
37
27
  onChange(Math.max(value - 1, min ?? 0));
38
28
  }
39
29
  };
40
30
 
41
31
  return (
42
- <div
43
- className={buildClassName([
44
- "decrement-increment",
45
- disabled && "decrement-increment--disabled",
46
- ])}
47
- >
32
+ <div className={buildClassName(['decrement-increment', disabled && 'decrement-increment--disabled'])}>
48
33
  <label className="decrement-increment__label">{label}</label>
49
34
  <div className="decrement-increment__ui">
50
35
  {!disabled && (
51
- <button
52
- type="button"
53
- className="button button--decrement"
54
- title={translations.INPUT.DECREASE}
55
- disabled={disabled}
56
- onClick={handleDecreaseClick}
57
- >
36
+ <button type="button" className="button button--decrement" title={translations.INPUT.DECREASE} disabled={disabled} onClick={handleDecreaseClick}>
58
37
  <Icon name="ui-min" />
59
38
  </button>
60
39
  )}
61
40
  <span>{value}</span>
62
41
  {!disabled && (
63
- <button
64
- type="button"
65
- className="button button--increment"
66
- title={translations.INPUT.INCREASE}
67
- disabled={disabled}
68
- onClick={handleIncreaseClick}
69
- >
42
+ <button type="button" className="button button--increment" title={translations.INPUT.INCREASE} disabled={disabled} onClick={handleIncreaseClick}>
70
43
  <Icon name="ui-plus" />
71
44
  </button>
72
45
  )}
@@ -1,6 +1,6 @@
1
- import React from "react";
2
- import { getDate, isToday } from "date-fns";
3
- import { buildClassName } from "../../../shared/utils/class-util";
1
+ import React from 'react';
2
+ import { getDate, isToday } from 'date-fns';
3
+ import { buildClassName } from '../../../shared/utils/class-util';
4
4
 
5
5
  interface CalendarDayProps {
6
6
  day: Date;
@@ -12,16 +12,7 @@ interface CalendarDayProps {
12
12
  onMouseOver: (date: Date) => void;
13
13
  }
14
14
 
15
- const CalendarDay: React.FC<CalendarDayProps> = ({
16
- day,
17
- isSelected,
18
- isDisabled,
19
- isOutsideMonth,
20
- extraClassNames = [],
21
- children,
22
- onClick,
23
- onMouseOver,
24
- }) => {
15
+ const CalendarDay: React.FC<CalendarDayProps> = ({ day, isSelected, isDisabled, isOutsideMonth, extraClassNames = [], children, onClick, onMouseOver }) => {
25
16
  const handleClick = () => {
26
17
  if (onClick && !isDisabled) {
27
18
  onClick(day);
@@ -35,21 +26,17 @@ const CalendarDay: React.FC<CalendarDayProps> = ({
35
26
  };
36
27
 
37
28
  const classNames = buildClassName([
38
- "calendar__day",
39
- isToday(day) && "calendar__day--today",
40
- isDisabled && "calendar__day--disabled",
41
- isOutsideMonth && "calendar__day--outside-month",
42
- isSelected && "calendar__day--selected",
43
- ...extraClassNames,
29
+ 'calendar__day',
30
+ isToday(day) && 'calendar__day--today',
31
+ isDisabled && 'calendar__day--disabled',
32
+ isOutsideMonth && 'calendar__day--outside-month',
33
+ isSelected && 'calendar__day--selected',
34
+ ...extraClassNames
44
35
  ]);
45
36
 
46
37
  return (
47
- <div
48
- className={classNames}
49
- onClick={handleClick}
50
- onMouseOver={handleMouseOver}
51
- >
52
- {getDate(day).toString().padStart(2, "0")}
38
+ <div className={classNames} onClick={handleClick} onMouseOver={handleMouseOver}>
39
+ {getDate(day).toString().padStart(2, '0')}
53
40
  {children}
54
41
  </div>
55
42
  );
@@ -10,15 +10,15 @@ import {
10
10
  getYear,
11
11
  isSameMonth,
12
12
  startOfMonth,
13
- startOfWeek,
14
- } from "date-fns";
15
- import { chunk, isFunction, range } from "lodash";
16
- import React, { useContext } from "react";
17
- import { buildClassName } from "../../../shared/utils/class-util";
18
- import { getLocale } from "../../../shared/utils/localization-util";
19
- import SettingsContext from "../../settings-context";
20
- import CalendarDay from "./calendar-day";
21
- import Icon from "../icon";
13
+ startOfWeek
14
+ } from 'date-fns';
15
+ import { chunk, isFunction, range } from 'lodash';
16
+ import React, { useContext } from 'react';
17
+ import { buildClassName } from '../../../shared/utils/class-util';
18
+ import { getLocale } from '../../../shared/utils/localization-util';
19
+ import SettingsContext from '../../settings-context';
20
+ import CalendarDay from './calendar-day';
21
+ import Icon from '../icon';
22
22
 
23
23
  interface CalendarProps {
24
24
  year?: number;
@@ -51,7 +51,7 @@ const Calendar: React.FC<CalendarProps> = ({
51
51
  onDayClick,
52
52
  onDayMouseOver,
53
53
  onNextClick,
54
- onPreviousClick,
54
+ onPreviousClick
55
55
  }) => {
56
56
  const { language } = useContext(SettingsContext);
57
57
 
@@ -88,21 +88,15 @@ const Calendar: React.FC<CalendarProps> = ({
88
88
 
89
89
  const focusDate = new Date(year, month);
90
90
  const firstDay = startOfWeek(startOfMonth(focusDate), { weekStartsOn });
91
- const lastDay = hasFixedHeight
92
- ? endOfWeek(addWeeks(firstDay, 5), { weekStartsOn })
93
- : endOfWeek(endOfMonth(focusDate), { weekStartsOn });
91
+ const lastDay = hasFixedHeight ? endOfWeek(addWeeks(firstDay, 5), { weekStartsOn }) : endOfWeek(endOfMonth(focusDate), { weekStartsOn });
94
92
  const calendarDays = eachDayOfInterval({ start: firstDay, end: lastDay });
95
93
 
96
94
  const mapDay = (day: Date) => {
97
95
  const isoDay = getISODay(day);
98
- const isDisabled =
99
- isFunction(disabledDaysFunction) && disabledDaysFunction(day);
100
- const isSelected =
101
- isFunction(selectedDaysFunction) && selectedDaysFunction(day);
96
+ const isDisabled = isFunction(disabledDaysFunction) && disabledDaysFunction(day);
97
+ const isSelected = isFunction(selectedDaysFunction) && selectedDaysFunction(day);
102
98
  const isOutsideMonth = !isSameMonth(day, focusDate);
103
- const extraClassNames = isFunction(extraClassNamesFunction)
104
- ? extraClassNamesFunction(day)
105
- : undefined;
99
+ const extraClassNames = isFunction(extraClassNamesFunction) ? extraClassNamesFunction(day) : undefined;
106
100
 
107
101
  return (
108
102
  <CalendarDay
@@ -113,8 +107,7 @@ const Calendar: React.FC<CalendarProps> = ({
113
107
  isOutsideMonth={isOutsideMonth}
114
108
  extraClassNames={extraClassNames}
115
109
  onClick={handleDayClick}
116
- onMouseOver={handleDayMouseOver}
117
- >
110
+ onMouseOver={handleDayMouseOver}>
118
111
  {isFunction(dayContentFunction) ? dayContentFunction(day) : undefined}
119
112
  </CalendarDay>
120
113
  );
@@ -138,39 +131,23 @@ const Calendar: React.FC<CalendarProps> = ({
138
131
  <div className="calendar">
139
132
  <div className="calendar__header">
140
133
  <div className="calendar__pager">
141
- <div
142
- className={buildClassName([
143
- "calendar__previous",
144
- !hasPreviousButton && "calendar__previous--disabled",
145
- ])}
146
- onClick={handlePreviousClick}
147
- >
134
+ <div className={buildClassName(['calendar__previous', !hasPreviousButton && 'calendar__previous--disabled'])} onClick={handlePreviousClick}>
148
135
  <Icon name="ui-chevron" />
149
136
  </div>
150
- <div className="calendar__current-month">
151
- {format(focusDate, "MMMM yyyy", { locale })}
152
- </div>
153
- <div
154
- className={buildClassName([
155
- "calendar__next",
156
- !hasNextButton && "calendar__next--disabled",
157
- ])}
158
- onClick={handleNextClick}
159
- >
137
+ <div className="calendar__current-month">{format(focusDate, 'MMMM yyyy', { locale })}</div>
138
+ <div className={buildClassName(['calendar__next', !hasNextButton && 'calendar__next--disabled'])} onClick={handleNextClick}>
160
139
  <Icon name="ui-chevron" />
161
140
  </div>
162
141
  </div>
163
142
  <div className="calendar__day-labels">
164
143
  {range(0, 7).map((i) => (
165
144
  <div className="calendar__day-label" key={`day_${i}`}>
166
- {format(calendarDays[i], "EEEEEE", { locale: locale })}
145
+ {format(calendarDays[i], 'EEEEEE', { locale: locale })}
167
146
  </div>
168
147
  ))}
169
148
  </div>
170
149
  </div>
171
- <div className="calendar__body">
172
- {chunk(calendarDays, 7).map(mapWeek)}
173
- </div>
150
+ <div className="calendar__body">{chunk(calendarDays, 7).map(mapWeek)}</div>
174
151
  </div>
175
152
  );
176
153
  };
@@ -1,17 +1,8 @@
1
- import {
2
- endOfDay,
3
- endOfMonth,
4
- getMonth,
5
- getYear,
6
- isAfter,
7
- isEqual,
8
- isWithinInterval,
9
- startOfDay,
10
- } from "date-fns";
11
-
12
- import { isNil } from "lodash";
13
- import React, { useEffect, useState } from "react";
14
- import Calendar from "./calendar";
1
+ import { endOfDay, endOfMonth, getMonth, getYear, isAfter, isEqual, isWithinInterval, startOfDay } from 'date-fns';
2
+
3
+ import { isNil } from 'lodash';
4
+ import React, { useEffect, useState } from 'react';
5
+ import Calendar from './calendar';
15
6
 
16
7
  interface DateRangePickerProps {
17
8
  fromDate?: Date;
@@ -34,7 +25,7 @@ const DateRangePicker: React.FC<DateRangePickerProps> = (props) => {
34
25
  const [focusMonth, setFocusMonth] = useState<{ month: number; year: number }>(
35
26
  props.focusMonth ?? {
36
27
  year: getYear(new Date()),
37
- month: getMonth(new Date()),
28
+ month: getMonth(new Date())
38
29
  }
39
30
  );
40
31
  const [isWaitingForToDate, setWaitingForToDate] = useState<boolean>(false);
@@ -57,13 +48,7 @@ const DateRangePicker: React.FC<DateRangePickerProps> = (props) => {
57
48
  setFromDate(day);
58
49
 
59
50
  if (props.duration) {
60
- const to = new Date(
61
- Date.UTC(
62
- day.getFullYear(),
63
- day.getMonth(),
64
- day.getDate() + props.duration
65
- )
66
- );
51
+ const to = new Date(Date.UTC(day.getFullYear(), day.getMonth(), day.getDate() + props.duration));
67
52
  setToDate(to);
68
53
 
69
54
  if (onSelectionChange) {
@@ -81,10 +66,7 @@ const DateRangePicker: React.FC<DateRangePickerProps> = (props) => {
81
66
  };
82
67
 
83
68
  const handleDayMouseOver = (day: Date) => {
84
- if (
85
- isWaitingForToDate &&
86
- (isNil(fromDate) || isEqual(day, fromDate) || isAfter(day, fromDate))
87
- ) {
69
+ if (isWaitingForToDate && (isNil(fromDate) || isEqual(day, fromDate) || isAfter(day, fromDate))) {
88
70
  setToDate(day);
89
71
  }
90
72
  };
@@ -125,10 +107,7 @@ const DateRangePicker: React.FC<DateRangePickerProps> = (props) => {
125
107
  const firstCalendarMonth = focusMonth.month;
126
108
 
127
109
  const secondCalendarMonth = (firstCalendarMonth + 1) % 12;
128
- const secondCalendarYear =
129
- secondCalendarMonth < firstCalendarMonth
130
- ? firstCalendarYear + 1
131
- : firstCalendarYear;
110
+ const secondCalendarYear = secondCalendarMonth < firstCalendarMonth ? firstCalendarYear + 1 : firstCalendarYear;
132
111
 
133
112
  const checkIfDateIsSelected = (date: Date) =>
134
113
  isNil(toDate)
@@ -136,7 +115,7 @@ const DateRangePicker: React.FC<DateRangePickerProps> = (props) => {
136
115
  : !isNil(fromDate) &&
137
116
  isWithinInterval(date, {
138
117
  start: startOfDay(fromDate),
139
- end: endOfDay(toDate),
118
+ end: endOfDay(toDate)
140
119
  });
141
120
 
142
121
  useEffect(() => {
@@ -148,7 +127,7 @@ const DateRangePicker: React.FC<DateRangePickerProps> = (props) => {
148
127
  if (props.fromDate) {
149
128
  setFocusMonth({
150
129
  month: props.fromDate.getMonth(),
151
- year: props.fromDate.getFullYear(),
130
+ year: props.fromDate.getFullYear()
152
131
  });
153
132
  }
154
133
  }, [props.fromDate?.valueOf()]);
@@ -162,10 +141,7 @@ const DateRangePicker: React.FC<DateRangePickerProps> = (props) => {
162
141
  onDayClick={handleDayClick}
163
142
  onDayMouseOver={handleDayMouseOver}
164
143
  onPreviousClick={handlePreviousClick}
165
- hasPreviousButton={isAfter(
166
- new Date(firstCalendarYear, firstCalendarMonth),
167
- endOfMonth(today)
168
- )}
144
+ hasPreviousButton={isAfter(new Date(firstCalendarYear, firstCalendarMonth), endOfMonth(today))}
169
145
  hasNextButton={false}
170
146
  selectedDaysFunction={checkIfDateIsSelected}
171
147
  disabledDaysFunction={props.disabledDaysFunction}
@@ -1,12 +1,12 @@
1
- import { format, isBefore, startOfDay } from "date-fns";
2
- import React, { useContext, useEffect, useState } from "react";
3
- import { usePopper } from "react-popper";
4
- import { buildClassName } from "../../shared/utils/class-util";
5
- import { getTranslations } from "../../shared/utils/localization-util";
6
- import SettingsContext from "../settings-context";
7
- import { DateRange } from "../types";
8
- import DateRangePicker from "./date-range-picker";
9
- import Icon from "./icon";
1
+ import { format, isBefore, startOfDay } from 'date-fns';
2
+ import React, { useContext, useEffect, useState } from 'react';
3
+ import { usePopper } from 'react-popper';
4
+ import { buildClassName } from '../../shared/utils/class-util';
5
+ import { getTranslations } from '../../shared/utils/localization-util';
6
+ import SettingsContext from '../settings-context';
7
+ import { DateRange } from '../types';
8
+ import DateRangePicker from './date-range-picker';
9
+ import Icon from './icon';
10
10
 
11
11
  interface DatesProps {
12
12
  value?: DateRange;
@@ -17,34 +17,28 @@ interface DatesProps {
17
17
  const Dates: React.FC<DatesProps> = ({ value, duration, onChange }) => {
18
18
  const { language } = useContext(SettingsContext);
19
19
  const translations = getTranslations(language);
20
- const mql =
21
- typeof window !== "undefined"
22
- ? window.matchMedia("(min-width: 1200px)")
23
- : undefined;
20
+ const mql = typeof window !== 'undefined' ? window.matchMedia('(min-width: 1200px)') : undefined;
24
21
 
25
- const [referenceElement, setReferenceElement] =
26
- useState<HTMLDivElement | null>(null);
27
- const [popperElement, setPopperElement] = useState<HTMLDivElement | null>(
28
- null
29
- );
22
+ const [referenceElement, setReferenceElement] = useState<HTMLDivElement | null>(null);
23
+ const [popperElement, setPopperElement] = useState<HTMLDivElement | null>(null);
30
24
  const [panelActive, setPanelActive] = useState<boolean>(false);
31
25
 
32
26
  const { styles, attributes } = usePopper(referenceElement, popperElement, {
33
- placement: "top",
27
+ placement: 'top',
34
28
  modifiers: [
35
29
  {
36
- name: "offset",
30
+ name: 'offset',
37
31
  options: {
38
- offset: [0, -40],
39
- },
32
+ offset: [0, -40]
33
+ }
40
34
  },
41
35
  {
42
- name: "preventOverflow",
36
+ name: 'preventOverflow',
43
37
  options: {
44
- padding: 40,
45
- },
46
- },
47
- ],
38
+ padding: 40
39
+ }
40
+ }
41
+ ]
48
42
  });
49
43
 
50
44
  const handleInputFocus = () => {
@@ -59,9 +53,9 @@ const Dates: React.FC<DatesProps> = ({ value, duration, onChange }) => {
59
53
  };
60
54
 
61
55
  useEffect(() => {
62
- document.addEventListener("mousedown", handleDocumentClick);
56
+ document.addEventListener('mousedown', handleDocumentClick);
63
57
  return () => {
64
- document.removeEventListener("mousedown", handleDocumentClick);
58
+ document.removeEventListener('mousedown', handleDocumentClick);
65
59
  };
66
60
  });
67
61
 
@@ -79,13 +73,11 @@ const Dates: React.FC<DatesProps> = ({ value, duration, onChange }) => {
79
73
  </div>
80
74
  <div className="form__group form__group--datepicker form__group--icon">
81
75
  <div className="form__group-input">
82
- <label className="form__label">
83
- {translations.PRODUCT.DEPARTURE}
84
- </label>
76
+ <label className="form__label">{translations.PRODUCT.DEPARTURE}</label>
85
77
  <input
86
78
  type="text"
87
79
  readOnly
88
- value={value?.fromDate ? format(value.fromDate, "dd/MM/yyyy") : ""}
80
+ value={value?.fromDate ? format(value.fromDate, 'dd/MM/yyyy') : ''}
89
81
  className="form__input"
90
82
  placeholder={translations.PRODUCT.DEPARTURE_DATE}
91
83
  onClick={handleInputFocus}
@@ -97,7 +89,7 @@ const Dates: React.FC<DatesProps> = ({ value, duration, onChange }) => {
97
89
  <input
98
90
  type="text"
99
91
  readOnly
100
- value={value?.toDate ? format(value.toDate, "dd/MM/yyyy") : ""}
92
+ value={value?.toDate ? format(value.toDate, 'dd/MM/yyyy') : ''}
101
93
  className="form__input"
102
94
  placeholder={translations.PRODUCT.RETURN_DATE}
103
95
  onClick={handleInputFocus}
@@ -106,20 +98,17 @@ const Dates: React.FC<DatesProps> = ({ value, duration, onChange }) => {
106
98
  <div
107
99
  ref={setPopperElement}
108
100
  className={buildClassName([
109
- "qsm__panel qsm__panel--bordered qsm__panel--dates-pricing",
110
- panelActive && "qsm__panel--active",
111
- !mql?.matches && "qsm__panel--mobile",
101
+ 'qsm__panel qsm__panel--bordered qsm__panel--dates-pricing',
102
+ panelActive && 'qsm__panel--active',
103
+ !mql?.matches && 'qsm__panel--mobile'
112
104
  ])}
113
105
  style={mql?.matches ? styles.popper : undefined}
114
- {...attributes.popper}
115
- >
106
+ {...attributes.popper}>
116
107
  <DateRangePicker
117
108
  fromDate={value?.fromDate}
118
109
  toDate={value?.toDate}
119
110
  duration={duration}
120
- disabledDaysFunction={(date) =>
121
- isBefore(date, startOfDay(new Date()))
122
- }
111
+ disabledDaysFunction={(date) => isBefore(date, startOfDay(new Date()))}
123
112
  onSelectionChange={handleSelectionChange}
124
113
  />
125
114
  {!mql?.matches && (