@algorithm-shift/design-system 1.2.996 → 1.2.998

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.mjs CHANGED
@@ -3164,7 +3164,7 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
3164
3164
  var TextInputGroup_default = TextInputGroup;
3165
3165
 
3166
3166
  // src/components/Inputs/Multiselect/MultiSelect.tsx
3167
- import { useState as useState10, useRef as useRef7, useEffect as useEffect25, useMemo as useMemo5, useCallback as useCallback3 } from "react";
3167
+ import { useState as useState10, useRef as useRef7, useEffect as useEffect25, useMemo as useMemo5 } from "react";
3168
3168
  import { XIcon, XSquareIcon as XSquareIcon3 } from "lucide-react";
3169
3169
  import { Fragment as Fragment19, jsx as jsx48, jsxs as jsxs28 } from "react/jsx-runtime";
3170
3170
  function LazyMultiSelectDropdown({
@@ -3187,7 +3187,6 @@ function LazyMultiSelectDropdown({
3187
3187
  }) {
3188
3188
  const [isOpen, setIsOpen] = useState10(false);
3189
3189
  const [searchTerm, setSearchTerm] = useState10("");
3190
- const [selectedDetails, setSelectedDetails] = useState10({});
3191
3190
  const dropdownRef = useRef7(null);
3192
3191
  const observerTarget = useRef7(null);
3193
3192
  const ensureUnique = (arr) => {
@@ -3242,24 +3241,8 @@ function LazyMultiSelectDropdown({
3242
3241
  return normalizedValue.map((id2) => {
3243
3242
  const fromLazy = lazyOptions.find((opt) => opt.value === id2);
3244
3243
  if (fromLazy) return fromLazy;
3245
- if (selectedDetails[id2]) return selectedDetails[id2];
3246
3244
  return { value: id2, label: id2 };
3247
3245
  });
3248
- }, [normalizedValue, lazyOptions, selectedDetails]);
3249
- useEffect25(() => {
3250
- const newDetails = { ...selectedDetails };
3251
- normalizedValue.forEach((id2) => {
3252
- const option = lazyOptions.find((opt) => opt.value === id2);
3253
- if (option && !newDetails[id2]) {
3254
- newDetails[id2] = option;
3255
- }
3256
- });
3257
- Object.keys(newDetails).forEach((key) => {
3258
- if (!normalizedValue.includes(key)) {
3259
- delete newDetails[key];
3260
- }
3261
- });
3262
- setSelectedDetails(newDetails);
3263
3246
  }, [normalizedValue, lazyOptions]);
3264
3247
  useEffect25(() => {
3265
3248
  const handleClick = (e) => {
@@ -3286,7 +3269,7 @@ function LazyMultiSelectDropdown({
3286
3269
  setSearchTerm(term);
3287
3270
  search(term);
3288
3271
  };
3289
- const toggleSelect = useCallback3((val) => {
3272
+ const toggleSelect = (val) => {
3290
3273
  let updated;
3291
3274
  if (normalizedValue.includes(val)) {
3292
3275
  updated = normalizedValue.filter((v) => v !== val);
@@ -3294,7 +3277,7 @@ function LazyMultiSelectDropdown({
3294
3277
  updated = ensureUnique([...normalizedValue, val]);
3295
3278
  }
3296
3279
  onChange?.(convertOutput(updated), id);
3297
- }, [normalizedValue, onChange, id, convertOutput]);
3280
+ };
3298
3281
  const removeTag = (val) => {
3299
3282
  const updated = normalizedValue.filter((v) => v !== val);
3300
3283
  onChange?.(convertOutput(updated), id);