@homebound/beam 3.5.0 → 3.5.1
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.cjs +3 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -6133,7 +6133,7 @@ declare const navLink = "navLink";
|
|
|
6133
6133
|
*/
|
|
6134
6134
|
declare function CssReset(): null;
|
|
6135
6135
|
|
|
6136
|
-
|
|
6136
|
+
type DnDGridProps = {
|
|
6137
6137
|
children: ReactNode;
|
|
6138
6138
|
/** CSS Grid styles for the grid container. */
|
|
6139
6139
|
gridStyles?: GridStyles;
|
|
@@ -6141,7 +6141,7 @@ interface DnDGridProps {
|
|
|
6141
6141
|
activeItemStyles?: Properties;
|
|
6142
6142
|
/** Returns the new order of the GridItems. */
|
|
6143
6143
|
onReorder: (items: string[]) => void;
|
|
6144
|
-
}
|
|
6144
|
+
};
|
|
6145
6145
|
declare function DnDGrid(props: DnDGridProps): JSX.Element;
|
|
6146
6146
|
type GridStyles = Pick<Properties, "gridTemplate" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gap" | "columnGap" | "rowGap">;
|
|
6147
6147
|
|
package/dist/index.d.ts
CHANGED
|
@@ -6133,7 +6133,7 @@ declare const navLink = "navLink";
|
|
|
6133
6133
|
*/
|
|
6134
6134
|
declare function CssReset(): null;
|
|
6135
6135
|
|
|
6136
|
-
|
|
6136
|
+
type DnDGridProps = {
|
|
6137
6137
|
children: ReactNode;
|
|
6138
6138
|
/** CSS Grid styles for the grid container. */
|
|
6139
6139
|
gridStyles?: GridStyles;
|
|
@@ -6141,7 +6141,7 @@ interface DnDGridProps {
|
|
|
6141
6141
|
activeItemStyles?: Properties;
|
|
6142
6142
|
/** Returns the new order of the GridItems. */
|
|
6143
6143
|
onReorder: (items: string[]) => void;
|
|
6144
|
-
}
|
|
6144
|
+
};
|
|
6145
6145
|
declare function DnDGrid(props: DnDGridProps): JSX.Element;
|
|
6146
6146
|
type GridStyles = Pick<Properties, "gridTemplate" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gap" | "columnGap" | "rowGap">;
|
|
6147
6147
|
|
package/dist/index.js
CHANGED
|
@@ -20375,7 +20375,9 @@ function DnDGrid(props) {
|
|
|
20375
20375
|
const target = maybeTarget instanceof HTMLElement ? maybeTarget?.closest(`[${gridItemIdKey}]`) : void 0;
|
|
20376
20376
|
if (target instanceof HTMLElement && target !== cloneEl.current && target !== dragEl.current) {
|
|
20377
20377
|
const targetPos = target.getBoundingClientRect();
|
|
20378
|
-
const
|
|
20378
|
+
const clonePos = cloneEl.current.getBoundingClientRect();
|
|
20379
|
+
const useYAxis = Math.abs(targetPos.top - clonePos.top) >= Math.abs(targetPos.left - clonePos.left);
|
|
20380
|
+
const isHalfwayPassedTarget = useYAxis ? (clientY - targetPos.top) / (targetPos.bottom - targetPos.top) > 0.5 : (clientX - targetPos.left) / (targetPos.right - targetPos.left) > 0.5;
|
|
20379
20381
|
const shouldInsert = isHalfwayPassedTarget && target.nextSibling !== cloneEl.current || !isHalfwayPassedTarget && target.previousSibling !== cloneEl.current;
|
|
20380
20382
|
if (shouldInsert) {
|
|
20381
20383
|
gridEl.current.insertBefore(cloneEl.current, isHalfwayPassedTarget ? target.nextSibling : target);
|