@razorpay/blade 10.13.0 → 10.13.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.
@@ -23275,6 +23275,12 @@ var useControlledDropdownInput = function useControlledDropdownInput(props) {
23275
23275
  setIsControlled(true);
23276
23276
  }
23277
23277
  selectValues(props.value);
23278
+
23279
+ // in single select AutoComplete, we have to set inputValue of autocomplete according to the new selection.
23280
+ if (selectionType === 'single' && !Array.isArray(props.value) && !props.isSelectInput) {
23281
+ var _props$syncInputValue;
23282
+ (_props$syncInputValue = props.syncInputValueWithSelection) === null || _props$syncInputValue === void 0 ? void 0 : _props$syncInputValue.call(props, props.value);
23283
+ }
23278
23284
  }
23279
23285
  // eslint-disable-next-line react-hooks/exhaustive-deps
23280
23286
  }, [props.value, options]);
@@ -23336,7 +23342,9 @@ var _BaseDropdownInputTrigger = function _BaseDropdownInputTrigger(props, ref) {
23336
23342
  onChange: props.onChange,
23337
23343
  name: props.name,
23338
23344
  value: props.value,
23339
- defaultValue: props.defaultValue
23345
+ defaultValue: props.defaultValue,
23346
+ syncInputValueWithSelection: props.syncInputValueWithSelection,
23347
+ isSelectInput: props.isSelectInput
23340
23348
  });
23341
23349
  var getValue = function getValue() {
23342
23350
  var prefix = '';
@@ -23629,7 +23637,7 @@ var useAutoComplete = function useAutoComplete(_ref) {
23629
23637
  // eslint-disable-next-line no-lonely-if
23630
23638
  if (value && options && options.length > 0) {
23631
23639
  var filteredOptions = getOptionValues().filter(function (optionValue) {
23632
- return optionValue.toLowerCase().startsWith(value.toLowerCase());
23640
+ return optionValue.toLowerCase().includes(value.toLowerCase());
23633
23641
  });
23634
23642
  setGlobalFilteredValues(filteredOptions);
23635
23643
  } else {
@@ -23739,6 +23747,17 @@ var _AutoComplete = function _AutoComplete(props, ref) {
23739
23747
  onChange: onSelectionChange,
23740
23748
  isSelectInput: false,
23741
23749
  inputValue: inputValue,
23750
+ syncInputValueWithSelection: function syncInputValueWithSelection(value) {
23751
+ var _selectedOption$title;
23752
+ if (!value) {
23753
+ setInputValue('');
23754
+ return;
23755
+ }
23756
+ var selectedOption = options.find(function (option) {
23757
+ return option.value === value;
23758
+ });
23759
+ setInputValue((_selectedOption$title = selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.title) !== null && _selectedOption$title !== void 0 ? _selectedOption$title : '');
23760
+ },
23742
23761
  onTriggerKeydown: onTriggerKeydown,
23743
23762
  onInputValueChange: onInputValueChange,
23744
23763
  onTriggerClick: function onTriggerClick(triggerEvent) {