@algorithm-shift/design-system 1.2.996 → 1.2.997
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.js +2 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -20
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3280,7 +3280,6 @@ function LazyMultiSelectDropdown({
|
|
|
3280
3280
|
}) {
|
|
3281
3281
|
const [isOpen, setIsOpen] = (0, import_react29.useState)(false);
|
|
3282
3282
|
const [searchTerm, setSearchTerm] = (0, import_react29.useState)("");
|
|
3283
|
-
const [selectedDetails, setSelectedDetails] = (0, import_react29.useState)({});
|
|
3284
3283
|
const dropdownRef = (0, import_react29.useRef)(null);
|
|
3285
3284
|
const observerTarget = (0, import_react29.useRef)(null);
|
|
3286
3285
|
const ensureUnique = (arr) => {
|
|
@@ -3335,24 +3334,8 @@ function LazyMultiSelectDropdown({
|
|
|
3335
3334
|
return normalizedValue.map((id2) => {
|
|
3336
3335
|
const fromLazy = lazyOptions.find((opt) => opt.value === id2);
|
|
3337
3336
|
if (fromLazy) return fromLazy;
|
|
3338
|
-
if (selectedDetails[id2]) return selectedDetails[id2];
|
|
3339
3337
|
return { value: id2, label: id2 };
|
|
3340
3338
|
});
|
|
3341
|
-
}, [normalizedValue, lazyOptions, selectedDetails]);
|
|
3342
|
-
(0, import_react29.useEffect)(() => {
|
|
3343
|
-
const newDetails = { ...selectedDetails };
|
|
3344
|
-
normalizedValue.forEach((id2) => {
|
|
3345
|
-
const option = lazyOptions.find((opt) => opt.value === id2);
|
|
3346
|
-
if (option && !newDetails[id2]) {
|
|
3347
|
-
newDetails[id2] = option;
|
|
3348
|
-
}
|
|
3349
|
-
});
|
|
3350
|
-
Object.keys(newDetails).forEach((key) => {
|
|
3351
|
-
if (!normalizedValue.includes(key)) {
|
|
3352
|
-
delete newDetails[key];
|
|
3353
|
-
}
|
|
3354
|
-
});
|
|
3355
|
-
setSelectedDetails(newDetails);
|
|
3356
3339
|
}, [normalizedValue, lazyOptions]);
|
|
3357
3340
|
(0, import_react29.useEffect)(() => {
|
|
3358
3341
|
const handleClick = (e) => {
|
|
@@ -3379,7 +3362,7 @@ function LazyMultiSelectDropdown({
|
|
|
3379
3362
|
setSearchTerm(term);
|
|
3380
3363
|
search(term);
|
|
3381
3364
|
};
|
|
3382
|
-
const toggleSelect = (
|
|
3365
|
+
const toggleSelect = (val) => {
|
|
3383
3366
|
let updated;
|
|
3384
3367
|
if (normalizedValue.includes(val)) {
|
|
3385
3368
|
updated = normalizedValue.filter((v) => v !== val);
|
|
@@ -3387,7 +3370,7 @@ function LazyMultiSelectDropdown({
|
|
|
3387
3370
|
updated = ensureUnique([...normalizedValue, val]);
|
|
3388
3371
|
}
|
|
3389
3372
|
onChange?.(convertOutput(updated), id);
|
|
3390
|
-
}
|
|
3373
|
+
};
|
|
3391
3374
|
const removeTag = (val) => {
|
|
3392
3375
|
const updated = normalizedValue.filter((v) => v !== val);
|
|
3393
3376
|
onChange?.(convertOutput(updated), id);
|