@almadar/ui 4.50.1 → 4.50.2

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.
@@ -24961,6 +24961,13 @@ function useDataDnd(args) {
24961
24961
  core$1.useSensor(core$1.PointerSensor, { activationConstraint: { distance: 5 } }),
24962
24962
  core$1.useSensor(core$1.KeyboardSensor, { coordinateGetter: sortable.sortableKeyboardCoordinates })
24963
24963
  );
24964
+ const collisionDetection = React93__namespace.default.useCallback((args2) => {
24965
+ const pointerCollisions = core$1.pointerWithin(args2);
24966
+ if (pointerCollisions.length > 0) return pointerCollisions;
24967
+ const rectCollisions = core$1.rectIntersection(args2);
24968
+ if (rectCollisions.length > 0) return rectCollisions;
24969
+ return core$1.closestCorners(args2);
24970
+ }, []);
24964
24971
  const findZoneByItem = React93__namespace.default.useCallback(
24965
24972
  (id) => {
24966
24973
  for (const z of zonesRef.current.values()) {
@@ -25073,18 +25080,19 @@ function useDataDnd(args) {
25073
25080
  const strategy = layout === "grid" ? sortable.rectSortingStrategy : sortable.verticalListSortingStrategy;
25074
25081
  if (!isZone) {
25075
25082
  if (!isRoot) return children;
25076
- return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection: core$1.closestCenter, onDragEnd: handleDragEnd, children }) });
25083
+ return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
25077
25084
  }
25078
25085
  const inner = /* @__PURE__ */ jsxRuntime.jsx(DropZoneShell, { children: /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: itemIds, strategy, children }) });
25079
25086
  if (isRoot) {
25080
- return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection: core$1.closestCenter, onDragEnd: handleDragEnd, children: inner }) });
25087
+ return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children: inner }) });
25081
25088
  }
25082
25089
  return inner;
25083
25090
  },
25084
- [enabled, isZone, layout, sensors, handleDragEnd, itemIds, isRoot, rootContextValue]
25091
+ [enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
25085
25092
  );
25086
25093
  return {
25087
25094
  enabled,
25095
+ isZone,
25088
25096
  wrapContainer,
25089
25097
  SortableItem,
25090
25098
  orderedItems
@@ -25290,7 +25298,7 @@ function DataGrid({
25290
25298
  const id = itemData.id || String(index);
25291
25299
  const isSelected = selectedIds.has(id);
25292
25300
  const dndId = itemData[idFieldName] ?? `__idx_${index}`;
25293
- const wrapDnd = (node) => dnd.enabled ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
25301
+ const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
25294
25302
  if (hasRenderProp) {
25295
25303
  return wrapDnd(
25296
25304
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -25706,7 +25714,7 @@ function DataList({
25706
25714
  const idFieldName = dndItemIdField ?? "id";
25707
25715
  const renderItem = (itemData, index, isLast) => {
25708
25716
  const dndId = itemData[idFieldName] ?? `__idx_${index}`;
25709
- const wrapDnd = (node) => dnd.enabled ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
25717
+ const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
25710
25718
  if (hasRenderProp) {
25711
25719
  const id2 = itemData.id || String(index);
25712
25720
  return wrapDnd(
package/dist/avl/index.js CHANGED
@@ -34,7 +34,7 @@ import langToml from 'react-syntax-highlighter/dist/esm/languages/prism/toml.js'
34
34
  import langGo from 'react-syntax-highlighter/dist/esm/languages/prism/go.js';
35
35
  import langGraphql from 'react-syntax-highlighter/dist/esm/languages/prism/graphql.js';
36
36
  import { FieldTypeSchema, isInlineTrait, isEntityCall, schemaToIR, getPage, isCircuitEvent } from '@almadar/core';
37
- import { useSensors, useSensor, PointerSensor, KeyboardSensor, DndContext, closestCenter, useDroppable } from '@dnd-kit/core';
37
+ import { useSensors, useSensor, PointerSensor, KeyboardSensor, pointerWithin, rectIntersection, closestCorners, DndContext, useDroppable } from '@dnd-kit/core';
38
38
  import { sortableKeyboardCoordinates, arrayMove, useSortable, SortableContext, rectSortingStrategy, verticalListSortingStrategy } from '@dnd-kit/sortable';
39
39
  import { CSS } from '@dnd-kit/utilities';
40
40
  import { useThree, useFrame, Canvas } from '@react-three/fiber';
@@ -24915,6 +24915,13 @@ function useDataDnd(args) {
24915
24915
  useSensor(PointerSensor, { activationConstraint: { distance: 5 } }),
24916
24916
  useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates })
24917
24917
  );
24918
+ const collisionDetection = React93__default.useCallback((args2) => {
24919
+ const pointerCollisions = pointerWithin(args2);
24920
+ if (pointerCollisions.length > 0) return pointerCollisions;
24921
+ const rectCollisions = rectIntersection(args2);
24922
+ if (rectCollisions.length > 0) return rectCollisions;
24923
+ return closestCorners(args2);
24924
+ }, []);
24918
24925
  const findZoneByItem = React93__default.useCallback(
24919
24926
  (id) => {
24920
24927
  for (const z of zonesRef.current.values()) {
@@ -25027,18 +25034,19 @@ function useDataDnd(args) {
25027
25034
  const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
25028
25035
  if (!isZone) {
25029
25036
  if (!isRoot) return children;
25030
- return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, children }) });
25037
+ return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
25031
25038
  }
25032
25039
  const inner = /* @__PURE__ */ jsx(DropZoneShell, { children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy, children }) });
25033
25040
  if (isRoot) {
25034
- return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, children: inner }) });
25041
+ return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children: inner }) });
25035
25042
  }
