@almadar/ui 4.50.0 → 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.
@@ -24914,10 +24914,12 @@ function useDataDnd(args) {
24914
24914
  dropEvent,
24915
24915
  reorderEvent,
24916
24916
  dndItemIdField = "id",
24917
+ dndRoot,
24917
24918
  items,
24918
24919
  layout
24919
24920
  } = args;
24920
- const enabled = Boolean(dragGroup || accepts || sortable$1);
24921
+ const isZone = Boolean(dragGroup || accepts || sortable$1);
24922
+ const enabled = isZone || Boolean(dndRoot);
24921
24923
  const eventBus = useEventBus();
24922
24924
  const parentRoot = React93__namespace.default.useContext(RootCtx);
24923
24925
  const isRoot = enabled && parentRoot === null;
@@ -24959,6 +24961,13 @@ function useDataDnd(args) {
24959
24961
  core$1.useSensor(core$1.PointerSensor, { activationConstraint: { distance: 5 } }),
24960
24962
  core$1.useSensor(core$1.KeyboardSensor, { coordinateGetter: sortable.sortableKeyboardCoordinates })
24961
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
+ }, []);
24962
24971
  const findZoneByItem = React93__namespace.default.useCallback(
24963
24972
  (id) => {
24964
24973
  for (const z of zonesRef.current.values()) {
@@ -25055,7 +25064,8 @@ function useDataDnd(args) {
25055
25064
  Box,
25056
25065
  {
25057
25066
  ref: setNodeRef,
25058
- className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg" : void 0,
25067
+ "data-dnd-zone": ownGroup,
25068
+ className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg transition-all min-h-[3rem]" : "min-h-[3rem] rounded-lg transition-all",
25059
25069
  children
25060
25070
  }
25061
25071
  );
@@ -25068,16 +25078,21 @@ function useDataDnd(args) {
25068
25078
  (children) => {
25069
25079
  if (!enabled) return children;
25070
25080
  const strategy = layout === "grid" ? sortable.rectSortingStrategy : sortable.verticalListSortingStrategy;
25081
+ if (!isZone) {
25082
+ if (!isRoot) return children;
25083
+ return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
25084
+ }
25071
25085
  const inner = /* @__PURE__ */ jsxRuntime.jsx(DropZoneShell, { children: /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: itemIds, strategy, children }) });
25072
25086
  if (isRoot) {
25073
- 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 }) });
25074
25088
  }
25075
25089
  return inner;
25076
25090
  },
25077
- [enabled, layout, sensors, handleDragEnd, itemIds, isRoot, rootContextValue]
25091
+ [enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
25078
25092
  );
