@razorpay/blade 10.12.1 → 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.
@@ -5452,6 +5452,7 @@ declare const SelectInput: React__default.ForwardRefExoticComponent<(({
5452
5452
  name?: string | undefined;
5453
5453
  values: string[];
5454
5454
  }) => void) | undefined;
5455
+ syncInputValueWithSelection?: ((value: string) => void) | undefined;
5455
5456
  maxRows?: "multiple" | "single" | "expandable" | undefined;
5456
5457
  labelPosition?: "left" | "top" | "inside-input" | undefined;
5457
5458
  }) & React__default.RefAttributes<BladeElementRef>>;
@@ -5510,6 +5511,7 @@ declare const AutoComplete: React__default.ForwardRefExoticComponent<Pick<BaseIn
5510
5511
  name?: string | undefined;
5511
5512
  values: string[];
5512
5513
  }) => void) | undefined;
5514
+ syncInputValueWithSelection?: ((value: string) => void) | undefined;
5513
5515
  maxRows?: "multiple" | "single" | "expandable" | undefined;
5514
5516
  labelPosition?: "left" | "top" | "inside-input" | undefined;
5515
5517
  } & {
@@ -5534,6 +5536,12 @@ declare type DropdownInputTriggersCommonProps = Pick<BaseInputProps, 'label' | '
5534
5536
  name?: string;
5535
5537
  values: string[];
5536
5538
  }) => void;
5539
+ /**
5540
+ * Syncs the selected value to inputValue in AutoComplete
5541
+ *
5542
+ * Only needed in single select AutoComplete because inputValue is expected to be same as selected value there
5543
+ */
5544
+ syncInputValueWithSelection?: (value: string) => void;
5537
5545
  /**
5538
5546
  * constraints the height of input to given number rows
5539
5547
  *
@@ -3077,7 +3077,7 @@ function _objectSpread$6g(target) { for (var i = 1; i < arguments.length; i++) {
3077
3077
  /**
3078
3078
  * Reusable hook to be used in BladeProvider.native & BladeProvider.web file
3079
3079
  *
3080
- * This hook proccesses incoming themeTokens & initialColorScheme
3080
+ * This hook processes incoming themeTokens & initialColorScheme
3081
3081
  * And validates & returns the theme values
3082
3082
  */