25036
25043
  return inner;
25037
25044
  },
25038
- [enabled, isZone, layout, sensors, handleDragEnd, itemIds, isRoot, rootContextValue]
25045
+ [enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
25039
25046
  );
25040
25047
  return {
25041
25048
  enabled,
25049
+ isZone,
25042
25050
  wrapContainer,
25043
25051
  SortableItem,
25044
25052
  orderedItems
@@ -25244,7 +25252,7 @@ function DataGrid({
25244
25252
  const id = itemData.id || String(index);
25245
25253
  const isSelected = selectedIds.has(id);
25246
25254
  const dndId = itemData[idFieldName] ?? `__idx_${index}`;
25247
- const wrapDnd = (node) => dnd.enabled ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
25255
+ const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
25248
25256
  if (hasRenderProp) {
25249
25257
  return wrapDnd(
25250
25258
  /* @__PURE__ */ jsx(
@@ -25660,7 +25668,7 @@ function DataList({
25660
25668
  const idFieldName = dndItemIdField ?? "id";
25661
25669
  const renderItem = (itemData, index, isLast) => {
25662
25670
  const dndId = itemData[idFieldName] ?? `__idx_${index}`;
25663
- const wrapDnd = (node) => dnd.enabled ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
25671
+ const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
25664
25672
  if (hasRenderProp) {
25665
25673
  const id2 = itemData.id || String(index);
25666
25674
  return wrapDnd(
@@ -20128,6 +20128,13 @@ function useDataDnd(args) {
20128
20128
  core$1.useSensor(core$1.PointerSensor, { activationConstraint: { distance: 5 } }),
20129
20129
  core$1.useSensor(core$1.KeyboardSensor, { coordinateGetter: sortable.sortableKeyboardCoordinates })
20130
20130
  );
20131
+ const collisionDetection = React75__namespace.default.useCallback((args2) => {
20132
+ const pointerCollisions = core$1.pointerWithin(args2);
20133
+ if (pointerCollisions.length > 0) return pointerCollisions;
20134
+ const rectCollisions = core$1.rectIntersection(args2);
20135
+ if (rectCollisions.length > 0) return rectCollisions;
20136
+ return core$1.closestCorners(args2);
20137
+ }, []);
20131
20138
  const findZoneByItem = React75__namespace.default.useCallback(
20132
20139
  (id) => {
20133
20140
  for (const z of zonesRef.current.values()) {
@@ -20240,18 +20247,19 @@ function useDataDnd(args) {
20240
20247
  const strategy = layout === "grid" ? sortable.rectSortingStrategy : sortable.verticalListSortingStrategy;
20241
20248
  if (!isZone) {
20242
20249
  if (!isRoot) return children;
20243
- return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection: core$1.closestCenter, onDragEnd: handleDragEnd, children }) });
20250
+ return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
20244
20251
  }
20245
20252
  const inner = /* @__PURE__ */ jsxRuntime.jsx(DropZoneShell, { children: /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: itemIds, strategy, children }) });
20246
20253
  if (isRoot) {
20247
- return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection: core$1.closestCenter, onDragEnd: handleDragEnd, children: inner }) });
20254
+ return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children: inner }) });
20248
20255
  }
20249
20256
  return inner;
20250
20257
  },