25079
25093
  return {
25080
25094
  enabled,
25095
+ isZone,
25081
25096
  wrapContainer,
25082
25097
  SortableItem,
25083
25098
  orderedItems
@@ -25161,7 +25176,8 @@ function DataGrid({
25161
25176
  sortable,
25162
25177
  dropEvent,
25163
25178
  reorderEvent,
25164
- dndItemIdField
25179
+ dndItemIdField,
25180
+ dndRoot
25165
25181
  }) {
25166
25182
  const eventBus = useEventBus();
25167
25183
  const { t } = useTranslate();
@@ -25177,7 +25193,8 @@ function DataGrid({
25177
25193
  sortable,
25178
25194
  dropEvent,
25179
25195
  reorderEvent,
25180
- dndItemIdField
25196
+ dndItemIdField,
25197
+ dndRoot
25181
25198
  });
25182
25199
  const allData = dnd.orderedItems;
25183
25200
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
@@ -25281,7 +25298,7 @@ function DataGrid({
25281
25298
  const id = itemData.id || String(index);
25282
25299
  const isSelected = selectedIds.has(id);
25283
25300
  const dndId = itemData[idFieldName] ?? `__idx_${index}`;
25284
- 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;
25285
25302
  if (hasRenderProp) {
25286
25303
  return wrapDnd(
25287
25304
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -25567,7 +25584,8 @@ function DataList({
25567
25584
  sortable: sortableProp,
25568
25585
  dropEvent,
25569
25586
  reorderEvent: dndReorderEvent,
25570
- dndItemIdField
25587
+ dndItemIdField,
25588
+ dndRoot
25571
25589
  }) {
25572
25590
  const eventBus = useEventBus();
25573
25591
  const { t } = useTranslate();
@@ -25582,7 +25600,8 @@ function DataList({
25582
25600
  sortable: sortableProp,
25583
25601
  dropEvent,
25584
25602
  reorderEvent: dndReorderEvent,
25585
- dndItemIdField
25603
+ dndItemIdField,
25604
+ dndRoot
25586
25605
  });
25587
25606
  const allData = dnd.orderedItems;
25588
25607
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
@@ -25695,7 +25714,7 @@ function DataList({
25695
25714
  const idFieldName = dndItemIdField ?? "id";
25696
25715
  const renderItem = (itemData, index, isLast) => {
25697
25716
  const dndId = itemData[idFieldName] ?? `__idx_${index}`;
25698
- 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;
25699
25718
  if (hasRenderProp) {
25700
25719
  const id2 = itemData.id || String(index);
25701
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';
@@ -24868,10 +24868,12 @@ function useDataDnd(args) {
24868
24868
  dropEvent,
24869
24869
  reorderEvent,
24870
24870
  dndItemIdField = "id",
24871
+ dndRoot,
24871
24872
  items,
24872
24873
  layout
24873
24874
  } = args;
24874
- const enabled = Boolean(dragGroup || accepts || sortable);
24875
+ const isZone = Boolean(dragGroup || accepts || sortable);
24876
+ const enabled = isZone || Boolean(dndRoot);
24875
24877
  const eventBus = useEventBus();
24876
24878
  const parentRoot = React93__default.useContext(RootCtx);
24877
24879
  const isRoot = enabled && parentRoot === null;
@@ -24913,6 +24915,13 @@ function useDataDnd(args) {
24913
24915
  useSensor(PointerSensor, { activationConstraint: { distance: 5 } }),
24914
24916
  useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates })
24915
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
+ }, []);
24916
24925
  const findZoneByItem = React93__default.useCallback(
24917
24926
  (id) => {
24918
24927
  for (const z of zonesRef.current.values()) {
@@ -25009,7 +25018,8 @@ function useDataDnd(args) {
25009
25018
  Box,
25010
25019
  {
25011
25020
  ref: setNodeRef,
25012
- className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg" : void 0,
25021
+ "data-dnd-zone": ownGroup,
25022
+ className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg transition-all min-h-[3rem]" : "min-h-[3rem] rounded-lg transition-all",
25013
25023
  children
25014
25024
  }
25015
25025
  );
@@ -25022,16 +25032,21 @@ function useDataDnd(args) {
25022
25032
  (children) => {
25023
25033
  if (!enabled) return children;
25024
25034
  const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
25035
+ if (!isZone) {
25036
+ if (!isRoot) return children;
25037
+ return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
25038
+ }
25025
25039
  const inner = /* @__PURE__ */ jsx(DropZoneShell, { children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy, children }) });
25026
25040
  if (isRoot) {
25027
- 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 }) });
25028
25042
  }
25029
25043
  return inner;
25030
25044
  },
25031
- [enabled, layout, sensors, handleDragEnd, itemIds, isRoot, rootContextValue]
25045
+ [enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
25032
25046
  );
25033
25047
  return {
25034
25048
  enabled,
25049
+ isZone,
25035
25050
  wrapContainer,
25036
25051
  SortableItem,
25037
25052
  orderedItems
@@ -25115,7 +25130,8 @@ function DataGrid({
25115
25130
  sortable,
25116
25131
  dropEvent,
25117
25132
  reorderEvent,
25118
- dndItemIdField
25133
+ dndItemIdField,
25134
+ dndRoot
25119
25135
  }) {
25120
25136
  const eventBus = useEventBus();
25121
25137
  const { t } = useTranslate();
@@ -25131,7 +25147,8 @@ function DataGrid({
25131
25147
  sortable,
25132
25148
  dropEvent,
25133
25149
  reorderEvent,
25134
- dndItemIdField
25150
+ dndItemIdField,
25151
+ dndRoot
25135
25152
  });
25136
25153
  const allData = dnd.orderedItems;
25137
25154
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
@@ -25235,7 +25252,7 @@ function DataGrid({
25235
25252
  const id = itemData.id || String(index);
25236
25253
  const isSelected = selectedIds.has(id);
25237
25254
  const dndId = itemData[idFieldName] ?? `__idx_${index}`;
25238
- 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;
25239
25256
  if (hasRenderProp) {
25240
25257
  return wrapDnd(
25241
25258
  /* @__PURE__ */ jsx(
@@ -25521,7 +25538,8 @@ function DataList({
25521
25538
  sortable: sortableProp,
25522
25539
  dropEvent,
25523
25540
  reorderEvent: dndReorderEvent,
25524
- dndItemIdField
25541
+ dndItemIdField,
25542
+ dndRoot
25525
25543
  }) {
25526
25544
  const eventBus = useEventBus();
25527
25545
  const { t } = useTranslate();
@@ -25536,7 +25554,8 @@ function DataList({
25536
25554
  sortable: sortableProp,
25537
25555
  dropEvent,
25538
25556
  reorderEvent: dndReorderEvent,
25539
- dndItemIdField
25557
+ dndItemIdField,
25558
+ dndRoot
25540
25559
  });
25541
25560
  const allData = dnd.orderedItems;
25542
25561
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
@@ -25649,7 +25668,7 @@ function DataList({
25649
25668
  const idFieldName = dndItemIdField ?? "id";
25650
25669
  const renderItem = (itemData, index, isLast) => {
25651
25670
  const dndId = itemData[idFieldName] ?? `__idx_${index}`;
25652
- 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;
25653
25672
  if (hasRenderProp) {
25654
25673
  const id2 = itemData.id || String(index);
25655
25674
  return wrapDnd(
@@ -20081,10 +20081,12 @@ function useDataDnd(args) {
20081
20081
  dropEvent,
20082
20082
  reorderEvent,
20083
20083
  dndItemIdField = "id",
20084
+ dndRoot,
20084
20085
  items,
20085
20086
  layout
20086
20087
  } = args;
20087
- const enabled = Boolean(dragGroup || accepts || sortable$1);
20088
+ const isZone = Boolean(dragGroup || accepts || sortable$1);
20089
+ const enabled = isZone || Boolean(dndRoot);
20088
20090
  const eventBus = useEventBus();
20089
20091
  const parentRoot = React75__namespace.default.useContext(RootCtx);
20090
20092
  const isRoot = enabled && parentRoot === null;
@@ -20126,6 +20128,13 @@ function useDataDnd(args) {
20126
20128
  core$1.useSensor(core$1.PointerSensor, { activationConstraint: { distance: 5 } }),
20127
20129
  core$1.useSensor(core$1.KeyboardSensor, { coordinateGetter: sortable.sortableKeyboardCoordinates })
20128
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
+ }, []);
20129
20138
  const findZoneByItem = React75__namespace.default.useCallback(
20130
20139
  (id) => {
20131
20140
  for (const z of zonesRef.current.values()) {
@@ -20222,7 +20231,8 @@ function useDataDnd(args) {
20222
20231
  exports.Box,
20223
20232
  {
20224
20233
  ref: setNodeRef,
20225
- className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg" : void 0,
20234
+ "data-dnd-zone": ownGroup,
20235
+ className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg transition-all min-h-[3rem]" : "min-h-[3rem] rounded-lg transition-all",
20226
20236
  children
20227
20237
  }
20228
20238
  );
@@ -20235,16 +20245,21 @@ function useDataDnd(args) {
20235
20245
  (children) => {
20236
20246
  if (!enabled) return children;
20237
20247
  const strategy = layout === "grid" ? sortable.rectSortingStrategy : sortable.verticalListSortingStrategy;
20248
+ if (!isZone) {
20249
+ if (!isRoot) return children;
20250
+ return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
20251
+ }
20238
20252
  const inner = /* @__PURE__ */ jsxRuntime.jsx(DropZoneShell, { children: /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: itemIds, strategy, children }) });
20239
20253
  if (isRoot) {
20240
- 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 }) });
20241
20255
  }
20242
20256
  return inner;
20243
20257
  },
20244
- [enabled, layout, sensors, handleDragEnd, itemIds, isRoot, rootContextValue]
20258
+ [enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
20245
20259
  );
20246
20260
  return {
20247
20261
  enabled,
20262
+ isZone,
20248
20263
  wrapContainer,
20249
20264
  SortableItem,
20250
20265
  orderedItems
@@ -20328,7 +20343,8 @@ function DataGrid({
20328
20343
  sortable,
20329
20344
  dropEvent,
20330
20345
  reorderEvent,
20331
- dndItemIdField
20346
+ dndItemIdField,
20347
+ dndRoot
20332
20348
  }) {
20333
20349
  const eventBus = useEventBus();
20334
20350
  const { t } = useTranslate();
@@ -20344,7 +20360,8 @@ function DataGrid({
20344
20360
  sortable,
20345
20361
  dropEvent,
20346
20362
  reorderEvent,
20347
- dndItemIdField
20363
+ dndItemIdField,
20364
+ dndRoot
20348
20365
  });
20349
20366
  const allData = dnd.orderedItems;
20350
20367
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
@@ -20448,7 +20465,7 @@ function DataGrid({
20448
20465
  const id = itemData.id || String(index);
20449
20466
  const isSelected = selectedIds.has(id);
20450
20467
  const dndId = itemData[idFieldName] ?? `__idx_${index}`;
20451
- 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;
20452
20469
  if (hasRenderProp) {
20453
20470
  return wrapDnd(
20454
20471
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -20734,7 +20751,8 @@ function DataList({
20734
20751
  sortable: sortableProp,
20735
20752
  dropEvent,
20736
20753
  reorderEvent: dndReorderEvent,
20737
- dndItemIdField
20754
+ dndItemIdField,
20755
+ dndRoot
20738
20756
  }) {
20739
20757
  const eventBus = useEventBus();
20740
20758
  const { t } = useTranslate();
@@ -20749,7 +20767,8 @@ function DataList({
20749
20767
  sortable: sortableProp,
20750
20768
  dropEvent,
20751
20769
  reorderEvent: dndReorderEvent,
20752
- dndItemIdField
20770
+ dndItemIdField,
20771
+ dndRoot
20753
20772
  });
20754
20773
  const allData = dnd.orderedItems;
20755
20774
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
@@ -20862,7 +20881,7 @@ function DataList({
20862
20881
  const idFieldName = dndItemIdField ?? "id";
20863
20882
  const renderItem = (itemData, index, isLast) => {
20864
20883
  const dndId = itemData[idFieldName] ?? `__idx_${index}`;
20865
- 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;
20866
20885
  if (hasRenderProp) {
20867
20886
  const id2 = itemData.id || String(index);
20868
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';
@@ -20035,10 +20035,12 @@ function useDataDnd(args) {
20035
20035
  dropEvent,
20036
20036
  reorderEvent,
20037
20037
  dndItemIdField = "id",
20038
+ dndRoot,
20038
20039
  items,
20039
20040
  layout
20040
20041
  } = args;
20041
- const enabled = Boolean(dragGroup || accepts || sortable);
20042
+ const isZone = Boolean(dragGroup || accepts || sortable);
20043
+ const enabled = isZone || Boolean(dndRoot);
20042
20044
  const eventBus = useEventBus();
20043
20045
  const parentRoot = React75__default.useContext(RootCtx);
20044
20046
  const isRoot = enabled && parentRoot === null;
@@ -20080,6 +20082,13 @@ function useDataDnd(args) {
20080
20082
  useSensor(PointerSensor, { activationConstraint: { distance: 5 } }),
20081
20083
  useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates })
20082
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
+ }, []);
20083
20092
  const findZoneByItem = React75__default.useCallback(
20084
20093
  (id) => {
20085
20094
  for (const z of zonesRef.current.values()) {
@@ -20176,7 +20185,8 @@ function useDataDnd(args) {
20176
20185
  Box,
20177
20186
  {
20178
20187
  ref: setNodeRef,
20179
- className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg" : void 0,
20188
+ "data-dnd-zone": ownGroup,
20189
+ className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg transition-all min-h-[3rem]" : "min-h-[3rem] rounded-lg transition-all",
20180
20190
  children
20181
20191
  }
20182
20192
  );
@@ -20189,16 +20199,21 @@ function useDataDnd(args) {
20189
20199
  (children) => {
20190
20200
  if (!enabled) return children;
20191
20201
  const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
20202
+ if (!isZone) {
20203
+ if (!isRoot) return children;
20204
+ return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
20205
+ }
20192
20206
  const inner = /* @__PURE__ */ jsx(DropZoneShell, { children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy, children }) });
20193
20207
  if (isRoot) {
20194
- 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 }) });
20195
20209
  }
20196
20210
  return inner;
20197
20211
  },
20198
- [enabled, layout, sensors, handleDragEnd, itemIds, isRoot, rootContextValue]
20212
+ [enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
20199
20213
  );
20200
20214
  return {
20201
20215
  enabled,
20216
+ isZone,
20202
20217
  wrapContainer,
20203
20218
  SortableItem,
20204
20219
  orderedItems
@@ -20282,7 +20297,8 @@ function DataGrid({
20282
20297
  sortable,
20283
20298
  dropEvent,
20284
20299
  reorderEvent,
20285
- dndItemIdField
20300
+ dndItemIdField,
20301
+ dndRoot
20286
20302
  }) {
20287
20303
  const eventBus = useEventBus();
20288
20304
  const { t } = useTranslate();
@@ -20298,7 +20314,8 @@ function DataGrid({
20298
20314
  sortable,
20299
20315
  dropEvent,
20300
20316
  reorderEvent,
20301
- dndItemIdField
20317
+ dndItemIdField,
20318
+ dndRoot
20302
20319
  });
20303
20320
  const allData = dnd.orderedItems;
20304
20321
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
@@ -20402,7 +20419,7 @@ function DataGrid({
20402
20419
  const id = itemData.id || String(index);
20403
20420
  const isSelected = selectedIds.has(id);
20404
20421
  const dndId = itemData[idFieldName] ?? `__idx_${index}`;
20405
- 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;
20406
20423
  if (hasRenderProp) {
20407
20424
  return wrapDnd(
20408
20425
  /* @__PURE__ */ jsx(
@@ -20688,7 +20705,8 @@ function DataList({
20688
20705
  sortable: sortableProp,
20689
20706
  dropEvent,
20690
20707
  reorderEvent: dndReorderEvent,
20691
- dndItemIdField
20708
+ dndItemIdField,
20709
+ dndRoot
20692
20710
  }) {
20693
20711
  const eventBus = useEventBus();
20694
20712
  const { t } = useTranslate();
@@ -20703,7 +20721,8 @@ function DataList({
20703
20721
  sortable: sortableProp,
20704
20722
  dropEvent,
20705
20723
  reorderEvent: dndReorderEvent,
20706
- dndItemIdField
20724
+ dndItemIdField,
20725
+ dndRoot
20707
20726
  });
20708
20727
  const allData = dnd.orderedItems;
20709
20728
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
@@ -20816,7 +20835,7 @@ function DataList({
20816
20835
  const idFieldName = dndItemIdField ?? "id";
20817
20836
  const renderItem = (itemData, index, isLast) => {
20818
20837
  const dndId = itemData[idFieldName] ?? `__idx_${index}`;
20819
- 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;
20820
20839
  if (hasRenderProp) {
20821
20840
  const id2 = itemData.id || String(index);
20822
20841
  return wrapDnd(
@@ -103,7 +103,7 @@ export interface DataGridProps<T extends EntityRow = EntityRow> extends DataDndP
103
103
  /** Max items to show before "Show More" button. Defaults to 0 (disabled). */
104
104
  pageSize?: number;
105
105
  }
106
- export declare function DataGrid<T extends EntityRow = EntityRow>({ entity, fields, columns, itemActions, cols, gap, minCardWidth, className, isLoading, error, imageField, selectable, selectionEvent, infiniteScroll, loadMoreEvent, hasMore, children, pageSize, renderItem: schemaRenderItem, dragGroup, accepts, sortable, dropEvent, reorderEvent, dndItemIdField, }: DataGridProps<T>): string | number | bigint | boolean | import("react/jsx-runtime").JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined;
106
+ export declare function DataGrid<T extends EntityRow = EntityRow>({ entity, fields, columns, itemActions, cols, gap, minCardWidth, className, isLoading, error, imageField, selectable, selectionEvent, infiniteScroll, loadMoreEvent, hasMore, children, pageSize, renderItem: schemaRenderItem, dragGroup, accepts, sortable, dropEvent, reorderEvent, dndItemIdField, dndRoot, }: DataGridProps<T>): string | number | bigint | boolean | import("react/jsx-runtime").JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined;
107
107
  export declare namespace DataGrid {
108
108
  var displayName: string;
109
109
  }
@@ -117,7 +117,7 @@ export interface DataListProps<T extends EntityRow = EntityRow> extends DataDndP
117
117
  /** Max items to show before "Show More" button. Defaults to 5. Set to 0 to disable. */
118
118
  pageSize?: number;
119
119
  }
120
- export declare function DataList<T extends EntityRow = EntityRow>({ entity, fields, columns, itemActions, gap, variant, groupBy, senderField, currentUser, className, isLoading, error, reorderable: _reorderable, reorderEvent: _reorderEvent, swipeLeftEvent: _swipeLeftEvent, swipeLeftActions: _swipeLeftActions, swipeRightEvent: _swipeRightEvent, swipeRightActions: _swipeRightActions, longPressEvent: _longPressEvent, infiniteScroll, loadMoreEvent, hasMore, children, pageSize, renderItem: schemaRenderItem, dragGroup, accepts, sortable: sortableProp, dropEvent, reorderEvent: dndReorderEvent, dndItemIdField, }: DataListProps<T>): string | number | bigint | boolean | import("react/jsx-runtime").JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined;
120
+ export declare function DataList<T extends EntityRow = EntityRow>({ entity, fields, columns, itemActions, gap, variant, groupBy, senderField, currentUser, className, isLoading, error, reorderable: _reorderable, reorderEvent: _reorderEvent, swipeLeftEvent: _swipeLeftEvent, swipeLeftActions: _swipeLeftActions, swipeRightEvent: _swipeRightEvent, swipeRightActions: _swipeRightActions, longPressEvent: _longPressEvent, infiniteScroll, loadMoreEvent, hasMore, children, pageSize, renderItem: schemaRenderItem, dragGroup, accepts, sortable: sortableProp, dropEvent, reorderEvent: dndReorderEvent, dndItemIdField, dndRoot, }: DataListProps<T>): string | number | bigint | boolean | import("react/jsx-runtime").JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined;
121
121
  export declare namespace DataList {
122
122
  var displayName: string;
123
123
  }
@@ -26,6 +26,15 @@ export interface DataDndProps {
26
26
  dropEvent?: EventKey;
27
27
  reorderEvent?: EventKey;
28
28
  dndItemIdField?: string;
29
+ /**
30
+ * Mark this container as the DnD root for its subtree. Use on an outer
31
+ * container (e.g. a data-grid hosting inner data-lists) when the container
32
+ * itself is NOT a drop target or sortable, but descendant zones need to
33
+ * share one DndContext so items can be dragged between them. Inner zones
34
+ * with `accepts` / `dragGroup` / `sortable` detect this root and skip
35
+ * creating their own DndContext.
36
+ */
37
+ dndRoot?: boolean;
29
38
  }
30
39
  interface UseDataDndArgs<T extends EntityRow> extends DataDndProps {
31
40
  items: readonly T[];
@@ -33,6 +42,8 @@ interface UseDataDndArgs<T extends EntityRow> extends DataDndProps {
33
42
  }
34
43
  interface UseDataDndResult<T extends EntityRow> {
35
44
  enabled: boolean;
45
+ /** True when this container is a sortable zone (own items are draggable). False in dndRoot-only mode. */
46
+ isZone: boolean;
36
47
  wrapContainer: (children: React.ReactNode) => React.ReactNode;
37
48
  SortableItem: React.FC<{
38
49
  id: UniqueIdentifier;
@@ -21326,10 +21326,12 @@ function useDataDnd(args) {
21326
21326
  dropEvent,
21327
21327
  reorderEvent,
21328
21328
  dndItemIdField = "id",
21329
+ dndRoot,
21329
21330
  items,
21330
21331
  layout
21331
21332
  } = args;
21332
- const enabled = Boolean(dragGroup || accepts || sortable$1);
21333
+ const isZone = Boolean(dragGroup || accepts || sortable$1);
21334
+ const enabled = isZone || Boolean(dndRoot);
21333
21335
  const eventBus = useEventBus();
21334
21336
  const parentRoot = React81__namespace.default.useContext(RootCtx);
21335
21337
  const isRoot = enabled && parentRoot === null;
@@ -21371,6 +21373,13 @@ function useDataDnd(args) {
21371
21373
  core$1.useSensor(core$1.PointerSensor, { activationConstraint: { distance: 5 } }),
21372
21374
  core$1.useSensor(core$1.KeyboardSensor, { coordinateGetter: sortable.sortableKeyboardCoordinates })
21373
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
+ }, []);
21374
21383
  const findZoneByItem = React81__namespace.default.useCallback(
21375
21384
  (id) => {
21376
21385
  for (const z of zonesRef.current.values()) {
@@ -21467,7 +21476,8 @@ function useDataDnd(args) {
21467
21476
  Box,
21468
21477
  {
21469
21478
  ref: setNodeRef,
21470
- className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg" : void 0,
21479
+ "data-dnd-zone": ownGroup,
21480
+ className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg transition-all min-h-[3rem]" : "min-h-[3rem] rounded-lg transition-all",
21471
21481
  children
21472
21482
  }
21473
21483
  );
@@ -21480,16 +21490,21 @@ function useDataDnd(args) {
21480
21490
  (children) => {
21481
21491
  if (!enabled) return children;
21482
21492
  const strategy = layout === "grid" ? sortable.rectSortingStrategy : sortable.verticalListSortingStrategy;
21493
+ if (!isZone) {
21494
+ if (!isRoot) return children;
21495
+ return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
21496
+ }
21483
21497
  const inner = /* @__PURE__ */ jsxRuntime.jsx(DropZoneShell, { children: /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: itemIds, strategy, children }) });
21484
21498
  if (isRoot) {
21485
- 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 }) });
21486
21500
  }
21487
21501
  return inner;
21488
21502
  },
21489
- [enabled, layout, sensors, handleDragEnd, itemIds, isRoot, rootContextValue]
21503
+ [enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
21490
21504
  );
21491
21505
  return {
21492
21506
  enabled,
21507
+ isZone,
21493
21508
  wrapContainer,
21494
21509
  SortableItem,
21495
21510
  orderedItems
@@ -21573,7 +21588,8 @@ function DataGrid({
21573
21588
  sortable,
21574
21589
  dropEvent,
21575
21590
  reorderEvent,
21576
- dndItemIdField
21591
+ dndItemIdField,
21592
+ dndRoot
21577
21593
  }) {
21578
21594
  const eventBus = useEventBus();
21579
21595
  const { t } = useTranslate();
@@ -21589,7 +21605,8 @@ function DataGrid({
21589
21605
  sortable,
21590
21606
  dropEvent,
21591
21607
  reorderEvent,
21592
- dndItemIdField
21608
+ dndItemIdField,
21609
+ dndRoot
21593
21610
  });
21594
21611
  const allData = dnd.orderedItems;
21595
21612
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
@@ -21693,7 +21710,7 @@ function DataGrid({
21693
21710
  const id = itemData.id || String(index);
21694
21711
  const isSelected = selectedIds.has(id);
21695
21712
  const dndId = itemData[idFieldName] ?? `__idx_${index}`;
21696
- 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;
21697
21714
  if (hasRenderProp) {
21698
21715
  return wrapDnd(
21699
21716
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -21979,7 +21996,8 @@ function DataList({
21979
21996
  sortable: sortableProp,
21980
21997
  dropEvent,
21981
21998
  reorderEvent: dndReorderEvent,
21982
- dndItemIdField
21999
+ dndItemIdField,
22000
+ dndRoot
21983
22001
  }) {
21984
22002
  const eventBus = useEventBus();
21985
22003
  const { t } = useTranslate();
@@ -21994,7 +22012,8 @@ function DataList({
21994
22012
  sortable: sortableProp,
21995
22013
  dropEvent,
21996
22014
  reorderEvent: dndReorderEvent,
21997
- dndItemIdField
22015
+ dndItemIdField,
22016
+ dndRoot
21998
22017
  });
21999
22018
  const allData = dnd.orderedItems;
22000
22019
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
@@ -22107,7 +22126,7 @@ function DataList({
22107
22126
  const idFieldName = dndItemIdField ?? "id";
22108
22127
  const renderItem = (itemData, index, isLast) => {
22109
22128
  const dndId = itemData[idFieldName] ?? `__idx_${index}`;
22110
- 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;
22111
22130
  if (hasRenderProp) {
22112
22131
  const id2 = itemData.id || String(index);
22113
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';
@@ -21280,10 +21280,12 @@ function useDataDnd(args) {
21280
21280
  dropEvent,
21281
21281
  reorderEvent,
21282
21282
  dndItemIdField = "id",
21283
+ dndRoot,
21283
21284
  items,
21284
21285
  layout
21285
21286
  } = args;
21286
- const enabled = Boolean(dragGroup || accepts || sortable);
21287
+ const isZone = Boolean(dragGroup || accepts || sortable);
21288
+ const enabled = isZone || Boolean(dndRoot);
21287
21289
  const eventBus = useEventBus();
21288
21290
  const parentRoot = React81__default.useContext(RootCtx);
21289
21291
  const isRoot = enabled && parentRoot === null;
@@ -21325,6 +21327,13 @@ function useDataDnd(args) {
21325
21327
  useSensor(PointerSensor, { activationConstraint: { distance: 5 } }),
21326
21328
  useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates })
21327
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
+ }, []);
21328
21337
  const findZoneByItem = React81__default.useCallback(
21329
21338
  (id) => {
21330
21339
  for (const z of zonesRef.current.values()) {
@@ -21421,7 +21430,8 @@ function useDataDnd(args) {
21421
21430
  Box,
21422
21431
  {
21423
21432
  ref: setNodeRef,
21424
- className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg" : void 0,
21433
+ "data-dnd-zone": ownGroup,
21434
+ className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg transition-all min-h-[3rem]" : "min-h-[3rem] rounded-lg transition-all",
21425
21435
  children
21426
21436
  }
21427
21437
  );
@@ -21434,16 +21444,21 @@ function useDataDnd(args) {
21434
21444
  (children) => {
21435
21445
  if (!enabled) return children;
21436
21446
  const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
21447
+ if (!isZone) {
21448
+ if (!isRoot) return children;
21449
+ return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
21450
+ }
21437
21451
  const inner = /* @__PURE__ */ jsx(DropZoneShell, { children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy, children }) });
21438
21452
  if (isRoot) {
21439
- 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 }) });
21440
21454
  }
21441
21455
  return inner;
21442
21456
  },
21443
- [enabled, layout, sensors, handleDragEnd, itemIds, isRoot, rootContextValue]
21457
+ [enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
21444
21458
  );
21445
21459
  return {
21446
21460
  enabled,
21461
+ isZone,
21447
21462
  wrapContainer,
21448
21463
  SortableItem,
21449
21464
  orderedItems
@@ -21527,7 +21542,8 @@ function DataGrid({
21527
21542
  sortable,
21528
21543
  dropEvent,
21529
21544
  reorderEvent,
21530
- dndItemIdField
21545
+ dndItemIdField,
21546
+ dndRoot
21531
21547
  }) {
21532
21548
  const eventBus = useEventBus();
21533
21549
  const { t } = useTranslate();
@@ -21543,7 +21559,8 @@ function DataGrid({
21543
21559
  sortable,
21544
21560
  dropEvent,
21545
21561
  reorderEvent,
21546
- dndItemIdField
21562
+ dndItemIdField,
21563
+ dndRoot
21547
21564
  });
21548
21565
  const allData = dnd.orderedItems;
21549
21566
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
@@ -21647,7 +21664,7 @@ function DataGrid({
21647
21664
  const id = itemData.id || String(index);
21648
21665
  const isSelected = selectedIds.has(id);
21649
21666
  const dndId = itemData[idFieldName] ?? `__idx_${index}`;
21650
- 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;
21651
21668
  if (hasRenderProp) {
21652
21669
  return wrapDnd(
21653
21670
  /* @__PURE__ */ jsx(
@@ -21933,7 +21950,8 @@ function DataList({
21933
21950
  sortable: sortableProp,
21934
21951
  dropEvent,
21935
21952
  reorderEvent: dndReorderEvent,
21936
- dndItemIdField
21953
+ dndItemIdField,
21954
+ dndRoot
21937
21955
  }) {
21938
21956
  const eventBus = useEventBus();
21939
21957
  const { t } = useTranslate();
@@ -21948,7 +21966,8 @@ function DataList({
21948
21966
  sortable: sortableProp,
21949
21967
  dropEvent,
21950
21968
  reorderEvent: dndReorderEvent,
21951
- dndItemIdField
21969
+ dndItemIdField,
21970
+ dndRoot
21952
21971
  });
21953
21972
  const allData = dnd.orderedItems;
21954
21973
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
@@ -22061,7 +22080,7 @@ function DataList({
22061
22080
  const idFieldName = dndItemIdField ?? "id";
22062
22081
  const renderItem = (itemData, index, isLast) => {
22063
22082
  const dndId = itemData[idFieldName] ?? `__idx_${index}`;
22064
- 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;
22065
22084
  if (hasRenderProp) {
22066
22085
  const id2 = itemData.id || String(index);
22067
22086
  return wrapDnd(
@@ -21095,10 +21095,12 @@ function useDataDnd(args) {
21095
21095
  dropEvent,
21096
21096
  reorderEvent,
21097
21097
  dndItemIdField = "id",
21098
+ dndRoot,
21098
21099
  items,
21099
21100
  layout
21100
21101
  } = args;
21101
- const enabled = Boolean(dragGroup || accepts || sortable$1);
21102
+ const isZone = Boolean(dragGroup || accepts || sortable$1);
21103
+ const enabled = isZone || Boolean(dndRoot);
21102
21104
  const eventBus = useEventBus();
21103
21105
  const parentRoot = React80__namespace.default.useContext(RootCtx);
21104
21106
  const isRoot = enabled && parentRoot === null;
@@ -21140,6 +21142,13 @@ function useDataDnd(args) {
21140
21142
  core$1.useSensor(core$1.PointerSensor, { activationConstraint: { distance: 5 } }),
21141
21143
  core$1.useSensor(core$1.KeyboardSensor, { coordinateGetter: sortable.sortableKeyboardCoordinates })
21142
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
+ }, []);
21143
21152
  const findZoneByItem = React80__namespace.default.useCallback(
21144
21153
  (id) => {
21145
21154
  for (const z of zonesRef.current.values()) {
@@ -21236,7 +21245,8 @@ function useDataDnd(args) {
21236
21245
  Box,
21237
21246
  {
21238
21247
  ref: setNodeRef,
21239
- className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg" : void 0,
21248
+ "data-dnd-zone": ownGroup,
21249
+ className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg transition-all min-h-[3rem]" : "min-h-[3rem] rounded-lg transition-all",
21240
21250
  children
21241
21251
  }
21242
21252
  );
@@ -21249,16 +21259,21 @@ function useDataDnd(args) {
21249
21259
  (children) => {
21250
21260
  if (!enabled) return children;
21251
21261
  const strategy = layout === "grid" ? sortable.rectSortingStrategy : sortable.verticalListSortingStrategy;
21262
+ if (!isZone) {
21263
+ if (!isRoot) return children;
21264
+ return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
21265
+ }
21252
21266
  const inner = /* @__PURE__ */ jsxRuntime.jsx(DropZoneShell, { children: /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: itemIds, strategy, children }) });
21253
21267
  if (isRoot) {
21254
- 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 }) });
21255
21269
  }
21256
21270
  return inner;
21257
21271
  },
21258
- [enabled, layout, sensors, handleDragEnd, itemIds, isRoot, rootContextValue]
21272
+ [enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
21259
21273
  );
21260
21274
  return {
21261
21275
  enabled,
21276
+ isZone,
21262
21277
  wrapContainer,
21263
21278
  SortableItem,
21264
21279
  orderedItems
@@ -21342,7 +21357,8 @@ function DataGrid({
21342
21357
  sortable,
21343
21358
  dropEvent,
21344
21359
  reorderEvent,
21345
- dndItemIdField
21360
+ dndItemIdField,
21361
+ dndRoot
21346
21362
  }) {
21347
21363
  const eventBus = useEventBus();
21348
21364
  const { t } = useTranslate();
@@ -21358,7 +21374,8 @@ function DataGrid({
21358
21374
  sortable,
21359
21375
  dropEvent,
21360
21376
  reorderEvent,
21361
- dndItemIdField
21377
+ dndItemIdField,
21378
+ dndRoot
21362
21379
  });
21363
21380
  const allData = dnd.orderedItems;
21364
21381
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
@@ -21462,7 +21479,7 @@ function DataGrid({
21462
21479
  const id = itemData.id || String(index);
21463
21480
  const isSelected = selectedIds.has(id);
21464
21481
  const dndId = itemData[idFieldName] ?? `__idx_${index}`;
21465
- 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;
21466
21483
  if (hasRenderProp) {
21467
21484
  return wrapDnd(
21468
21485
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -21748,7 +21765,8 @@ function DataList({
21748
21765
  sortable: sortableProp,
21749
21766
  dropEvent,
21750
21767
  reorderEvent: dndReorderEvent,
21751
- dndItemIdField
21768
+ dndItemIdField,
21769
+ dndRoot
21752
21770
  }) {
21753
21771
  const eventBus = useEventBus();
21754
21772
  const { t } = useTranslate();
@@ -21763,7 +21781,8 @@ function DataList({
21763
21781
  sortable: sortableProp,
21764
21782
  dropEvent,
21765
21783
  reorderEvent: dndReorderEvent,
21766
- dndItemIdField
21784
+ dndItemIdField,
21785
+ dndRoot
21767
21786
  });
21768
21787
  const allData = dnd.orderedItems;
21769
21788
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
@@ -21876,7 +21895,7 @@ function DataList({
21876
21895
  const idFieldName = dndItemIdField ?? "id";
21877
21896
  const renderItem = (itemData, index, isLast) => {
21878
21897
  const dndId = itemData[idFieldName] ?? `__idx_${index}`;
21879
- 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;
21880
21899
  if (hasRenderProp) {
21881
21900
  const id2 = itemData.id || String(index);
21882
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';
@@ -21049,10 +21049,12 @@ function useDataDnd(args) {
21049
21049
  dropEvent,
21050
21050
  reorderEvent,
21051
21051
  dndItemIdField = "id",
21052
+ dndRoot,
21052
21053
  items,
21053
21054
  layout
21054
21055
  } = args;
21055
- const enabled = Boolean(dragGroup || accepts || sortable);
21056
+ const isZone = Boolean(dragGroup || accepts || sortable);
21057
+ const enabled = isZone || Boolean(dndRoot);
21056
21058
  const eventBus = useEventBus();
21057
21059
  const parentRoot = React80__default.useContext(RootCtx);
21058
21060
  const isRoot = enabled && parentRoot === null;
@@ -21094,6 +21096,13 @@ function useDataDnd(args) {
21094
21096
  useSensor(PointerSensor, { activationConstraint: { distance: 5 } }),
21095
21097
  useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates })
21096
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
+ }, []);
21097
21106
  const findZoneByItem = React80__default.useCallback(
21098
21107
  (id) => {
21099
21108
  for (const z of zonesRef.current.values()) {
@@ -21190,7 +21199,8 @@ function useDataDnd(args) {
21190
21199
  Box,
21191
21200
  {
21192
21201
  ref: setNodeRef,
21193
- className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg" : void 0,
21202
+ "data-dnd-zone": ownGroup,
21203
+ className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg transition-all min-h-[3rem]" : "min-h-[3rem] rounded-lg transition-all",
21194
21204
  children
21195
21205
  }
21196
21206
  );
@@ -21203,16 +21213,21 @@ function useDataDnd(args) {
21203
21213
  (children) => {
21204
21214
  if (!enabled) return children;
21205
21215
  const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
21216
+ if (!isZone) {
21217
+ if (!isRoot) return children;
21218
+ return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
21219
+ }
21206
21220
  const inner = /* @__PURE__ */ jsx(DropZoneShell, { children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy, children }) });
21207
21221
  if (isRoot) {
21208
- 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 }) });
21209
21223
  }
21210
21224
  return inner;
21211
21225
  },
21212
- [enabled, layout, sensors, handleDragEnd, itemIds, isRoot, rootContextValue]
21226
+ [enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
21213
21227
  );
21214
21228
  return {
21215
21229
  enabled,
21230
+ isZone,
21216
21231
  wrapContainer,
21217
21232
  SortableItem,
21218
21233
  orderedItems
@@ -21296,7 +21311,8 @@ function DataGrid({
21296
21311
  sortable,
21297
21312
  dropEvent,
21298
21313
  reorderEvent,
21299
- dndItemIdField
21314
+ dndItemIdField,
21315
+ dndRoot
21300
21316
  }) {
21301
21317
  const eventBus = useEventBus();
21302
21318
  const { t } = useTranslate();
@@ -21312,7 +21328,8 @@ function DataGrid({
21312
21328
  sortable,
21313
21329
  dropEvent,
21314
21330
  reorderEvent,
21315
- dndItemIdField
21331
+ dndItemIdField,
21332
+ dndRoot
21316
21333
  });
21317
21334
  const allData = dnd.orderedItems;
21318
21335
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
@@ -21416,7 +21433,7 @@ function DataGrid({
21416
21433
  const id = itemData.id || String(index);
21417
21434
  const isSelected = selectedIds.has(id);
21418
21435
  const dndId = itemData[idFieldName] ?? `__idx_${index}`;
21419
- 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;
21420
21437
  if (hasRenderProp) {
21421
21438
  return wrapDnd(
21422
21439
  /* @__PURE__ */ jsx(
@@ -21702,7 +21719,8 @@ function DataList({
21702
21719
  sortable: sortableProp,
21703
21720
  dropEvent,
21704
21721
  reorderEvent: dndReorderEvent,
21705
- dndItemIdField
21722
+ dndItemIdField,
21723
+ dndRoot
21706
21724
  }) {
21707
21725
  const eventBus = useEventBus();
21708
21726
  const { t } = useTranslate();
@@ -21717,7 +21735,8 @@ function DataList({
21717
21735
  sortable: sortableProp,
21718
21736
  dropEvent,
21719
21737
  reorderEvent: dndReorderEvent,
21720
- dndItemIdField
21738
+ dndItemIdField,
21739
+ dndRoot
21721
21740
  });
21722
21741
  const allData = dnd.orderedItems;
21723
21742
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
@@ -21830,7 +21849,7 @@ function DataList({
21830
21849
  const idFieldName = dndItemIdField ?? "id";
21831
21850
  const renderItem = (itemData, index, isLast) => {
21832
21851
  const dndId = itemData[idFieldName] ?? `__idx_${index}`;
21833
- 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;
21834
21853
  if (hasRenderProp) {
21835
21854
  const id2 = itemData.id || String(index);
21836
21855
  return wrapDnd(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/ui",
3
- "version": "4.50.0",
3
+ "version": "4.50.2",
4
4
  "description": "React UI components, hooks, and providers for Almadar",
5
5
  "type": "module",
6
6
  "sideEffects": [