@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.
- package/.husky/pre-commit +2 -0
- package/.prettierrc +9 -0
- package/README.md +9 -2
- package/package.json +7 -4
- package/rollup.config.js +11 -18
- package/src/booking-product/components/age-select.tsx +4 -4
- package/src/booking-product/components/amount-input.tsx +11 -38
- package/src/booking-product/components/date-range-picker/calendar-day.tsx +12 -25
- package/src/booking-product/components/date-range-picker/calendar.tsx +20 -43
- package/src/booking-product/components/date-range-picker/index.tsx +12 -36
- package/src/booking-product/components/dates.tsx +31 -42
- package/src/booking-product/components/footer.tsx +11 -26
- package/src/booking-product/components/header.tsx +10 -32
- package/src/booking-product/components/icon.tsx +45 -96
- package/src/booking-product/components/product.tsx +57 -144
- package/src/booking-product/components/rating.tsx +3 -3
- package/src/booking-product/components/rooms.tsx +21 -49
- package/src/booking-product/index.tsx +6 -15
- package/src/booking-product/settings-context.ts +5 -5
- package/src/booking-product/utils/api.ts +5 -10
- package/src/booking-product/utils/price.ts +3 -6
- package/src/booking-wizard/api-settings-slice.ts +7 -7
- package/src/booking-wizard/components/icon.tsx +72 -182
- package/src/booking-wizard/components/labeled-input.tsx +7 -15
- package/src/booking-wizard/components/labeled-select.tsx +8 -23
- package/src/booking-wizard/components/message.tsx +8 -21
- package/src/booking-wizard/components/multi-range-filter.tsx +6 -20
- package/src/booking-wizard/components/phone-input.tsx +25 -60
- package/src/booking-wizard/components/print-offer-button.tsx +10 -20
- package/src/booking-wizard/components/product-card.tsx +4 -18
- package/src/booking-wizard/components/step-indicator.tsx +10 -13
- package/src/booking-wizard/components/step-route.tsx +2 -2
- package/src/booking-wizard/declarations.d.ts +1 -1
- package/src/booking-wizard/features/booking/api.ts +8 -19
- package/src/booking-wizard/features/booking/booking-self-contained.tsx +60 -153
- package/src/booking-wizard/features/booking/booking-slice.ts +171 -267
- package/src/booking-wizard/features/booking/booking.tsx +62 -145
- package/src/booking-wizard/features/booking/selectors.ts +139 -253
- package/src/booking-wizard/features/confirmation/confirmation.tsx +18 -37
- package/src/booking-wizard/features/error/error.tsx +12 -23
- package/src/booking-wizard/features/flight-options/flight-filter.tsx +61 -122
- package/src/booking-wizard/features/flight-options/flight-option-flight.tsx +16 -47
- package/src/booking-wizard/features/flight-options/flight-option-modal.tsx +12 -30
- package/src/booking-wizard/features/flight-options/flight-option.tsx +13 -38
- package/src/booking-wizard/features/flight-options/flight-utils.ts +74 -173
- package/src/booking-wizard/features/flight-options/index.tsx +34 -89
- package/src/booking-wizard/features/price-details/price-details-api.ts +5 -9
- package/src/booking-wizard/features/price-details/price-details-slice.ts +60 -120
- package/src/booking-wizard/features/price-details/util.ts +29 -69
- package/src/booking-wizard/features/product-options/no-options.tsx +5 -8
- package/src/booking-wizard/features/product-options/none-option.tsx +16 -64
- package/src/booking-wizard/features/product-options/option-booking-airline-group.tsx +12 -23
- package/src/booking-wizard/features/product-options/option-booking-group.tsx +37 -101
- package/src/booking-wizard/features/product-options/option-item.tsx +47 -132
- package/src/booking-wizard/features/product-options/option-pax-card.tsx +24 -66
- package/src/booking-wizard/features/product-options/option-pax-group.tsx +29 -82
- package/src/booking-wizard/features/product-options/option-room.tsx +53 -157
- package/src/booking-wizard/features/product-options/option-unit-group.tsx +33 -93
- package/src/booking-wizard/features/product-options/option-units-card.tsx +23 -60
- package/src/booking-wizard/features/product-options/options-form.tsx +65 -179
- package/src/booking-wizard/features/room-options/index.tsx +30 -86
- package/src/booking-wizard/features/room-options/room-utils.ts +26 -65
- package/src/booking-wizard/features/room-options/room.tsx +20 -58
- package/src/booking-wizard/features/room-options/traveler-rooms.tsx +10 -21
- package/src/booking-wizard/features/sidebar/index.tsx +17 -29
- package/src/booking-wizard/features/sidebar/sidebar-flight.tsx +13 -24
- package/src/booking-wizard/features/sidebar/sidebar-util.ts +52 -95
- package/src/booking-wizard/features/sidebar/sidebar.tsx +52 -167
- package/src/booking-wizard/features/summary/summary-booking-option-pax.tsx +5 -7
- package/src/booking-wizard/features/summary/summary-booking-option-unit.tsx +5 -7
- package/src/booking-wizard/features/summary/summary-flight.tsx +11 -19
- package/src/booking-wizard/features/summary/summary-per-booking-option-group.tsx +11 -20
- package/src/booking-wizard/features/summary/summary-per-pax-option-group.tsx +7 -14
- package/src/booking-wizard/features/summary/summary-per-unit-option-group.tsx +9 -17
- package/src/booking-wizard/features/summary/summary-slice.ts +7 -8
- package/src/booking-wizard/features/summary/summary.tsx +105 -315
- package/src/booking-wizard/features/travelers-form/controls/gender-control.tsx +10 -22
- package/src/booking-wizard/features/travelers-form/travelers-form-slice.ts +44 -52
- package/src/booking-wizard/features/travelers-form/travelers-form-util.ts +2 -3
- package/src/booking-wizard/features/travelers-form/travelers-form.tsx +176 -371
- package/src/booking-wizard/features/travelers-form/type-ahead-input.tsx +8 -24
- package/src/booking-wizard/features/travelers-form/validate-form.ts +50 -165
- package/src/booking-wizard/index.tsx +8 -17
- package/src/booking-wizard/settings-context.ts +22 -22
- package/src/booking-wizard/store.ts +10 -15
- package/src/booking-wizard/types.ts +3 -1
- package/src/booking-wizard/use-offer-printer.ts +24 -33
- package/src/content/components/LanguageSwitcher.tsx +158 -0
- package/src/content/components/breadcrumb.tsx +70 -0
- package/src/content/components/contact.tsx +211 -0
- package/src/content/components/footer.tsx +191 -0
- package/src/content/components/gallery.tsx +145 -0
- package/src/content/components/header.tsx +69 -0
- package/src/content/components/icon.tsx +695 -0
- package/src/content/components/image-with-text.tsx +118 -0
- package/src/content/components/personal-contact-form.tsx +809 -0
- package/src/content/components/slider.tsx +237 -0
- package/src/content/features/content-page/content-page-self-contained.tsx +815 -0
- package/src/content/navbar/index.tsx +303 -0
- package/src/content/navbar/placeholderData.tsx +162 -0
- package/src/content/navbar/types.ts +34 -0
- package/src/index.ts +6 -3
- package/src/qsm/components/QSMContainer/qsm-container.tsx +171 -0
- package/src/qsm/components/date-picker/index.tsx +152 -0
- package/src/qsm/components/date-range-picker/calendar-day.tsx +49 -0
- package/src/qsm/components/date-range-picker/calendar.tsx +211 -0
- package/src/qsm/components/date-range-picker/index.tsx +404 -0
- package/src/qsm/components/double-search-input-group/index.tsx +139 -0
- package/src/qsm/components/icon.tsx +338 -0
- package/src/qsm/components/item-picker/index.tsx +77 -0
- package/src/qsm/components/mobile-filter-modal/index.tsx +247 -0
- package/src/qsm/components/search-input/index.tsx +62 -0
- package/src/qsm/components/search-input-group/index.tsx +163 -0
- package/src/qsm/components/travel-class-picker/index.tsx +24 -0
- package/src/qsm/components/travel-input/index.tsx +237 -0
- package/src/qsm/components/travel-input-group/index.tsx +96 -0
- package/src/qsm/components/travel-type-picker/index.tsx +24 -0
- package/src/qsm/index.tsx +26 -0
- package/src/qsm/qsm-configuration-context.ts +39 -0
- package/src/qsm/store/qsm-slice.ts +262 -0
- package/src/qsm/store/qsm-store.ts +13 -0
- package/src/qsm/types.ts +123 -0
- package/src/search-results/components/filters/filters.tsx +388 -0
- package/src/search-results/components/filters/utility.tsx +20 -0
- package/src/search-results/components/flight/flight-accommodation-results.tsx +582 -0
- package/src/search-results/components/flight/flight-banner.tsx +35 -0
- package/src/search-results/components/flight/flight-card.tsx +38 -0
- package/src/search-results/components/flight/flight-leg.tsx +61 -0
- package/src/search-results/components/flight/flight-path.tsx +23 -0
- package/src/search-results/components/flight/flight-results.tsx +1137 -0
- package/src/search-results/components/hotel/hotel-accommodation-results.tsx +114 -0
- package/src/search-results/components/hotel/hotel-card.tsx +42 -0
- package/src/search-results/components/icon.tsx +609 -0
- package/src/search-results/components/item-picker/index.tsx +77 -0
- package/src/search-results/components/itinerary/index.tsx +208 -0
- package/src/search-results/components/multi-range-filter.tsx +104 -0
- package/src/search-results/components/round-trip/round-trip-results.tsx +175 -0
- package/src/search-results/components/search-results-container/search-results-container.tsx +342 -0
- package/src/search-results/components/spinner/spinner.tsx +14 -0
- package/src/search-results/components/tab-views/index.tsx +25 -0
- package/src/search-results/features/flight-options/flight-filter.tsx +371 -0
- package/src/search-results/features/flight-options/flight-option-flight.tsx +354 -0
- package/src/search-results/features/flight-options/flight-option-modal.tsx +211 -0
- package/src/search-results/features/flight-options/flight-option.tsx +56 -0
- package/src/search-results/features/flight-options/flight-utils.ts +417 -0
- package/src/search-results/features/flight-options/index.tsx +141 -0
- package/src/search-results/features/flights/flight-search-results-self-contained.tsx +301 -0
- package/src/search-results/features/hotels/hotel-flight-search-results-self-contained.tsx +128 -0
- package/src/search-results/features/hotels/hotel-search-results-self-contained.tsx +227 -0
- package/src/search-results/features/roundtrips/roundtrip-search-results-self-contained.tsx +51 -0
- package/src/search-results/index.tsx +24 -0
- package/src/search-results/search-results-configuration-context.ts +6 -0
- package/src/search-results/store/search-results-slice.ts +63 -0
- package/src/search-results/store/search-results-store.ts +13 -0
- package/src/search-results/types.ts +161 -0
- package/src/shared/components/loader.tsx +1 -1
- package/src/shared/utils/class-util.ts +3 -5
- package/src/shared/utils/localization-util.ts +37 -28
- package/src/shared/utils/query-string-util.ts +20 -48
- package/src/shared/utils/tide-api-utils.ts +9 -11
- package/src/shared/utils/use-media-query-util.ts +19 -0
- package/styles/abstracts/_mixins.scss +74 -0
- package/styles/abstracts/_variables.scss +57 -0
- package/styles/base/_fonts.scss +2 -0
- package/styles/base/_normalize.scss +227 -0
- package/styles/base/_typography.scss +35 -0
- package/styles/booking-joker-variables.scss +596 -0
- package/styles/booking-product-variables.scss +69 -133
- package/styles/booking-product.scss +16 -24
- package/styles/booking-qsm-variables.scss +501 -0
- package/styles/booking-qsm.scss +52 -0
- package/styles/booking-search-results-variables.scss +728 -0
- package/styles/booking-search-results.scss +51 -0
- package/styles/booking-wizard-variables.scss +152 -422
- package/styles/booking-wizard.scss +24 -23
- package/styles/components/_booking.scss +23 -30
- package/styles/components/_breadcrumb.scss +75 -0
- package/styles/components/_button.scss +9 -9
- package/styles/components/_checkbox.scss +28 -17
- package/styles/components/_contact.scss +239 -0
- package/styles/components/_content.scss +467 -0
- package/styles/components/_cta.scss +40 -10
- package/styles/components/_date-list.scss +1 -1
- package/styles/components/_date-range-picker.scss +1 -3
- package/styles/components/_dropdown.scss +1 -1
- package/styles/components/_flight-option.scss +54 -64
- package/styles/components/_form.scss +4 -8
- package/styles/components/_gallery.scss +314 -0
- package/styles/components/_header.scss +113 -0
- package/styles/components/_image-with-text.scss +209 -0
- package/styles/components/_img-slider.scss +175 -0
- package/styles/components/_info-message.scss +4 -0
- package/styles/components/_input.scss +12 -2
- package/styles/components/_list.scss +4 -6
- package/styles/components/_loader.scss +3 -5
- package/styles/components/_mixins.scss +41 -12
- package/styles/components/_navbar.scss +740 -0
- package/styles/components/_passenger-picker.scss +305 -0
- package/styles/components/_placeholders.scss +3 -4
- package/styles/components/_pricing-summary.scss +1 -2
- package/styles/components/_radiobutton.scss +7 -7
- package/styles/components/_search.scss +2317 -0
- package/styles/components/_select-wrapper.scss +10 -14
- package/styles/components/_slider.scss +128 -0
- package/styles/components/_step-indicators.scss +9 -17
- package/styles/components/_tree.scss +151 -29
- package/styles/components/_typeahead.scss +3 -9
- package/styles/components/_variables.scss +3 -3
- package/styles/content-blocks-variables.scss +507 -0
- package/styles/content-blocks.scss +58 -0
- package/styles/font.scss +2 -0
- package/styles/qsm/_calendar.scss +274 -0
- package/styles/qsm/_qsm.scss +1033 -0
- package/styles/search.scss +1200 -0
- package/build/build-cjs/booking-product/components/age-select.d.ts +0 -8
- package/build/build-cjs/booking-product/components/amount-input.d.ts +0 -10
- package/build/build-cjs/booking-product/components/date-range-picker/calendar-day.d.ts +0 -12
- package/build/build-cjs/booking-product/components/date-range-picker/calendar.d.ts +0 -19
- package/build/build-cjs/booking-product/components/date-range-picker/index.d.ts +0 -20
- package/build/build-cjs/booking-product/components/dates.d.ts +0 -9
- package/build/build-cjs/booking-product/components/footer.d.ts +0 -10
- package/build/build-cjs/booking-product/components/header.d.ts +0 -11
- package/build/build-cjs/booking-product/components/icon.d.ts +0 -10
- package/build/build-cjs/booking-product/components/product.d.ts +0 -9
- package/build/build-cjs/booking-product/components/rating.d.ts +0 -6
- package/build/build-cjs/booking-product/components/rooms.d.ts +0 -10
- package/build/build-cjs/booking-product/index.d.ts +0 -10
- package/build/build-cjs/booking-product/settings-context.d.ts +0 -5
- package/build/build-cjs/booking-product/types.d.ts +0 -25
- package/build/build-cjs/booking-product/utils/api.d.ts +0 -16
- package/build/build-cjs/booking-product/utils/price.d.ts +0 -10
- package/build/build-cjs/booking-wizard/api-settings-slice.d.ts +0 -14
- package/build/build-cjs/booking-wizard/components/icon.d.ts +0 -10
- package/build/build-cjs/booking-wizard/components/labeled-input.d.ts +0 -18
- package/build/build-cjs/booking-wizard/components/labeled-select.d.ts +0 -21
- package/build/build-cjs/booking-wizard/components/message.d.ts +0 -9
- package/build/build-cjs/booking-wizard/components/multi-range-filter.d.ts +0 -11
- package/build/build-cjs/booking-wizard/components/phone-input.d.ts +0 -17
- package/build/build-cjs/booking-wizard/components/print-offer-button.d.ts +0 -17
- package/build/build-cjs/booking-wizard/components/product-card.d.ts +0 -8
- package/build/build-cjs/booking-wizard/components/step-indicator.d.ts +0 -6
- package/build/build-cjs/booking-wizard/components/step-route.d.ts +0 -9
- package/build/build-cjs/booking-wizard/features/booking/api.d.ts +0 -29
- package/build/build-cjs/booking-wizard/features/booking/booking-self-contained.d.ts +0 -8
- package/build/build-cjs/booking-wizard/features/booking/booking-slice.d.ts +0 -182
- package/build/build-cjs/booking-wizard/features/booking/booking.d.ts +0 -8
- package/build/build-cjs/booking-wizard/features/booking/constants.d.ts +0 -15
- package/build/build-cjs/booking-wizard/features/booking/selectors.d.ts +0 -391
- package/build/build-cjs/booking-wizard/features/confirmation/confirmation.d.ts +0 -4
- package/build/build-cjs/booking-wizard/features/error/error.d.ts +0 -4
- package/build/build-cjs/booking-wizard/features/flight-options/flight-filter.d.ts +0 -9
- package/build/build-cjs/booking-wizard/features/flight-options/flight-option-flight.d.ts +0 -8
- package/build/build-cjs/booking-wizard/features/flight-options/flight-option-modal.d.ts +0 -3
- package/build/build-cjs/booking-wizard/features/flight-options/flight-option.d.ts +0 -10
- package/build/build-cjs/booking-wizard/features/flight-options/flight-utils.d.ts +0 -16
- package/build/build-cjs/booking-wizard/features/flight-options/index.d.ts +0 -4
- package/build/build-cjs/booking-wizard/features/price-details/price-details-api.d.ts +0 -15
- package/build/build-cjs/booking-wizard/features/price-details/price-details-slice.d.ts +0 -121
- package/build/build-cjs/booking-wizard/features/price-details/util.d.ts +0 -5
- package/build/build-cjs/booking-wizard/features/product-options/no-options.d.ts +0 -3
- package/build/build-cjs/booking-wizard/features/product-options/none-option.d.ts +0 -17
- package/build/build-cjs/booking-wizard/features/product-options/option-booking-airline-group.d.ts +0 -17
- package/build/build-cjs/booking-wizard/features/product-options/option-booking-group.d.ts +0 -18
- package/build/build-cjs/booking-wizard/features/product-options/option-item.d.ts +0 -11
- package/build/build-cjs/booking-wizard/features/product-options/option-pax-card.d.ts +0 -13
- package/build/build-cjs/booking-wizard/features/product-options/option-pax-group.d.ts +0 -20
- package/build/build-cjs/booking-wizard/features/product-options/option-room.d.ts +0 -19
- package/build/build-cjs/booking-wizard/features/product-options/option-unit-group.d.ts +0 -20
- package/build/build-cjs/booking-wizard/features/product-options/option-units-card.d.ts +0 -9
- package/build/build-cjs/booking-wizard/features/product-options/options-form.d.ts +0 -4
- package/build/build-cjs/booking-wizard/features/room-options/index.d.ts +0 -4
- package/build/build-cjs/booking-wizard/features/room-options/room-utils.d.ts +0 -29
- package/build/build-cjs/booking-wizard/features/room-options/room.d.ts +0 -15
- package/build/build-cjs/booking-wizard/features/room-options/traveler-rooms.d.ts +0 -13
- package/build/build-cjs/booking-wizard/features/sidebar/index.d.ts +0 -7
- package/build/build-cjs/booking-wizard/features/sidebar/sidebar-flight.d.ts +0 -8
- package/build/build-cjs/booking-wizard/features/sidebar/sidebar-util.d.ts +0 -31
- package/build/build-cjs/booking-wizard/features/sidebar/sidebar.d.ts +0 -30
- package/build/build-cjs/booking-wizard/features/summary/summary-booking-option-pax.d.ts +0 -7
- package/build/build-cjs/booking-wizard/features/summary/summary-booking-option-unit.d.ts +0 -7
- package/build/build-cjs/booking-wizard/features/summary/summary-flight.d.ts +0 -8
- package/build/build-cjs/booking-wizard/features/summary/summary-per-booking-option-group.d.ts +0 -10
- package/build/build-cjs/booking-wizard/features/summary/summary-per-pax-option-group.d.ts +0 -10
- package/build/build-cjs/booking-wizard/features/summary/summary-per-unit-option-group.d.ts +0 -10
- package/build/build-cjs/booking-wizard/features/summary/summary-slice.d.ts +0 -14
- package/build/build-cjs/booking-wizard/features/summary/summary.d.ts +0 -4
- package/build/build-cjs/booking-wizard/features/travelers-form/controls/gender-control.d.ts +0 -5
- package/build/build-cjs/booking-wizard/features/travelers-form/travelers-form-slice.d.ts +0 -75
- package/build/build-cjs/booking-wizard/features/travelers-form/travelers-form-util.d.ts +0 -7
- package/build/build-cjs/booking-wizard/features/travelers-form/travelers-form.d.ts +0 -4
- package/build/build-cjs/booking-wizard/features/travelers-form/type-ahead-input.d.ts +0 -16
- package/build/build-cjs/booking-wizard/features/travelers-form/validate-form.d.ts +0 -11
- package/build/build-cjs/booking-wizard/index.d.ts +0 -12
- package/build/build-cjs/booking-wizard/settings-context.d.ts +0 -5
- package/build/build-cjs/booking-wizard/store.d.ts +0 -44
- package/build/build-cjs/booking-wizard/types.d.ts +0 -281
- package/build/build-cjs/booking-wizard/use-offer-printer.d.ts +0 -19
- package/build/build-cjs/index.d.ts +0 -3
- package/build/build-cjs/index.js +0 -25632
- package/build/build-cjs/shared/components/loader.d.ts +0 -6
- package/build/build-cjs/shared/types.d.ts +0 -4
- package/build/build-cjs/shared/utils/class-util.d.ts +0 -1
- package/build/build-cjs/shared/utils/localization-util.d.ts +0 -265
- package/build/build-cjs/shared/utils/query-string-util.d.ts +0 -29
- package/build/build-cjs/shared/utils/tide-api-utils.d.ts +0 -6
- package/build/build-esm/booking-product/components/age-select.d.ts +0 -8
- package/build/build-esm/booking-product/components/amount-input.d.ts +0 -10
- package/build/build-esm/booking-product/components/date-range-picker/calendar-day.d.ts +0 -12
- package/build/build-esm/booking-product/components/date-range-picker/calendar.d.ts +0 -19
- package/build/build-esm/booking-product/components/date-range-picker/index.d.ts +0 -20
- package/build/build-esm/booking-product/components/dates.d.ts +0 -9
- package/build/build-esm/booking-product/components/footer.d.ts +0 -10
- package/build/build-esm/booking-product/components/header.d.ts +0 -11
- package/build/build-esm/booking-product/components/icon.d.ts +0 -10
- package/build/build-esm/booking-product/components/product.d.ts +0 -9
- package/build/build-esm/booking-product/components/rating.d.ts +0 -6
- package/build/build-esm/booking-product/components/rooms.d.ts +0 -10
- package/build/build-esm/booking-product/index.d.ts +0 -10
- package/build/build-esm/booking-product/settings-context.d.ts +0 -5
- package/build/build-esm/booking-product/types.d.ts +0 -25
- package/build/build-esm/booking-product/utils/api.d.ts +0 -16
- package/build/build-esm/booking-product/utils/price.d.ts +0 -10
- package/build/build-esm/booking-wizard/api-settings-slice.d.ts +0 -14
- package/build/build-esm/booking-wizard/components/icon.d.ts +0 -10
- package/build/build-esm/booking-wizard/components/labeled-input.d.ts +0 -18
- package/build/build-esm/booking-wizard/components/labeled-select.d.ts +0 -21
- package/build/build-esm/booking-wizard/components/message.d.ts +0 -9
- package/build/build-esm/booking-wizard/components/multi-range-filter.d.ts +0 -11
- package/build/build-esm/booking-wizard/components/phone-input.d.ts +0 -17
- package/build/build-esm/booking-wizard/components/print-offer-button.d.ts +0 -17
- package/build/build-esm/booking-wizard/components/product-card.d.ts +0 -8
- package/build/build-esm/booking-wizard/components/step-indicator.d.ts +0 -6
- package/build/build-esm/booking-wizard/components/step-route.d.ts +0 -9
- package/build/build-esm/booking-wizard/features/booking/api.d.ts +0 -29
- package/build/build-esm/booking-wizard/features/booking/booking-self-contained.d.ts +0 -8
- package/build/build-esm/booking-wizard/features/booking/booking-slice.d.ts +0 -182
- package/build/build-esm/booking-wizard/features/booking/booking.d.ts +0 -8
- package/build/build-esm/booking-wizard/features/booking/constants.d.ts +0 -15
- package/build/build-esm/booking-wizard/features/booking/selectors.d.ts +0 -391
- package/build/build-esm/booking-wizard/features/confirmation/confirmation.d.ts +0 -4
- package/build/build-esm/booking-wizard/features/error/error.d.ts +0 -4
- package/build/build-esm/booking-wizard/features/flight-options/flight-filter.d.ts +0 -9
- package/build/build-esm/booking-wizard/features/flight-options/flight-option-flight.d.ts +0 -8
- package/build/build-esm/booking-wizard/features/flight-options/flight-option-modal.d.ts +0 -3
- package/build/build-esm/booking-wizard/features/flight-options/flight-option.d.ts +0 -10
- package/build/build-esm/booking-wizard/features/flight-options/flight-utils.d.ts +0 -16
- package/build/build-esm/booking-wizard/features/flight-options/index.d.ts +0 -4
- package/build/build-esm/booking-wizard/features/price-details/price-details-api.d.ts +0 -15
- package/build/build-esm/booking-wizard/features/price-details/price-details-slice.d.ts +0 -121
- package/build/build-esm/booking-wizard/features/price-details/util.d.ts +0 -5
- package/build/build-esm/booking-wizard/features/product-options/no-options.d.ts +0 -3
- package/build/build-esm/booking-wizard/features/product-options/none-option.d.ts +0 -17
- package/build/build-esm/booking-wizard/features/product-options/option-booking-airline-group.d.ts +0 -17
- package/build/build-esm/booking-wizard/features/product-options/option-booking-group.d.ts +0 -18
- package/build/build-esm/booking-wizard/features/product-options/option-item.d.ts +0 -11
- package/build/build-esm/booking-wizard/features/product-options/option-pax-card.d.ts +0 -13
- package/build/build-esm/booking-wizard/features/product-options/option-pax-group.d.ts +0 -20
- package/build/build-esm/booking-wizard/features/product-options/option-room.d.ts +0 -19
- package/build/build-esm/booking-wizard/features/product-options/option-unit-group.d.ts +0 -20
- package/build/build-esm/booking-wizard/features/product-options/option-units-card.d.ts +0 -9
- package/build/build-esm/booking-wizard/features/product-options/options-form.d.ts +0 -4
- package/build/build-esm/booking-wizard/features/room-options/index.d.ts +0 -4
- package/build/build-esm/booking-wizard/features/room-options/room-utils.d.ts +0 -29
- package/build/build-esm/booking-wizard/features/room-options/room.d.ts +0 -15
- package/build/build-esm/booking-wizard/features/room-options/traveler-rooms.d.ts +0 -13
- package/build/build-esm/booking-wizard/features/sidebar/index.d.ts +0 -7
- package/build/build-esm/booking-wizard/features/sidebar/sidebar-flight.d.ts +0 -8
- package/build/build-esm/booking-wizard/features/sidebar/sidebar-util.d.ts +0 -31
- package/build/build-esm/booking-wizard/features/sidebar/sidebar.d.ts +0 -30
- package/build/build-esm/booking-wizard/features/summary/summary-booking-option-pax.d.ts +0 -7
- package/build/build-esm/booking-wizard/features/summary/summary-booking-option-unit.d.ts +0 -7
- package/build/build-esm/booking-wizard/features/summary/summary-flight.d.ts +0 -8
- package/build/build-esm/booking-wizard/features/summary/summary-per-booking-option-group.d.ts +0 -10
- package/build/build-esm/booking-wizard/features/summary/summary-per-pax-option-group.d.ts +0 -10
- package/build/build-esm/booking-wizard/features/summary/summary-per-unit-option-group.d.ts +0 -10
- package/build/build-esm/booking-wizard/features/summary/summary-slice.d.ts +0 -14
- package/build/build-esm/booking-wizard/features/summary/summary.d.ts +0 -4
- package/build/build-esm/booking-wizard/features/travelers-form/controls/gender-control.d.ts +0 -5
- package/build/build-esm/booking-wizard/features/travelers-form/travelers-form-slice.d.ts +0 -75
- package/build/build-esm/booking-wizard/features/travelers-form/travelers-form-util.d.ts +0 -7
- package/build/build-esm/booking-wizard/features/travelers-form/travelers-form.d.ts +0 -4
- package/build/build-esm/booking-wizard/features/travelers-form/type-ahead-input.d.ts +0 -16
- package/build/build-esm/booking-wizard/features/travelers-form/validate-form.d.ts +0 -11
- package/build/build-esm/booking-wizard/index.d.ts +0 -12
- package/build/build-esm/booking-wizard/settings-context.d.ts +0 -5
- package/build/build-esm/booking-wizard/store.d.ts +0 -44
- package/build/build-esm/booking-wizard/types.d.ts +0 -281
- package/build/build-esm/booking-wizard/use-offer-printer.d.ts +0 -19
- package/build/build-esm/index.d.ts +0 -3
- package/build/build-esm/index.js +0 -25159
- package/build/build-esm/shared/components/loader.d.ts +0 -6
- package/build/build-esm/shared/types.d.ts +0 -4
- package/build/build-esm/shared/utils/class-util.d.ts +0 -1
- package/build/build-esm/shared/utils/localization-util.d.ts +0 -265
- package/build/build-esm/shared/utils/query-string-util.d.ts +0 -29
- package/build/build-esm/shared/utils/tide-api-utils.d.ts +0 -6
package/.prettierrc
ADDED
package/README.md
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
# README
|
|
2
2
|
|
|
3
|
-
This is the unified Tide Booking
|
|
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
|
|
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.
|
|
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": "
|
|
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.
|
|
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
|
|
2
|
-
import del from
|
|
3
|
-
import json from
|
|
4
|
-
import nodeResolve from
|
|
5
|
-
import packageJson from
|
|
6
|
-
import peerDepsExternal from
|
|
7
|
-
import typescript from
|
|
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:
|
|
10
|
+
input: 'src/index.ts',
|
|
11
11
|
output: [
|
|
12
|
-
{ file: packageJson.main, format:
|
|
13
|
-
{ file: packageJson.module, format:
|
|
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
|
|
2
|
-
import React, { useContext } from
|
|
3
|
-
import { getTranslations } from
|
|
4
|
-
import SettingsContext from
|
|
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
|
|
2
|
-
import { getTranslations } from
|
|
3
|
-
import SettingsContext from
|
|
4
|
-
import { buildClassName } from
|
|
5
|
-
import Icon from
|
|
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
|
|
2
|
-
import { getDate, isToday } from
|
|
3
|
-
import { buildClassName } from
|
|
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
|
-
|
|
39
|
-
isToday(day) &&
|
|
40
|
-
isDisabled &&
|
|
41
|
-
isOutsideMonth &&
|
|
42
|
-
isSelected &&
|
|
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
|
-
|
|
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
|
|
15
|
-
import { chunk, isFunction, range } from
|
|
16
|
-
import React, { useContext } from
|
|
17
|
-
import { buildClassName } from
|
|
18
|
-
import { getLocale } from
|
|
19
|
-
import SettingsContext from
|
|
20
|
-
import CalendarDay from
|
|
21
|
-
import Icon from
|
|
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
|
-
|
|
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
|
-
|
|
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],
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
|
2
|
-
import React, { useContext, useEffect, useState } from
|
|
3
|
-
import { usePopper } from
|
|
4
|
-
import { buildClassName } from
|
|
5
|
-
import { getTranslations } from
|
|
6
|
-
import SettingsContext from
|
|
7
|
-
import { DateRange } from
|
|
8
|
-
import DateRangePicker from
|
|
9
|
-
import Icon from
|
|
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
|
-
|
|
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:
|
|
27
|
+
placement: 'top',
|
|
34
28
|
modifiers: [
|
|
35
29
|
{
|
|
36
|
-
name:
|
|
30
|
+
name: 'offset',
|
|
37
31
|
options: {
|
|
38
|
-
offset: [0, -40]
|
|
39
|
-
}
|
|
32
|
+
offset: [0, -40]
|
|
33
|
+
}
|
|
40
34
|
},
|
|
41
35
|
{
|
|
42
|
-
name:
|
|
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(
|
|
56
|
+
document.addEventListener('mousedown', handleDocumentClick);
|
|
63
57
|
return () => {
|
|
64
|
-
document.removeEventListener(
|
|
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,
|
|
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,
|
|
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
|
-
|
|
110
|
-
panelActive &&
|
|
111
|
-
!mql?.matches &&
|
|
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 && (
|