@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.mjs
CHANGED
|
@@ -1751,12 +1751,6 @@ function FlightSearchWidget({
|
|
|
1751
1751
|
getAirlineListBySearch(value).then(setAirlineSuggestions);
|
|
1752
1752
|
}, DEBOUNCE_MS);
|
|
1753
1753
|
}, [getAirlineListBySearch]);
|
|
1754
|
-
useEffect(() => {
|
|
1755
|
-
if (typeof window === "undefined") return;
|
|
1756
|
-
if (window.matchMedia("(max-width: 768px)").matches) {
|
|
1757
|
-
setIsOriginDropdownOpen(false);
|
|
1758
|
-
}
|
|
1759
|
-
}, []);
|
|
1760
1754
|
useEffect(() => () => {
|
|
1761
1755
|
if (searchDebounceRef.current) clearTimeout(searchDebounceRef.current);
|
|
1762
1756
|
if (airlineSearchDebounceRef.current) clearTimeout(airlineSearchDebounceRef.current);
|
|
@@ -1779,21 +1773,9 @@ function FlightSearchWidget({
|
|
|
1779
1773
|
useEffect(() => {
|
|
1780
1774
|
ensureStylesInjected();
|
|
1781
1775
|
ensurePrimeIconsLoaded();
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
const focusFirstOrigin = () => {
|
|
1786
|
-
const desktop = firstOriginDesktopInputRef.current;
|
|
1787
|
-
desktop?.focus({ preventScroll: true });
|
|
1788
|
-
};
|
|
1789
|
-
let innerRaf = 0;
|
|
1790
|
-
const outerRaf = window.requestAnimationFrame(() => {
|
|
1791
|
-
innerRaf = window.requestAnimationFrame(focusFirstOrigin);
|
|
1792
|
-
});
|
|
1793
|
-
return () => {
|
|
1794
|
-
window.cancelAnimationFrame(outerRaf);
|
|
1795
|
-
if (innerRaf) window.cancelAnimationFrame(innerRaf);
|
|
1796
|
-
};
|
|
1776
|
+
setIsOriginDropdownOpen(false);
|
|
1777
|
+
setIsDestinationDropdownOpen(false);
|
|
1778
|
+
setSegmentDropdowns({});
|
|
1797
1779
|
}, []);
|
|
1798
1780
|
useEffect(() => {
|
|
1799
1781
|
const handleClickOutside = (event) => {
|
|
@@ -2206,15 +2188,18 @@ function FlightSearchWidget({
|
|
|
2206
2188
|
{
|
|
2207
2189
|
type: "text",
|
|
2208
2190
|
readOnly: true,
|
|
2191
|
+
autoComplete: "off",
|
|
2209
2192
|
id: `${dropdownType}-${segmentIndex}`,
|
|
2210
2193
|
className: `sw-custom-dropdown-trigger MobileShow ${value === placeholder || !value ? "sw-placeholder" : ""}`,
|
|
2211
2194
|
value: value === placeholder ? "" : value ?? "",
|
|
2212
2195
|
placeholder,
|
|
2213
2196
|
onFocus: (e) => {
|
|
2197
|
+
if (isOpen) e.currentTarget.select();
|
|
2198
|
+
},
|
|
2199
|
+
onClick: (e) => {
|
|
2214
2200
|
onOpen();
|
|
2215
2201
|
e.currentTarget.select();
|
|
2216
2202
|
},
|
|
2217
|
-
onClick: (e) => e.currentTarget.select(),
|
|
2218
2203
|
onChange: (e) => {
|
|
2219
2204
|
const val = e.target.value;
|
|
2220
2205
|
handleSegmentFieldChange(segmentIndex, dropdownType, val);
|
|
@@ -2232,11 +2217,14 @@ function FlightSearchWidget({
|
|
|
2232
2217
|
className: `sw-custom-dropdown-trigger MobileHide ${value === placeholder || !value ? "sw-placeholder" : ""}`,
|
|
2233
2218
|
value: value === placeholder ? "" : value ?? "",
|
|
2234
2219
|
placeholder,
|
|
2220
|
+
autoComplete: "off",
|
|
2235
2221
|
onFocus: (e) => {
|
|
2222
|
+
if (isOpen) e.currentTarget.select();
|
|
2223
|
+
},
|
|
2224
|
+
onClick: (e) => {
|
|
2236
2225
|
onOpen();
|
|
2237
2226
|
e.currentTarget.select();
|
|
2238
2227
|
},
|
|
2239
|
-
onClick: (e) => e.currentTarget.select(),
|
|
2240
2228
|
onChange: (e) => {
|
|
2241
2229
|
const val = e.target.value;
|
|
2242
2230
|
handleSegmentFieldChange(segmentIndex, dropdownType, val);
|