@tripian/react 9.3.5 → 9.3.6

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/index.js CHANGED
@@ -27464,7 +27464,6 @@ const match_sorter_1 = __webpack_require__(827);
27464
27464
  const CitySearchModal_1 = __importDefault(__webpack_require__(828));
27465
27465
  const DestinationSelect_scss_1 = __importDefault(__webpack_require__(829));
27466
27466
  const DestinationSelect = ({ options, selectedOptionId, onSelectedOptionChange, placeHolder = 'Please select', disabled = false, onFocus, onBlur, showAiSuggestions = false, suggestions = [], onSuggestionsSearch, isSearching = false, onSelectSuggestedCity, onClearSuggestions, t, showSearchIcon = false, }) => {
27467
- var _a;
27468
27467
  const selectedOption = (0, react_1.useMemo)(() => options.find((option) => option.id === selectedOptionId), [selectedOptionId, options]);
27469
27468
  const [destinationSearchInput, setDestinationSearchInput] = (0, react_1.useState)('');
27470
27469
  const [isSuggestionsModalOpen, setSuggestionsModalOpen] = (0, react_1.useState)(false);
@@ -27482,17 +27481,21 @@ const DestinationSelect = ({ options, selectedOptionId, onSelectedOptionChange,
27482
27481
  }
27483
27482
  return null;
27484
27483
  };
27485
- const formatOptionLabel = (option) => {
27486
- var _a;
27487
- return (react_1.default.createElement(react_1.default.Fragment, null, option.payload && (react_1.default.createElement("div", { className: DestinationSelect_scss_1.default.optionLabel },
27488
- react_1.default.createElement("div", { className: "h-6 w-6" },
27489
- react_1.default.createElement("svg", { viewBox: "0 0 24 24", width: "24", height: "24", stroke: "currentColor", strokeWidth: "2", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" },
27490
- react_1.default.createElement("path", { d: "M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0118 0z" }),
27491
- react_1.default.createElement("circle", { cx: "12", cy: "10", r: "3" }))),
27492
- react_1.default.createElement("div", { className: DestinationSelect_scss_1.default.optionLabelText },
27493
- react_1.default.createElement("div", null, (_a = option.payload) === null || _a === void 0 ? void 0 : _a.destinationName),
27494
- react_1.default.createElement("div", null, option.payload.parentName))))));
27495
- };
27484
+ const SafeText = ({ text }) => (react_1.default.createElement(react_1.default.Fragment, null, text.split(' ').map((part, i) => (
27485
+ // eslint-disable-next-line react/no-array-index-key
27486
+ react_1.default.createElement("span", { key: i },
27487
+ part,
27488
+ " ")))));
27489
+ const formatOptionLabel = (option) => (react_1.default.createElement("div", { className: DestinationSelect_scss_1.default.optionLabel },
27490
+ react_1.default.createElement("div", { className: "h-6 w-6" },
27491
+ react_1.default.createElement("svg", { viewBox: "0 0 24 24", width: "24", height: "24", stroke: "currentColor", strokeWidth: "2", fill: "none" },
27492
+ react_1.default.createElement("path", { d: "M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0118 0z" }),
27493
+ react_1.default.createElement("circle", { cx: "12", cy: "10", r: "3" }))),
27494
+ react_1.default.createElement("div", { className: DestinationSelect_scss_1.default.optionLabelText },
27495
+ react_1.default.createElement("div", null,
27496
+ react_1.default.createElement(SafeText, { text: option.payload.destinationName })),
27497
+ react_1.default.createElement("div", null,
27498
+ react_1.default.createElement(SafeText, { text: option.payload.parentName })))));
27496
27499
  // Update lastSearchText whenever destinationSearchInput changes
27497
27500
  (0, react_1.useEffect)(() => {
27498
27501
  if (destinationSearchInput.trim() !== '') {
@@ -27561,7 +27564,7 @@ const DestinationSelect = ({ options, selectedOptionId, onSelectedOptionChange,
27561
27564
  react_1.default.createElement("div", { className: "relative", style: {
27562
27565
  ...(showSearchIcon ? { width: '100%' } : {}),
27563
27566
  } },
27564
- react_1.default.createElement(react_select_1.default, { key: (_a = selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.id) !== null && _a !== void 0 ? _a : 'empty', ref: selectRef, options: filteredOptions, value: selectedOption, onChange: handleChange, onInputChange: (value, meta) => {
27567
+ react_1.default.createElement(react_select_1.default, { ref: selectRef, options: filteredOptions, value: selectedOption, onChange: handleChange, onInputChange: (value, meta) => {
27565
27568
  if (meta.action === 'input-change') {
27566
27569
  setDestinationSearchInput(value);
27567
27570
  }
@@ -78575,7 +78578,7 @@ exports.default = CitySearchModal;
78575
78578
  /***/ (function(module, exports, __webpack_require__) {
78576
78579
 
78577
78580
  // extracted by mini-css-extract-plugin
78578
- module.exports = {"optionLabel":"components-DestinationSelect-DestinationSelect__optionLabel--2Gare","optionLabelText":"components-DestinationSelect-DestinationSelect__optionLabelText--2CoVy","aiSuggestionsButton":"components-DestinationSelect-DestinationSelect__aiSuggestionsButton--13IWJ"};
78581
+ module.exports = {"optionLabel":"components-DestinationSelect-DestinationSelect__optionLabel--2Gare","optionLabelText":"components-DestinationSelect-DestinationSelect__optionLabelText--2CoVy","aiSuggestionsButton":"components-DestinationSelect-DestinationSelect__aiSuggestionsButton--13IWJ","destinationSelect__option":"components-DestinationSelect-DestinationSelect__destinationSelect__option--3Jcu2"};
78579
78582
 
78580
78583
  /***/ }),
78581
78584
  /* 830 */