20251
- [enabled, isZone, layout, sensors, handleDragEnd, itemIds, isRoot, rootContextValue]
20258
+ [enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
20252
20259
  );
20253
20260
  return {
20254
20261
  enabled,
20262
+ isZone,
20255
20263
  wrapContainer,
20256
20264
  SortableItem,
20257
20265
  orderedItems
@@ -20457,7 +20465,7 @@ function DataGrid({
20457
20465
  const id = itemData.id || String(index);
20458
20466
  const isSelected = selectedIds.has(id);
20459
20467
  const dndId = itemData[idFieldName] ?? `__idx_${index}`;
20460
- const wrapDnd = (node) => dnd.enabled ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
20468
+ const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
20461
20469
  if (hasRenderProp) {
20462
20470
  return wrapDnd(
20463
20471
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -20873,7 +20881,7 @@ function DataList({
20873
20881
  const idFieldName = dndItemIdField ?? "id";
20874
20882
  const renderItem = (itemData, index, isLast) => {
20875
20883
  const dndId = itemData[idFieldName] ?? `__idx_${index}`;
20876
- const wrapDnd = (node) => dnd.enabled ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
20884
+ const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
20877
20885
  if (hasRenderProp) {
20878
20886
  const id2 = itemData.id || String(index);
20879
20887
  return wrapDnd(
@@ -35,7 +35,7 @@ import langToml from 'react-syntax-highlighter/dist/esm/languages/prism/toml.js'
35
35
  import langGo from 'react-syntax-highlighter/dist/esm/languages/prism/go.js';
36
36
  import langGraphql from 'react-syntax-highlighter/dist/esm/languages/prism/graphql.js';
37
37
  import { isInlineTrait } from '@almadar/core';
38
- import { useSensors, useSensor, PointerSensor, KeyboardSensor, DndContext, closestCenter, useDroppable } from '@dnd-kit/core';
38
+ import { useSensors, useSensor, PointerSensor, KeyboardSensor, pointerWithin, rectIntersection, closestCorners, DndContext, useDroppable } from '@dnd-kit/core';
39
39
  import { sortableKeyboardCoordinates, arrayMove, useSortable, SortableContext, rectSortingStrategy, verticalListSortingStrategy } from '@dnd-kit/sortable';
40
40
  import { CSS } from '@dnd-kit/utilities';
41
41
  import { Handle, Position } from '@xyflow/react';
@@ -20082,6 +20082,13 @@ function useDataDnd(args) {
20082
20082
  useSensor(PointerSensor, { activationConstraint: { distance: 5 } }),
20083
20083
  useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates })
20084
20084
  );
20085
+ const collisionDetection = React75__default.useCallback((args2) => {
20086
+ const pointerCollisions = pointerWithin(args2);
20087
+ if (pointerCollisions.length > 0) return pointerCollisions;
20088
+ const rectCollisions = rectIntersection(args2);
20089
+ if (rectCollisions.length > 0) return rectCollisions;
20090
+ return closestCorners(args2);
20091
+ }, []);
20085
20092
  const findZoneByItem = React75__default.useCallback(
20086
20093
  (id) => {
20087
20094
  for (const z of zonesRef.current.values()) {
@@ -20194,18 +20201,19 @@ function useDataDnd(args) {
20194
20201
  const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
20195
20202
  if (!isZone) {
20196
20203
  if (!isRoot) return children;
20197
- return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, children }) });
20204
+ return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
20198
20205
  }
20199
20206
  const inner = /* @__PURE__ */ jsx(DropZoneShell, { children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy, children }) });
20200
20207
  if (isRoot) {
20201
- return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, children: inner }) });
20208
+ return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children: inner }) });
20202
20209
  }
