UNPKG

@mantine/core

Version:

React components library focused on usability, accessibility and developer experience

17 lines (16 loc) 599 B
"use client"; //#region packages/@mantine/core/src/components/Combobox/use-pills-reorder/move-pill.ts function movePill(value, from, to, position) { if (from === to) return value; if (position === "before" && to === from + 1) return value; if (position === "after" && to === from - 1) return value; const result = value.slice(); const [item] = result.splice(from, 1); let targetIndex = from < to ? to - 1 : to; if (position === "after") targetIndex += 1; result.splice(targetIndex, 0, item); return result; } //#endregion exports.movePill = movePill; //# sourceMappingURL=move-pill.cjs.map