3083
3083
  var useBladeProvider = function useBladeProvider(_ref) {
@@ -14583,7 +14583,7 @@ var CheckedIcon$1 = function CheckedIcon(_ref) {
14583
14583
  clipRule: "evenodd",
14584
14584
  d: "M6.90237 1.76413C7.03254 1.89431 7.03254 2.10536 6.90237 2.23554L3.2357 5.90221C3.10553 6.03238 2.89447 6.03238 2.7643 5.90221L1.09763 4.23554C0.967456 4.10536 0.967456 3.89431 1.09763 3.76414C1.22781 3.63396 1.43886 3.63396 1.56904 3.76414L3 5.1951L6.43096 1.76413C6.56114 1.63396 6.77219 1.63396 6.90237 1.76413Z",
14585
14585
  fill: color,
14586
- stroke: "white",
14586
+ stroke: color,
14587
14587
  strokeWidth: "0.5",
14588
14588
  strokeLinecap: "round",
14589
14589
  strokeLinejoin: "round"
@@ -14605,7 +14605,7 @@ var IndeterminateIcon = function IndeterminateIcon(_ref2) {
14605
14605
  clipRule: "evenodd",
14606
14606
  d: "M1.3335 3.99984C1.3335 3.81574 1.48273 3.6665 1.66683 3.6665H6.3335C6.51759 3.6665 6.66683 3.81574 6.66683 3.99984C6.66683 4.18393 6.51759 4.33317 6.3335 4.33317H1.66683C1.48273 4.33317 1.3335 4.18393 1.3335 3.99984Z",
14607
14607
  fill: color,
14608
- stroke: "white",
14608
+ stroke: color,
14609
14609
  strokeWidth: "0.5",
14610
14610
  strokeLinecap: "round",
14611
14611
  strokeLinejoin: "round"
@@ -19733,14 +19733,14 @@ var chipColorTokens = {
19733
19733
  text: {
19734
19734
  unchecked: 'surface.text.subtle.lowContrast',
19735
19735
  disabled: 'surface.text.placeholder.lowContrast',
19736
- none: 'brand.primary.500',
19736
+ none: 'action.text.secondary.default',
19737
19737
  positive: 'feedback.text.positive.lowContrast',
19738
19738
  negative: 'feedback.text.negative.lowContrast'
19739
19739
  },
19740
19740
  icon: {
19741
19741
  unchecked: 'surface.text.subtle.lowContrast',
19742
19742
  disabled: 'surface.text.placeholder.lowContrast',
19743
- none: 'brand.primary.500',
19743
+ none: 'action.icon.secondary.default',
19744
19744
  positive: 'feedback.icon.positive.lowContrast',
19745
19745
  negative: 'feedback.icon.negative.lowContrast'
19746
19746
  },
@@ -23674,6 +23674,12 @@ var useControlledDropdownInput = function useControlledDropdownInput(props) {
23674
23674
  setIsControlled(true);
23675
23675
  }
23676
23676
  selectValues(props.value);
23677
+
23678
+ // in single select AutoComplete, we have to set inputValue of autocomplete according to the new selection.
23679
+ if (selectionType === 'single' && !Array.isArray(props.value) && !props.isSelectInput) {
23680
+ var _props$syncInputValue;
23681
+ (_props$syncInputValue = props.syncInputValueWithSelection) === null || _props$syncInputValue === void 0 ? void 0 : _props$syncInputValue.call(props, props.value);
23682
+ }
23677
23683
  }
23678
23684
  // eslint-disable-next-line react-hooks/exhaustive-deps
23679
23685
  }, [props.value, options]);
@@ -23735,7 +23741,9 @@ var _BaseDropdownInputTrigger = function _BaseDropdownInputTrigger(props, ref) {
23735
23741
  onChange: props.onChange,
23736
23742
  name: props.name,
23737
23743
  value: props.value,
23738
- defaultValue: props.defaultValue
23744
+ defaultValue: props.defaultValue,
23745
+ syncInputValueWithSelection: props.syncInputValueWithSelection,
23746
+ isSelectInput: props.isSelectInput
23739
23747
  });
23740
23748
  var getValue = function getValue() {
23741
23749
  var prefix = '';
@@ -24028,7 +24036,7 @@ var useAutoComplete = function useAutoComplete(_ref) {
24028
24036
  // eslint-disable-next-line no-lonely-if
24029
24037
  if (value && options && options.length > 0) {
24030
24038
  var filteredOptions = getOptionValues().filter(function (optionValue) {
24031
- return optionValue.toLowerCase().startsWith(value.toLowerCase());
24039
+ return optionValue.toLowerCase().includes(value.toLowerCase());
24032
24040
  });
24033
24041
  setGlobalFilteredValues(filteredOptions);
24034
24042
  } else {
@@ -24138,6 +24146,17 @@ var _AutoComplete = function _AutoComplete(props, ref) {
24138
24146
  onChange: onSelectionChange,
24139
24147
  isSelectInput: false,
24140
24148
  inputValue: inputValue,
24149
+ syncInputValueWithSelection: function syncInputValueWithSelection(value) {
24150
+ var _selectedOption$title;
24151
+ if (!value) {
24152
+ setInputValue('');
24153
+ return;
24154
+ }
24155
+ var selectedOption = options.find(function (option) {
24156
+ return option.value === value;
24157
+ });
24158
+ setInputValue((_selectedOption$title = selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.title) !== null && _selectedOption$title !== void 0 ? _selectedOption$title : '');
24159
+ },
24141
24160
  onTriggerKeydown: onTriggerKeydown,
24142
24161
  onInputValueChange: onInputValueChange,
24143
24162
  onTriggerClick: function onTriggerClick(triggerEvent) {