20203
20210
  return inner;
20204
20211
  },
20205
- [enabled, isZone, layout, sensors, handleDragEnd, itemIds, isRoot, rootContextValue]
20212
+ [enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
20206
20213
  );
20207
20214
  return {
20208
20215
  enabled,
20216
+ isZone,
20209
20217
  wrapContainer,
20210
20218
  SortableItem,
20211
20219
  orderedItems
@@ -20411,7 +20419,7 @@ function DataGrid({
20411
20419
  const id = itemData.id || String(index);
20412
20420
  const isSelected = selectedIds.has(id);
20413
20421
  const dndId = itemData[idFieldName] ?? `__idx_${index}`;
20414
- const wrapDnd = (node) => dnd.enabled ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
20422
+ const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
20415
20423
  if (hasRenderProp) {
20416
20424
  return wrapDnd(
20417
20425
  /* @__PURE__ */ jsx(
@@ -20827,7 +20835,7 @@ function DataList({
20827
20835
  const idFieldName = dndItemIdField ?? "id";
20828
20836
  const renderItem = (itemData, index, isLast) => {
20829
20837
  const dndId = itemData[idFieldName] ?? `__idx_${index}`;
20830
- const wrapDnd = (node) => dnd.enabled ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
20838
+ const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
20831
20839
  if (hasRenderProp) {
20832
20840
  const id2 = itemData.id || String(index);
20833
20841
  return wrapDnd(
@@ -42,6 +42,8 @@ interface UseDataDndArgs<T extends EntityRow> extends DataDndProps {
42
42
  }
43
43
  interface UseDataDndResult<T extends EntityRow> {
44
44
  enabled: boolean;
45
+ /** True when this container is a sortable zone (own items are draggable). False in dndRoot-only mode. */
46
+ isZone: boolean;
45
47
  wrapContainer: (children: React.ReactNode) => React.ReactNode;
46
48
  SortableItem: React.FC<{
47
49
  id: UniqueIdentifier;
@@ -21373,6 +21373,13 @@ function useDataDnd(args) {
21373
21373
  core$1.useSensor(core$1.PointerSensor, { activationConstraint: { distance: 5 } }),
21374
21374
  core$1.useSensor(core$1.KeyboardSensor, { coordinateGetter: sortable.sortableKeyboardCoordinates })
21375
21375
  );
21376
+ const collisionDetection = React81__namespace.default.useCallback((args2) => {
21377
+ const pointerCollisions = core$1.pointerWithin(args2);
21378
+ if (pointerCollisions.length > 0) return pointerCollisions;
21379
+ const rectCollisions = core$1.rectIntersection(args2);
21380
+ if (rectCollisions.length > 0) return rectCollisions;
21381
+ return core$1.closestCorners(args2);
21382
+ }, []);
21376
21383
  const findZoneByItem = React81__namespace.default.useCallback(
21377
21384
  (id) => {
21378
21385
  for (const z of zonesRef.current.values()) {
@@ -21485,18 +21492,19 @@ function useDataDnd(args) {
21485
21492
  const strategy = layout === "grid" ? sortable.rectSortingStrategy : sortable.verticalListSortingStrategy;
21486
21493
  if (!isZone) {
21487
21494
  if (!isRoot) return children;
21488
- return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection: core$1.closestCenter, onDragEnd: handleDragEnd, children }) });
21495
+ return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
21489
21496
  }
21490
21497
  const inner = /* @__PURE__ */ jsxRuntime.jsx(DropZoneShell, { children: /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: itemIds, strategy, children }) });
21491
21498
  if (isRoot) {
21492
- return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection: core$1.closestCenter, onDragEnd: handleDragEnd, children: inner }) });
21499
+ return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children: inner }) });
21493
21500
  }
21494
21501
  return inner;
21495
21502
  },
21496
- [enabled, isZone, layout, sensors, handleDragEnd, itemIds, isRoot, rootContextValue]
21503
+ [enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
21497
21504
  );
21498
21505
  return {
21499
21506
  enabled,
21507
+ isZone,
21500
21508
  wrapContainer,
21501
21509
  SortableItem,
21502
21510
  orderedItems
@@ -21702,7 +21710,7 @@ function DataGrid({
21702
21710
  const id = itemData.id || String(index);
21703
21711
  const isSelected = selectedIds.has(id);
21704
21712
  const dndId = itemData[idFieldName] ?? `__idx_${index}`;
21705
- const wrapDnd = (node) => dnd.enabled ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
21713
+ const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
21706
21714
  if (hasRenderProp) {
21707
21715
  return wrapDnd(
21708
21716
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -22118,7 +22126,7 @@ function DataList({
22118
22126
  const idFieldName = dndItemIdField ?? "id";
22119
22127
  const renderItem = (itemData, index, isLast) => {
22120
22128
  const dndId = itemData[idFieldName] ?? `__idx_${index}`;
22121
- const wrapDnd = (node) => dnd.enabled ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
22129
+ const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
22122
22130
  if (hasRenderProp) {
22123
22131
  const id2 = itemData.id || String(index);
22124
22132
  return wrapDnd(
@@ -36,7 +36,7 @@ import langToml from 'react-syntax-highlighter/dist/esm/languages/prism/toml.js'
36
36
  import langGo from 'react-syntax-highlighter/dist/esm/languages/prism/go.js';
37
37
  import langGraphql from 'react-syntax-highlighter/dist/esm/languages/prism/graphql.js';
38
38
  import { isInlineTrait } from '@almadar/core';
39
- import { useSensors, useSensor, PointerSensor, KeyboardSensor, DndContext, closestCenter, useDroppable } from '@dnd-kit/core';
39
+ import { useSensors, useSensor, PointerSensor, KeyboardSensor, pointerWithin, rectIntersection, closestCorners, DndContext, useDroppable } from '@dnd-kit/core';
40
40
  import { sortableKeyboardCoordinates, arrayMove, useSortable, SortableContext, rectSortingStrategy, verticalListSortingStrategy } from '@dnd-kit/sortable';
41
41
  import { CSS } from '@dnd-kit/utilities';
42
42
  import { Handle, Position } from '@xyflow/react';
@@ -21327,6 +21327,13 @@ function useDataDnd(args) {
21327
21327
  useSensor(PointerSensor, { activationConstraint: { distance: 5 } }),
21328
21328
  useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates })
21329
21329
  );
21330
+ const collisionDetection = React81__default.useCallback((args2) => {
21331
+ const pointerCollisions = pointerWithin(args2);
21332
+ if (pointerCollisions.length > 0) return pointerCollisions;
21333
+ const rectCollisions = rectIntersection(args2);
21334
+ if (rectCollisions.length > 0) return rectCollisions;
21335
+ return closestCorners(args2);
21336
+ }, []);
21330
21337
  const findZoneByItem = React81__default.useCallback(
21331
21338
  (id) => {
21332
21339
  for (const z of zonesRef.current.values()) {
@@ -21439,18 +21446,19 @@ function useDataDnd(args) {
21439
21446
  const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
21440
21447
  if (!isZone) {
21441
21448
  if (!isRoot) return children;
21442
- return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, children }) });
21449
+ return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
21443
21450
  }
21444
21451
  const inner = /* @__PURE__ */ jsx(DropZoneShell, { children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy, children }) });
21445
21452
  if (isRoot) {
21446
- return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, children: inner }) });
21453
+ return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children: inner }) });
21447
21454
  }
