@northlight/ui 1.5.8 → 1.5.9
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/es/northlight.mjs
CHANGED
|
@@ -5992,12 +5992,6 @@ function SortableList({
|
|
|
5992
5992
|
const [items, setItems] = useState(sortableItems);
|
|
5993
5993
|
const [activeItem, setActiveItem] = useState(null);
|
|
5994
5994
|
const identifierItems = useMemo(() => map(createKey, items), [items]);
|
|
5995
|
-
useEffect(() => {
|
|
5996
|
-
onChange(items);
|
|
5997
|
-
}, [items]);
|
|
5998
|
-
useEffect(() => {
|
|
5999
|
-
setItems(sortableItems);
|
|
6000
|
-
}, [sortableItems]);
|
|
6001
5995
|
const customSensors = useSensors(
|
|
6002
5996
|
useSensor(PointerSensor),
|
|
6003
5997
|
useSensor(KeyboardSensor, {
|
|
@@ -6018,7 +6012,9 @@ function SortableList({
|
|
|
6018
6012
|
const oldIndex = indexOf(active.id, prevIds);
|
|
6019
6013
|
const newIndex = indexOf(over.id, prevIds);
|
|
6020
6014
|
onMovedItem({ item: prev[oldIndex], oldIndex, newIndex });
|
|
6021
|
-
|
|
6015
|
+
const newItems = arrayMove(prev, oldIndex, newIndex);
|
|
6016
|
+
onChange(newItems);
|
|
6017
|
+
return newItems;
|
|
6022
6018
|
});
|
|
6023
6019
|
}
|
|
6024
6020
|
};
|