@tripian/react 9.3.2 → 9.3.4

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
@@ -27550,6 +27550,7 @@ const DestinationSelect = ({ options, selectedOptionId, onSelectedOptionChange,
27550
27550
  // Close the modal
27551
27551
  setSuggestionsModalOpen(false);
27552
27552
  };
27553
+ const filteredOptions = (0, react_1.useMemo)(() => (0, match_sorter_1.matchSorter)(options, destinationSearchInput, { keys: ['label'] }), [options, destinationSearchInput]);
27553
27554
  // Open modal and automatically search with current input
27554
27555
  const handleOpenSuggestionsModal = () => {
27555
27556
  setSuggestionsModalOpen(true);
@@ -27560,7 +27561,11 @@ const DestinationSelect = ({ options, selectedOptionId, onSelectedOptionChange,
27560
27561
  react_1.default.createElement("div", { className: "relative", style: {
27561
27562
  ...(showSearchIcon ? { width: '100%' } : {}),
27562
27563
  } },
27563
- react_1.default.createElement(react_select_1.default, { ref: selectRef, options: (0, match_sorter_1.matchSorter)(options, destinationSearchInput, { keys: ['label'] }), defaultValue: selectedOption, value: selectedOption, onChange: handleChange, onInputChange: (e) => setDestinationSearchInput(e), placeholder: placeHolder, className: "destinationSelect", classNamePrefix: "destinationSelect", isDisabled: disabled, isOptionDisabled: (option) => option.isSelected === true, isOptionSelected: (option) => option.isSelected === true, onFocus: () => onFocus && onFocus(), onBlur: () => onBlur && onBlur(), noOptionsMessage: noOptionsMessage, formatOptionLabel: formatOptionLabel, menuPlacement: "auto", menuPortalTarget: document.body, styles: {
27564
+ react_1.default.createElement(react_select_1.default, { ref: selectRef, options: filteredOptions, value: selectedOption, onChange: handleChange, onInputChange: (value, meta) => {
27565
+ if (meta.action === 'input-change') {
27566
+ setDestinationSearchInput(value);
27567
+ }
27568
+ }, placeholder: placeHolder, className: "destinationSelect", classNamePrefix: "destinationSelect", isDisabled: disabled, isOptionDisabled: (option) => option.id === selectedOptionId, onFocus: () => onFocus && onFocus(), onBlur: () => onBlur && onBlur(), noOptionsMessage: noOptionsMessage, formatOptionLabel: formatOptionLabel, menuPlacement: "auto", menuPortalTarget: document.body, styles: {
27564
27569
  menuPortal: (base) => ({ ...base, zIndex: 9999 }),
27565
27570
  } }),
27566
27571
  showAiSuggestions && (react_1.default.createElement(Button_1.default, { onClick: handleOpenSuggestionsModal, className: `px-3 py-1 bg-gradient-to-r from-blue-500 to-purple-600 text-white text-sm rounded-full shadow-md hover:shadow-lg transition-all flex items-center md:text-sm md:px-3 md:py-1 sm:text-xs sm:px-2 sm:py-0.5 ${DestinationSelect_scss_1.default.aiSuggestionsButton}`, style: { zIndex: 1 }, text: t('destination.ai.buttonText'), type: ButtonTypes_1.default.CONTAINED }))),