21448
21455
  return inner;
21449
21456
  },
21450
- [enabled, isZone, layout, sensors, handleDragEnd, itemIds, isRoot, rootContextValue]
21457
+ [enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
21451
21458
  );
21452
21459
  return {
21453
21460
  enabled,
21461
+ isZone,
21454
21462
  wrapContainer,
21455
21463
  SortableItem,
21456
21464
  orderedItems
@@ -21656,7 +21664,7 @@ function DataGrid({
21656
21664
  const id = itemData.id || String(index);
21657
21665
  const isSelected = selectedIds.has(id);
21658
21666
  const dndId = itemData[idFieldName] ?? `__idx_${index}`;
21659
- const wrapDnd = (node) => dnd.enabled ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
21667
+ const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
21660
21668
  if (hasRenderProp) {
21661
21669
  return wrapDnd(
21662
21670
  /* @__PURE__ */ jsx(
@@ -22072,7 +22080,7 @@ function DataList({
22072
22080
  const idFieldName = dndItemIdField ?? "id";
22073
22081
  const renderItem = (itemData, index, isLast) => {
22074
22082
  const dndId = itemData[idFieldName] ?? `__idx_${index}`;
22075
- const wrapDnd = (node) => dnd.enabled ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
22083
+ const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
22076
22084
  if (hasRenderProp) {
22077
22085
  const id2 = itemData.id || String(index);
22078
22086
  return wrapDnd(
@@ -21142,6 +21142,13 @@ function useDataDnd(args) {
21142
21142
  core$1.useSensor(core$1.PointerSensor, { activationConstraint: { distance: 5 } }),
21143
21143
  core$1.useSensor(core$1.KeyboardSensor, { coordinateGetter: sortable.sortableKeyboardCoordinates })
21144
21144
  );
21145
+ const collisionDetection = React80__namespace.default.useCallback((args2) => {
21146
+ const pointerCollisions = core$1.pointerWithin(args2);
21147
+ if (pointerCollisions.length > 0) return pointerCollisions;
21148
+ const rectCollisions = core$1.rectIntersection(args2);
21149
+ if (rectCollisions.length > 0) return rectCollisions;
21150
+ return core$1.closestCorners(args2);
21151
+ }, []);
21145
21152
  const findZoneByItem = React80__namespace.default.useCallback(
21146
21153
  (id) => {
21147
21154
  for (const z of zonesRef.current.values()) {
@@ -21254,18 +21261,19 @@ function useDataDnd(args) {
21254
21261
  const strategy = layout === "grid" ? sortable.rectSortingStrategy : sortable.verticalListSortingStrategy;
21255
21262
  if (!isZone) {
21256
21263
  if (!isRoot) return children;
21257
- return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection: core$1.closestCenter, onDragEnd: handleDragEnd, children }) });
21264
+ return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
21258
21265
  }
21259
21266
  const inner = /* @__PURE__ */ jsxRuntime.jsx(DropZoneShell, { children: /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: itemIds, strategy, children }) });
21260
21267
  if (isRoot) {
21261
- return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection: core$1.closestCenter, onDragEnd: handleDragEnd, children: inner }) });
21268
+ return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children: inner }) });
21262
21269
  }
21263
21270
  return inner;
21264
21271
  },
