@travelswitchhq/flight-search-react 1.2.0 → 1.2.1
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 +11 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +11 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1777,12 +1777,6 @@ function FlightSearchWidget({
|
|
|
1777
1777
|
getAirlineListBySearch(value).then(setAirlineSuggestions);
|
|
1778
1778
|
}, DEBOUNCE_MS);
|
|
1779
1779
|
}, [getAirlineListBySearch]);
|
|
1780
|
-
(0, import_react.useEffect)(() => {
|
|
1781
|
-
if (typeof window === "undefined") return;
|
|
1782
|
-
if (window.matchMedia("(max-width: 768px)").matches) {
|
|
1783
|
-
setIsOriginDropdownOpen(false);
|
|
1784
|
-
}
|
|
1785
|
-
}, []);
|
|
1786
1780
|
(0, import_react.useEffect)(() => () => {
|
|
1787
1781
|
if (searchDebounceRef.current) clearTimeout(searchDebounceRef.current);
|
|
1788
1782
|
if (airlineSearchDebounceRef.current) clearTimeout(airlineSearchDebounceRef.current);
|
|
@@ -1805,21 +1799,9 @@ function FlightSearchWidget({
|
|
|
1805
1799
|
(0, import_react.useEffect)(() => {
|
|
1806
1800
|
ensureStylesInjected();
|
|
1807
1801
|
ensurePrimeIconsLoaded();
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
const focusFirstOrigin = () => {
|
|
1812
|
-
const desktop = firstOriginDesktopInputRef.current;
|
|
1813
|
-
desktop?.focus({ preventScroll: true });
|
|
1814
|
-
};
|
|
1815
|
-
let innerRaf = 0;
|
|
1816
|
-
const outerRaf = window.requestAnimationFrame(() => {
|
|
1817
|
-
innerRaf = window.requestAnimationFrame(focusFirstOrigin);
|
|
1818
|
-
});
|
|
1819
|
-
return () => {
|
|
1820
|
-
window.cancelAnimationFrame(outerRaf);
|
|
1821
|
-
if (innerRaf) window.cancelAnimationFrame(innerRaf);
|
|
1822
|
-
};
|
|
1802
|
+
setIsOriginDropdownOpen(false);
|
|
1803
|
+
setIsDestinationDropdownOpen(false);
|
|
1804
|
+
setSegmentDropdowns({});
|
|
1823
1805
|
}, []);
|
|
1824
1806
|
(0, import_react.useEffect)(() => {
|
|
1825
1807
|
const handleClickOutside = (event) => {
|
|
@@ -2232,15 +2214,18 @@ function FlightSearchWidget({
|
|
|
2232
2214
|
{
|
|
2233
2215
|
type: "text",
|
|
2234
2216
|
readOnly: true,
|
|
2217
|
+
autoComplete: "off",
|
|
2235
2218
|
id: `${dropdownType}-${segmentIndex}`,
|
|
2236
2219
|
className: `sw-custom-dropdown-trigger MobileShow ${value === placeholder || !value ? "sw-placeholder" : ""}`,
|
|
2237
2220
|
value: value === placeholder ? "" : value ?? "",
|
|
2238
2221
|
placeholder,
|
|
2239
2222
|
onFocus: (e) => {
|
|
2223
|
+
if (isOpen) e.currentTarget.select();
|
|
2224
|
+
},
|
|
2225
|
+
onClick: (e) => {
|
|
2240
2226
|
onOpen();
|
|
2241
2227
|
e.currentTarget.select();
|
|
2242
2228
|
},
|
|
2243
|
-
onClick: (e) => e.currentTarget.select(),
|
|
2244
2229
|
onChange: (e) => {
|
|
2245
2230
|
const val = e.target.value;
|
|
2246
2231
|
handleSegmentFieldChange(segmentIndex, dropdownType, val);
|
|
@@ -2258,11 +2243,14 @@ function FlightSearchWidget({
|
|
|
2258
2243
|
className: `sw-custom-dropdown-trigger MobileHide ${value === placeholder || !value ? "sw-placeholder" : ""}`,
|
|
2259
2244
|
value: value === placeholder ? "" : value ?? "",
|
|
2260
2245
|
placeholder,
|
|
2246
|
+
autoComplete: "off",
|
|
2261
2247
|
onFocus: (e) => {
|
|
2248
|
+
if (isOpen) e.currentTarget.select();
|
|
2249
|
+
},
|
|
2250
|
+
onClick: (e) => {
|
|
2262
2251
|
onOpen();
|
|
2263
2252
|
e.currentTarget.select();
|
|
2264
2253
|
},
|
|
2265
|
-
onClick: (e) => e.currentTarget.select(),
|
|
2266
2254
|
onChange: (e) => {
|
|
2267
2255
|
const val = e.target.value;
|
|
2268
2256
|
handleSegmentFieldChange(segmentIndex, dropdownType, val);
|