@algorithm-shift/design-system 1.2.956 → 1.2.957

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/dist/index.d.mts CHANGED
@@ -334,8 +334,8 @@ interface LazyMultiSelectDropdownProps extends Omit<any, 'lazyLoad'> {
334
334
  pageSize?: number;
335
335
  dataKey?: string;
336
336
  dataLabel?: string;
337
- value: string[] | string;
338
- onChange: (val: string[] | string, id?: string) => void;
337
+ value?: string[] | string;
338
+ onChange?: (val: string[] | string, id?: string) => void;
339
339
  errorMessage?: string;
340
340
  axiosInstance?: any;
341
341
  outputFormat?: 'array' | 'comma' | 'semicolon';
package/dist/index.d.ts CHANGED
@@ -334,8 +334,8 @@ interface LazyMultiSelectDropdownProps extends Omit<any, 'lazyLoad'> {
334
334
  pageSize?: number;
335
335
  dataKey?: string;
336
336
  dataLabel?: string;
337
- value: string[] | string;
338
- onChange: (val: string[] | string, id?: string) => void;
337
+ value?: string[] | string;
338
+ onChange?: (val: string[] | string, id?: string) => void;
339
339
  errorMessage?: string;
340
340
  axiosInstance?: any;
341
341
  outputFormat?: 'array' | 'comma' | 'semicolon';
package/dist/index.js CHANGED
@@ -27853,8 +27853,14 @@ function useLazyDropdown(config) {
27853
27853
  (0, import_react19.useEffect)(() => {
27854
27854
  const cfg = configRef.current;
27855
27855
  if (!cfg.enabled || !cfg.value || cfg.dataSource !== "api" || !cfg.apiUrl) return;
27856
- const valueExists = options.some((opt) => opt.value === cfg.value);
27857
- if (valueExists) return;
27856
+ if (!!cfg.isMultiSelect) {
27857
+ const values = String(cfg.value).split(",").map((v) => v.trim());
27858
+ const valueExists = values.every((val) => options.some((opt) => opt.value === val));
27859
+ if (valueExists) return;
27860
+ } else {
27861
+ const valueExists = options.some((opt) => opt.value === cfg.value);
27862
+ if (valueExists) return;
27863
+ }
27858
27864
  fetchValueItem();
27859
27865
  }, [config.value, config.dataKey, config.apiUrl, config.dataSource, transformToOptions]);
27860
27866
  const loadMore = (0, import_react19.useCallback)(() => {
@@ -28777,7 +28783,8 @@ function LazyMultiSelectDropdown({
28777
28783
  dataLabel,
28778
28784
  initialData: options || [],
28779
28785
  value,
28780
- axiosInstance
28786
+ axiosInstance,
28787
+ isMultiSelect: true
28781
28788
  });
28782
28789
  const ensureUnique = (arr) => {
28783
28790
  return Array.from(new Set(arr));
@@ -28841,11 +28848,11 @@ function LazyMultiSelectDropdown({
28841
28848
  } else {
28842
28849
  updated = ensureUnique([...normalizedValue, val]);
28843
28850
  }
28844
- onChange(convertOutput(updated), id);
28851
+ onChange?.(convertOutput(updated), id);
28845
28852
  };
28846
28853
  const removeTag = (val) => {
28847
28854
  const updated = normalizedValue.filter((v) => v !== val);
28848
- onChange(convertOutput(updated), id);
28855
+ onChange?.(convertOutput(updated), id);
28849
28856
  };
28850
28857
  const handleFocus = () => {
28851
28858
  if (!disabled) setIsOpen(true);