21265
- [enabled, isZone, layout, sensors, handleDragEnd, itemIds, isRoot, rootContextValue]
21272
+ [enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
21266
21273
  );
21267
21274
  return {
21268
21275
  enabled,
21276
+ isZone,
21269
21277
  wrapContainer,
21270
21278
  SortableItem,
21271
21279
  orderedItems
@@ -21471,7 +21479,7 @@ function DataGrid({
21471
21479
  const id = itemData.id || String(index);
21472
21480
  const isSelected = selectedIds.has(id);
21473
21481
  const dndId = itemData[idFieldName] ?? `__idx_${index}`;
21474
- const wrapDnd = (node) => dnd.enabled ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
21482
+ const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
21475
21483
  if (hasRenderProp) {
21476
21484
  return wrapDnd(
21477
21485
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -21887,7 +21895,7 @@ function DataList({
21887
21895
  const idFieldName = dndItemIdField ?? "id";
21888
21896
  const renderItem = (itemData, index, isLast) => {
21889
21897
  const dndId = itemData[idFieldName] ?? `__idx_${index}`;
21890
- const wrapDnd = (node) => dnd.enabled ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
21898
+ const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
21891
21899
  if (hasRenderProp) {
21892
21900
  const id2 = itemData.id || String(index);
21893
21901
  return wrapDnd(
@@ -36,7 +36,7 @@ import langToml from 'react-syntax-highlighter/dist/esm/languages/prism/toml.js'
36
36
  import langGo from 'react-syntax-highlighter/dist/esm/languages/prism/go.js';
37
37
  import langGraphql from 'react-syntax-highlighter/dist/esm/languages/prism/graphql.js';
38
38
  import { isCircuitEvent, schemaToIR, getPage, clearSchemaCache as clearSchemaCache$1, isEntityCall, isInlineTrait } from '@almadar/core';
39
- import { useSensors, useSensor, PointerSensor, KeyboardSensor, DndContext, closestCenter, useDroppable } from '@dnd-kit/core';
39
+ import { useSensors, useSensor, PointerSensor, KeyboardSensor, pointerWithin, rectIntersection, closestCorners, DndContext, useDroppable } from '@dnd-kit/core';
40
40
  import { sortableKeyboardCoordinates, arrayMove, useSortable, SortableContext, rectSortingStrategy, verticalListSortingStrategy } from '@dnd-kit/sortable';
41
41
  import { CSS } from '@dnd-kit/utilities';
42
42
  import { Handle, Position } from '@xyflow/react';
@@ -21096,6 +21096,13 @@ function useDataDnd(args) {
21096
21096
  useSensor(PointerSensor, { activationConstraint: { distance: 5 } }),
21097
21097
  useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates })
21098
21098
  );
21099
+ const collisionDetection = React80__default.useCallback((args2) => {
21100
+ const pointerCollisions = pointerWithin(args2);
21101
+ if (pointerCollisions.length > 0) return pointerCollisions;
21102
+ const rectCollisions = rectIntersection(args2);
21103
+ if (rectCollisions.length > 0) return rectCollisions;
21104
+ return closestCorners(args2);
21105
+ }, []);
21099
21106
  const findZoneByItem = React80__default.useCallback(
21100
21107
  (id) => {
21101
21108
  for (const z of zonesRef.current.values()) {
@@ -21208,18 +21215,19 @@ function useDataDnd(args) {
21208
21215
  const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
21209
21216
  if (!isZone) {
21210
21217
  if (!isRoot) return children;
21211
- return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, children }) });
21218
+ return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
21212
21219
  }
21213
21220
  const inner = /* @__PURE__ */ jsx(DropZoneShell, { children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy, children }) });
21214
21221
  if (isRoot) {
21215
- return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, children: inner }) });
21222
+ return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children: inner }) });
21216
21223
  }
