@travelswitchhq/flight-search-react 1.0.6 → 1.0.7

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/dist/index.cjs CHANGED
@@ -1510,6 +1510,8 @@ function FlightSearchWidget({
1510
1510
  const roomsGuestsMenuRef = (0, import_react.useRef)(null);
1511
1511
  const dateRangeCalendarRef = (0, import_react.useRef)(null);
1512
1512
  const mobileDateRangeCalendarRef = (0, import_react.useRef)(null);
1513
+ const oneWayDesktopCalendarRef = (0, import_react.useRef)(null);
1514
+ const oneWayMobileCalendarRef = (0, import_react.useRef)(null);
1513
1515
  const segmentCalendarRefs = (0, import_react.useRef)({});
1514
1516
  const getMaxSegments = () => {
1515
1517
  if (tripType === "custom-search") return 3;
@@ -2395,17 +2397,19 @@ function FlightSearchWidget({
2395
2397
  {
2396
2398
  className: "sw-form-field sw-pos-rel sw-com-cal",
2397
2399
  style: { cursor: "pointer" },
2398
- onClick: () => segmentCalendarRefs.current[0]?.show?.(),
2400
+ onClick: () => {
2401
+ oneWayDesktopCalendarRef.current?.show?.();
2402
+ oneWayMobileCalendarRef.current?.show?.();
2403
+ },
2399
2404
  children: [
2400
2405
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { children: "Departure" }),
2401
2406
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: formatDisplayDate(segments[0]?.departureDate) }),
2402
2407
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2403
2408
  import_calendar.Calendar,
2404
2409
  {
2410
+ id: "oneWayDepartureDesktop",
2405
2411
  numberOfMonths: 2,
2406
- ref: (el) => {
2407
- segmentCalendarRefs.current[0] = el;
2408
- },
2412
+ ref: oneWayDesktopCalendarRef,
2409
2413
  value: segments[0]?.departureDate ?? null,
2410
2414
  onChange: (e) => {
2411
2415
  const raw = e.value;
@@ -2425,10 +2429,9 @@ function FlightSearchWidget({
2425
2429
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2426
2430
  import_calendar.Calendar,
2427
2431
  {
2432
+ id: "oneWayDepartureMobile",
2428
2433
  numberOfMonths: 10,
2429
- ref: (el) => {
2430
- segmentCalendarRefs.current[0] = el;
2431
- },
2434
+ ref: oneWayMobileCalendarRef,
2432
2435
  value: segments[0]?.departureDate ?? null,
2433
2436
  onChange: (e) => {
2434
2437
  const raw = e.value;
@@ -2446,7 +2449,7 @@ function FlightSearchWidget({
2446
2449
  headerTemplate: () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "mobileHead MobileShow", children: [
2447
2450
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { type: "button", onClick: (e) => {
2448
2451
  e.stopPropagation();
2449
- segmentCalendarRefs.current[0]?.hide?.();
2452
+ oneWayMobileCalendarRef.current?.hide?.();
2450
2453
  }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { width: "20px", height: "20px", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
2451
2454
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M19 5L5 19", stroke: "black", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
2452
2455
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M5 5L19 19", stroke: "black", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
@@ -2460,7 +2463,7 @@ function FlightSearchWidget({
2460
2463
  className: "sw-confirm-btn",
2461
2464
  onClick: (e) => {
2462
2465
  e.stopPropagation();
2463
- segmentCalendarRefs.current[0]?.hide?.();
2466
+ oneWayMobileCalendarRef.current?.hide?.();
2464
2467
  },
2465
2468
  children: "Confirm"
2466
2469
  }