@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.mjs CHANGED
@@ -1484,6 +1484,8 @@ function FlightSearchWidget({
1484
1484
  const roomsGuestsMenuRef = useRef(null);
1485
1485
  const dateRangeCalendarRef = useRef(null);
1486
1486
  const mobileDateRangeCalendarRef = useRef(null);
1487
+ const oneWayDesktopCalendarRef = useRef(null);
1488
+ const oneWayMobileCalendarRef = useRef(null);
1487
1489
  const segmentCalendarRefs = useRef({});
1488
1490
  const getMaxSegments = () => {
1489
1491
  if (tripType === "custom-search") return 3;
@@ -2369,17 +2371,19 @@ function FlightSearchWidget({
2369
2371
  {
2370
2372
  className: "sw-form-field sw-pos-rel sw-com-cal",
2371
2373
  style: { cursor: "pointer" },
2372
- onClick: () => segmentCalendarRefs.current[0]?.show?.(),
2374
+ onClick: () => {
2375
+ oneWayDesktopCalendarRef.current?.show?.();
2376
+ oneWayMobileCalendarRef.current?.show?.();
2377
+ },
2373
2378
  children: [
2374
2379
  /* @__PURE__ */ jsx("label", { children: "Departure" }),
2375
2380
  /* @__PURE__ */ jsx("p", { children: formatDisplayDate(segments[0]?.departureDate) }),
2376
2381
  /* @__PURE__ */ jsx(
2377
2382
  Calendar,
2378
2383
  {
2384
+ id: "oneWayDepartureDesktop",
2379
2385
  numberOfMonths: 2,
2380
- ref: (el) => {
2381
- segmentCalendarRefs.current[0] = el;
2382
- },
2386
+ ref: oneWayDesktopCalendarRef,
2383
2387
  value: segments[0]?.departureDate ?? null,
2384
2388
  onChange: (e) => {
2385
2389
  const raw = e.value;
@@ -2399,10 +2403,9 @@ function FlightSearchWidget({
2399
2403
  /* @__PURE__ */ jsx(
2400
2404
  Calendar,
2401
2405
  {
2406
+ id: "oneWayDepartureMobile",
2402
2407
  numberOfMonths: 10,
2403
- ref: (el) => {
2404
- segmentCalendarRefs.current[0] = el;
2405
- },
2408
+ ref: oneWayMobileCalendarRef,
2406
2409
  value: segments[0]?.departureDate ?? null,
2407
2410
  onChange: (e) => {
2408
2411
  const raw = e.value;
@@ -2420,7 +2423,7 @@ function FlightSearchWidget({
2420
2423
  headerTemplate: () => /* @__PURE__ */ jsxs("div", { className: "mobileHead MobileShow", children: [
2421
2424
  /* @__PURE__ */ jsx("a", { type: "button", onClick: (e) => {
2422
2425
  e.stopPropagation();
2423
- segmentCalendarRefs.current[0]?.hide?.();
2426
+ oneWayMobileCalendarRef.current?.hide?.();
2424
2427
  }, children: /* @__PURE__ */ jsxs("svg", { width: "20px", height: "20px", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
2425
2428
  /* @__PURE__ */ jsx("path", { d: "M19 5L5 19", stroke: "black", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
2426
2429
  /* @__PURE__ */ jsx("path", { d: "M5 5L19 19", stroke: "black", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
@@ -2434,7 +2437,7 @@ function FlightSearchWidget({
2434
2437
  className: "sw-confirm-btn",
2435
2438
  onClick: (e) => {
2436
2439
  e.stopPropagation();
2437
- segmentCalendarRefs.current[0]?.hide?.();
2440
+ oneWayMobileCalendarRef.current?.hide?.();
2438
2441
  },
2439
2442
  children: "Confirm"
2440
2443
  }