21217
21224
  return inner;
21218
21225
  },
21219
- [enabled, isZone, layout, sensors, handleDragEnd, itemIds, isRoot, rootContextValue]
21226
+ [enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
21220
21227
  );
21221
21228
  return {
21222
21229
  enabled,
21230
+ isZone,
21223
21231
  wrapContainer,
21224
21232
  SortableItem,
21225
21233
  orderedItems
@@ -21425,7 +21433,7 @@ function DataGrid({
21425
21433
  const id = itemData.id || String(index);
21426
21434
  const isSelected = selectedIds.has(id);
21427
21435
  const dndId = itemData[idFieldName] ?? `__idx_${index}`;
21428
- const wrapDnd = (node) => dnd.enabled ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
21436
+ const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
21429
21437
  if (hasRenderProp) {
21430
21438
  return wrapDnd(
21431
21439
  /* @__PURE__ */ jsx(
@@ -21841,7 +21849,7 @@ function DataList({
21841
21849
  const idFieldName = dndItemIdField ?? "id";
21842
21850
  const renderItem = (itemData, index, isLast) => {
21843
21851
  const dndId = itemData[idFieldName] ?? `__idx_${index}`;
21844
- const wrapDnd = (node) => dnd.enabled ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
21852
+ const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
21845
21853
  if (hasRenderProp) {
21846
21854
  const id2 = itemData.id || String(index);
21847
21855
  return wrapDnd(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/ui",
3
- "version": "4.50.1",
3
+ "version": "4.50.2",
4
4
  "description": "React UI components, hooks, and providers for Almadar",
5
5
  "type": "module",
6
6
  "sideEffects": [