x-ui-design 0.7.21 → 0.7.22

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.
@@ -192,7 +192,7 @@ const Select = ({
192
192
  }, [autoClearSearchValue, prefixCls, prefixClsV3]);
193
193
 
194
194
  useEffect(() => {
195
- setSelected(hasMode ? checkModeInitialValue : initialValue)
195
+ !controlled && setSelected(hasMode ? checkModeInitialValue : initialValue)
196
196
  }, [checkModeInitialValue, hasMode, initialValue])
197
197
 
198
198
  const handleClickOutside = useCallback((event?: MouseEvent): void => {
@@ -367,7 +367,7 @@ const Select = ({
367
367
  const updatedSelected = [...selected, newOptionValue];
368
368
 
369
369
  onChange?.(updatedSelected);
370
- onSelect?.(updatedSelected);
370
+ !controlled && onSelect?.(updatedSelected);
371
371
 
372
372
  const input = selectRef.current?.querySelector('input');
373
373
 
@@ -375,7 +375,7 @@ const Select = ({
375
375
  input.value = '';
376
376
  }
377
377
 
378
- setSelected(updatedSelected);
378
+ !controlled && setSelected(updatedSelected);
379
379
  handleClearInputValue();
380
380
  };
381
381
 
@@ -472,11 +472,11 @@ const Select = ({
472
472
  : e.target.value.trim();
473
473
 
474
474
  if (selected[selected.length - 1]) {
475
- onDeselect?.(selected[selected.length - 1]);
475
+ !controlled && onDeselect?.(selected[selected.length - 1]);
476
476
  }
477
477
 
478
478
  onChange?.(updatedSelected);
479
- setSelected(updatedSelected);
479
+ !controlled && setSelected(updatedSelected);
480
480
  setSearchFocused(false);
481
481
  }
482
482
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x-ui-design",
3
- "version": "0.7.21",
3
+ "version": "0.7.22",
4
4
  "license": "ISC",
5
5
  "author": "Gabriel Boyajyan",
6
6
  "main": "dist/index.js",