@almadar/ui 4.50.10 → 4.50.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/avl/index.cjs +34 -9
- package/dist/avl/index.js +34 -9
- package/dist/components/index.cjs +34 -9
- package/dist/components/index.js +34 -9
- package/dist/providers/index.cjs +34 -9
- package/dist/providers/index.js +34 -9
- package/dist/runtime/index.cjs +34 -9
- package/dist/runtime/index.js +34 -9
- package/package.json +1 -1
package/dist/avl/index.cjs
CHANGED
|
@@ -24947,6 +24947,7 @@ function useDataDnd(args) {
|
|
|
24947
24947
|
const unregisterZone = React93__namespace.default.useCallback((zoneId2) => {
|
|
24948
24948
|
zonesRef.current.delete(zoneId2);
|
|
24949
24949
|
}, []);
|
|
24950
|
+
const [activeDrag, setActiveDrag] = React93__namespace.default.useState(null);
|
|
24950
24951
|
const zoneId = React93__namespace.default.useId();
|
|
24951
24952
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
24952
24953
|
const meta = React93__namespace.default.useMemo(
|
|
@@ -25127,30 +25128,49 @@ function useDataDnd(args) {
|
|
|
25127
25128
|
id: droppableId,
|
|
25128
25129
|
data: sortableData
|
|
25129
25130
|
});
|
|
25131
|
+
const ctx = React93__namespace.default.useContext(RootCtx);
|
|
25132
|
+
const activeDrag2 = ctx?.activeDrag ?? null;
|
|
25133
|
+
const showForeignPlaceholder = isOver && activeDrag2 != null && activeDrag2.sourceGroup !== ownGroup;
|
|
25130
25134
|
React93__namespace.default.useEffect(() => {
|
|
25131
|
-
dndLog.debug("dropzone:isOver:change", { droppableId, group: ownGroup, isOver });
|
|
25132
|
-
}, [droppableId, isOver]);
|
|
25133
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
25135
|
+
dndLog.debug("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, showForeignPlaceholder });
|
|
25136
|
+
}, [droppableId, isOver, showForeignPlaceholder]);
|
|
25137
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
25134
25138
|
Box,
|
|
25135
25139
|
{
|
|
25136
25140
|
ref: setNodeRef,
|
|
25137
25141
|
"data-dnd-zone": ownGroup,
|
|
25138
25142
|
"data-dnd-is-over": isOver ? "true" : "false",
|
|
25139
25143
|
className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg transition-all min-h-[3rem]" : "min-h-[3rem] rounded-lg transition-all",
|
|
25140
|
-
children
|
|
25144
|
+
children: [
|
|
25145
|
+
children,
|
|
25146
|
+
showForeignPlaceholder ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
25147
|
+
Box,
|
|
25148
|
+
{
|
|
25149
|
+
"data-dnd-placeholder": true,
|
|
25150
|
+
style: { height: activeDrag2.height },
|
|
25151
|
+
className: "border-2 border-dashed border-primary/60 bg-primary/5 rounded-md my-1 transition-all"
|
|
25152
|
+
}
|
|
25153
|
+
) : null
|
|
25154
|
+
]
|
|
25141
25155
|
}
|
|
25142
25156
|
);
|
|
25143
25157
|
};
|
|
25144
25158
|
const rootContextValue = React93__namespace.default.useMemo(
|
|
25145
|
-
() => ({ registerZone, unregisterZone }),
|
|
25146
|
-
[registerZone, unregisterZone]
|
|
25159
|
+
() => ({ registerZone, unregisterZone, activeDrag }),
|
|
25160
|
+
[registerZone, unregisterZone, activeDrag]
|
|
25147
25161
|
);
|
|
25148
25162
|
const handleDragStart = React93__namespace.default.useCallback((event) => {
|
|
25149
25163
|
const sourceZone = findZoneByItem(event.active.id);
|
|
25164
|
+
const rect = event.active.rect.current.initial;
|
|
25165
|
+
const height = rect?.height && rect.height > 0 ? rect.height : 64;
|
|
25166
|
+
if (sourceZone) {
|
|
25167
|
+
setActiveDrag({ sourceGroup: sourceZone.group, height });
|
|
25168
|
+
}
|
|
25150
25169
|
dndLog.info("dragStart", {
|
|
25151
25170
|
activeId: event.active.id,
|
|
25152
25171
|
activeData: event.active.data?.current,
|
|
25153
25172
|
sourceGroup: sourceZone?.group,
|
|
25173
|
+
height,
|
|
25154
25174
|
zoneCount: zonesRef.current.size
|
|
25155
25175
|
});
|
|
25156
25176
|
}, [findZoneByItem]);
|
|
@@ -25162,11 +25182,16 @@ function useDataDnd(args) {
|
|
|
25162
25182
|
});
|
|
25163
25183
|
}, []);
|
|
25164
25184
|
const handleDragCancel = React93__namespace.default.useCallback((event) => {
|
|
25185
|
+
setActiveDrag(null);
|
|
25165
25186
|
dndLog.warn("dragCancel", {
|
|
25166
25187
|
activeId: event.active.id,
|
|
25167
25188
|
reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
|
|
25168
25189
|
});
|
|
25169
25190
|
}, []);
|
|
25191
|
+
const handleDragEndWithCleanup = React93__namespace.default.useCallback((event) => {
|
|
25192
|
+
handleDragEnd(event);
|
|
25193
|
+
setActiveDrag(null);
|
|
25194
|
+
}, [handleDragEnd]);
|
|
25170
25195
|
const wrapContainer = React93__namespace.default.useCallback(
|
|
25171
25196
|
(children) => {
|
|
25172
25197
|
if (!enabled) return children;
|
|
@@ -25180,7 +25205,7 @@ function useDataDnd(args) {
|
|
|
25180
25205
|
collisionDetection,
|
|
25181
25206
|
onDragStart: handleDragStart,
|
|
25182
25207
|
onDragOver: handleDragOver,
|
|
25183
|
-
onDragEnd:
|
|
25208
|
+
onDragEnd: handleDragEndWithCleanup,
|
|
25184
25209
|
onDragCancel: handleDragCancel,
|
|
25185
25210
|
children
|
|
25186
25211
|
}
|
|
@@ -25195,7 +25220,7 @@ function useDataDnd(args) {
|
|
|
25195
25220
|
collisionDetection,
|
|
25196
25221
|
onDragStart: handleDragStart,
|
|
25197
25222
|
onDragOver: handleDragOver,
|
|
25198
|
-
onDragEnd:
|
|
25223
|
+
onDragEnd: handleDragEndWithCleanup,
|
|
25199
25224
|
onDragCancel: handleDragCancel,
|
|
25200
25225
|
children: inner
|
|
25201
25226
|
}
|
|
@@ -25203,7 +25228,7 @@ function useDataDnd(args) {
|
|
|
25203
25228
|
}
|
|
25204
25229
|
return inner;
|
|
25205
25230
|
},
|
|
25206
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver,
|
|
25231
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver, handleDragEndWithCleanup, handleDragCancel, itemIds, isRoot, rootContextValue]
|
|
25207
25232
|
);
|
|
25208
25233
|
return {
|
|
25209
25234
|
enabled,
|
package/dist/avl/index.js
CHANGED
|
@@ -24901,6 +24901,7 @@ function useDataDnd(args) {
|
|
|
24901
24901
|
const unregisterZone = React93__default.useCallback((zoneId2) => {
|
|
24902
24902
|
zonesRef.current.delete(zoneId2);
|
|
24903
24903
|
}, []);
|
|
24904
|
+
const [activeDrag, setActiveDrag] = React93__default.useState(null);
|
|
24904
24905
|
const zoneId = React93__default.useId();
|
|
24905
24906
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
24906
24907
|
const meta = React93__default.useMemo(
|
|
@@ -25081,30 +25082,49 @@ function useDataDnd(args) {
|
|
|
25081
25082
|
id: droppableId,
|
|
25082
25083
|
data: sortableData
|
|
25083
25084
|
});
|
|
25085
|
+
const ctx = React93__default.useContext(RootCtx);
|
|
25086
|
+
const activeDrag2 = ctx?.activeDrag ?? null;
|
|
25087
|
+
const showForeignPlaceholder = isOver && activeDrag2 != null && activeDrag2.sourceGroup !== ownGroup;
|
|
25084
25088
|
React93__default.useEffect(() => {
|
|
25085
|
-
dndLog.debug("dropzone:isOver:change", { droppableId, group: ownGroup, isOver });
|
|
25086
|
-
}, [droppableId, isOver]);
|
|
25087
|
-
return /* @__PURE__ */
|
|
25089
|
+
dndLog.debug("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, showForeignPlaceholder });
|
|
25090
|
+
}, [droppableId, isOver, showForeignPlaceholder]);
|
|
25091
|
+
return /* @__PURE__ */ jsxs(
|
|
25088
25092
|
Box,
|
|
25089
25093
|
{
|
|
25090
25094
|
ref: setNodeRef,
|
|
25091
25095
|
"data-dnd-zone": ownGroup,
|
|
25092
25096
|
"data-dnd-is-over": isOver ? "true" : "false",
|
|
25093
25097
|
className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg transition-all min-h-[3rem]" : "min-h-[3rem] rounded-lg transition-all",
|
|
25094
|
-
children
|
|
25098
|
+
children: [
|
|
25099
|
+
children,
|
|
25100
|
+
showForeignPlaceholder ? /* @__PURE__ */ jsx(
|
|
25101
|
+
Box,
|
|
25102
|
+
{
|
|
25103
|
+
"data-dnd-placeholder": true,
|
|
25104
|
+
style: { height: activeDrag2.height },
|
|
25105
|
+
className: "border-2 border-dashed border-primary/60 bg-primary/5 rounded-md my-1 transition-all"
|
|
25106
|
+
}
|
|
25107
|
+
) : null
|
|
25108
|
+
]
|
|
25095
25109
|
}
|
|
25096
25110
|
);
|
|
25097
25111
|
};
|
|
25098
25112
|
const rootContextValue = React93__default.useMemo(
|
|
25099
|
-
() => ({ registerZone, unregisterZone }),
|
|
25100
|
-
[registerZone, unregisterZone]
|
|
25113
|
+
() => ({ registerZone, unregisterZone, activeDrag }),
|
|
25114
|
+
[registerZone, unregisterZone, activeDrag]
|
|
25101
25115
|
);
|
|
25102
25116
|
const handleDragStart = React93__default.useCallback((event) => {
|
|
25103
25117
|
const sourceZone = findZoneByItem(event.active.id);
|
|
25118
|
+
const rect = event.active.rect.current.initial;
|
|
25119
|
+
const height = rect?.height && rect.height > 0 ? rect.height : 64;
|
|
25120
|
+
if (sourceZone) {
|
|
25121
|
+
setActiveDrag({ sourceGroup: sourceZone.group, height });
|
|
25122
|
+
}
|
|
25104
25123
|
dndLog.info("dragStart", {
|
|
25105
25124
|
activeId: event.active.id,
|
|
25106
25125
|
activeData: event.active.data?.current,
|
|
25107
25126
|
sourceGroup: sourceZone?.group,
|
|
25127
|
+
height,
|
|
25108
25128
|
zoneCount: zonesRef.current.size
|
|
25109
25129
|
});
|
|
25110
25130
|
}, [findZoneByItem]);
|
|
@@ -25116,11 +25136,16 @@ function useDataDnd(args) {
|
|
|
25116
25136
|
});
|
|
25117
25137
|
}, []);
|
|
25118
25138
|
const handleDragCancel = React93__default.useCallback((event) => {
|
|
25139
|
+
setActiveDrag(null);
|
|
25119
25140
|
dndLog.warn("dragCancel", {
|
|
25120
25141
|
activeId: event.active.id,
|
|
25121
25142
|
reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
|
|
25122
25143
|
});
|
|
25123
25144
|
}, []);
|
|
25145
|
+
const handleDragEndWithCleanup = React93__default.useCallback((event) => {
|
|
25146
|
+
handleDragEnd(event);
|
|
25147
|
+
setActiveDrag(null);
|
|
25148
|
+
}, [handleDragEnd]);
|
|
25124
25149
|
const wrapContainer = React93__default.useCallback(
|
|
25125
25150
|
(children) => {
|
|
25126
25151
|
if (!enabled) return children;
|
|
@@ -25134,7 +25159,7 @@ function useDataDnd(args) {
|
|
|
25134
25159
|
collisionDetection,
|
|
25135
25160
|
onDragStart: handleDragStart,
|
|
25136
25161
|
onDragOver: handleDragOver,
|
|
25137
|
-
onDragEnd:
|
|
25162
|
+
onDragEnd: handleDragEndWithCleanup,
|
|
25138
25163
|
onDragCancel: handleDragCancel,
|
|
25139
25164
|
children
|
|
25140
25165
|
}
|
|
@@ -25149,7 +25174,7 @@ function useDataDnd(args) {
|
|
|
25149
25174
|
collisionDetection,
|
|
25150
25175
|
onDragStart: handleDragStart,
|
|
25151
25176
|
onDragOver: handleDragOver,
|
|
25152
|
-
onDragEnd:
|
|
25177
|
+
onDragEnd: handleDragEndWithCleanup,
|
|
25153
25178
|
onDragCancel: handleDragCancel,
|
|
25154
25179
|
children: inner
|
|
25155
25180
|
}
|
|
@@ -25157,7 +25182,7 @@ function useDataDnd(args) {
|
|
|
25157
25182
|
}
|
|
25158
25183
|
return inner;
|
|
25159
25184
|
},
|
|
25160
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver,
|
|
25185
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver, handleDragEndWithCleanup, handleDragCancel, itemIds, isRoot, rootContextValue]
|
|
25161
25186
|
);
|
|
25162
25187
|
return {
|
|
25163
25188
|
enabled,
|
|
@@ -20114,6 +20114,7 @@ function useDataDnd(args) {
|
|
|
20114
20114
|
const unregisterZone = React75__namespace.default.useCallback((zoneId2) => {
|
|
20115
20115
|
zonesRef.current.delete(zoneId2);
|
|
20116
20116
|
}, []);
|
|
20117
|
+
const [activeDrag, setActiveDrag] = React75__namespace.default.useState(null);
|
|
20117
20118
|
const zoneId = React75__namespace.default.useId();
|
|
20118
20119
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
20119
20120
|
const meta = React75__namespace.default.useMemo(
|
|
@@ -20294,30 +20295,49 @@ function useDataDnd(args) {
|
|
|
20294
20295
|
id: droppableId,
|
|
20295
20296
|
data: sortableData
|
|
20296
20297
|
});
|
|
20298
|
+
const ctx = React75__namespace.default.useContext(RootCtx);
|
|
20299
|
+
const activeDrag2 = ctx?.activeDrag ?? null;
|
|
20300
|
+
const showForeignPlaceholder = isOver && activeDrag2 != null && activeDrag2.sourceGroup !== ownGroup;
|
|
20297
20301
|
React75__namespace.default.useEffect(() => {
|
|
20298
|
-
dndLog.debug("dropzone:isOver:change", { droppableId, group: ownGroup, isOver });
|
|
20299
|
-
}, [droppableId, isOver]);
|
|
20300
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
20302
|
+
dndLog.debug("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, showForeignPlaceholder });
|
|
20303
|
+
}, [droppableId, isOver, showForeignPlaceholder]);
|
|
20304
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
20301
20305
|
exports.Box,
|
|
20302
20306
|
{
|
|
20303
20307
|
ref: setNodeRef,
|
|
20304
20308
|
"data-dnd-zone": ownGroup,
|
|
20305
20309
|
"data-dnd-is-over": isOver ? "true" : "false",
|
|
20306
20310
|
className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg transition-all min-h-[3rem]" : "min-h-[3rem] rounded-lg transition-all",
|
|
20307
|
-
children
|
|
20311
|
+
children: [
|
|
20312
|
+
children,
|
|
20313
|
+
showForeignPlaceholder ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
20314
|
+
exports.Box,
|
|
20315
|
+
{
|
|
20316
|
+
"data-dnd-placeholder": true,
|
|
20317
|
+
style: { height: activeDrag2.height },
|
|
20318
|
+
className: "border-2 border-dashed border-primary/60 bg-primary/5 rounded-md my-1 transition-all"
|
|
20319
|
+
}
|
|
20320
|
+
) : null
|
|
20321
|
+
]
|
|
20308
20322
|
}
|
|
20309
20323
|
);
|
|
20310
20324
|
};
|
|
20311
20325
|
const rootContextValue = React75__namespace.default.useMemo(
|
|
20312
|
-
() => ({ registerZone, unregisterZone }),
|
|
20313
|
-
[registerZone, unregisterZone]
|
|
20326
|
+
() => ({ registerZone, unregisterZone, activeDrag }),
|
|
20327
|
+
[registerZone, unregisterZone, activeDrag]
|
|
20314
20328
|
);
|
|
20315
20329
|
const handleDragStart = React75__namespace.default.useCallback((event) => {
|
|
20316
20330
|
const sourceZone = findZoneByItem(event.active.id);
|
|
20331
|
+
const rect = event.active.rect.current.initial;
|
|
20332
|
+
const height = rect?.height && rect.height > 0 ? rect.height : 64;
|
|
20333
|
+
if (sourceZone) {
|
|
20334
|
+
setActiveDrag({ sourceGroup: sourceZone.group, height });
|
|
20335
|
+
}
|
|
20317
20336
|
dndLog.info("dragStart", {
|
|
20318
20337
|
activeId: event.active.id,
|
|
20319
20338
|
activeData: event.active.data?.current,
|
|
20320
20339
|
sourceGroup: sourceZone?.group,
|
|
20340
|
+
height,
|
|
20321
20341
|
zoneCount: zonesRef.current.size
|
|
20322
20342
|
});
|
|
20323
20343
|
}, [findZoneByItem]);
|
|
@@ -20329,11 +20349,16 @@ function useDataDnd(args) {
|
|
|
20329
20349
|
});
|
|
20330
20350
|
}, []);
|
|
20331
20351
|
const handleDragCancel = React75__namespace.default.useCallback((event) => {
|
|
20352
|
+
setActiveDrag(null);
|
|
20332
20353
|
dndLog.warn("dragCancel", {
|
|
20333
20354
|
activeId: event.active.id,
|
|
20334
20355
|
reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
|
|
20335
20356
|
});
|
|
20336
20357
|
}, []);
|
|
20358
|
+
const handleDragEndWithCleanup = React75__namespace.default.useCallback((event) => {
|
|
20359
|
+
handleDragEnd(event);
|
|
20360
|
+
setActiveDrag(null);
|
|
20361
|
+
}, [handleDragEnd]);
|
|
20337
20362
|
const wrapContainer = React75__namespace.default.useCallback(
|
|
20338
20363
|
(children) => {
|
|
20339
20364
|
if (!enabled) return children;
|
|
@@ -20347,7 +20372,7 @@ function useDataDnd(args) {
|
|
|
20347
20372
|
collisionDetection,
|
|
20348
20373
|
onDragStart: handleDragStart,
|
|
20349
20374
|
onDragOver: handleDragOver,
|
|
20350
|
-
onDragEnd:
|
|
20375
|
+
onDragEnd: handleDragEndWithCleanup,
|
|
20351
20376
|
onDragCancel: handleDragCancel,
|
|
20352
20377
|
children
|
|
20353
20378
|
}
|
|
@@ -20362,7 +20387,7 @@ function useDataDnd(args) {
|
|
|
20362
20387
|
collisionDetection,
|
|
20363
20388
|
onDragStart: handleDragStart,
|
|
20364
20389
|
onDragOver: handleDragOver,
|
|
20365
|
-
onDragEnd:
|
|
20390
|
+
onDragEnd: handleDragEndWithCleanup,
|
|
20366
20391
|
onDragCancel: handleDragCancel,
|
|
20367
20392
|
children: inner
|
|
20368
20393
|
}
|
|
@@ -20370,7 +20395,7 @@ function useDataDnd(args) {
|
|
|
20370
20395
|
}
|
|
20371
20396
|
return inner;
|
|
20372
20397
|
},
|
|
20373
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver,
|
|
20398
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver, handleDragEndWithCleanup, handleDragCancel, itemIds, isRoot, rootContextValue]
|
|
20374
20399
|
);
|
|
20375
20400
|
return {
|
|
20376
20401
|
enabled,
|
package/dist/components/index.js
CHANGED
|
@@ -20068,6 +20068,7 @@ function useDataDnd(args) {
|
|
|
20068
20068
|
const unregisterZone = React75__default.useCallback((zoneId2) => {
|
|
20069
20069
|
zonesRef.current.delete(zoneId2);
|
|
20070
20070
|
}, []);
|
|
20071
|
+
const [activeDrag, setActiveDrag] = React75__default.useState(null);
|
|
20071
20072
|
const zoneId = React75__default.useId();
|
|
20072
20073
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
20073
20074
|
const meta = React75__default.useMemo(
|
|
@@ -20248,30 +20249,49 @@ function useDataDnd(args) {
|
|
|
20248
20249
|
id: droppableId,
|
|
20249
20250
|
data: sortableData
|
|
20250
20251
|
});
|
|
20252
|
+
const ctx = React75__default.useContext(RootCtx);
|
|
20253
|
+
const activeDrag2 = ctx?.activeDrag ?? null;
|
|
20254
|
+
const showForeignPlaceholder = isOver && activeDrag2 != null && activeDrag2.sourceGroup !== ownGroup;
|
|
20251
20255
|
React75__default.useEffect(() => {
|
|
20252
|
-
dndLog.debug("dropzone:isOver:change", { droppableId, group: ownGroup, isOver });
|
|
20253
|
-
}, [droppableId, isOver]);
|
|
20254
|
-
return /* @__PURE__ */
|
|
20256
|
+
dndLog.debug("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, showForeignPlaceholder });
|
|
20257
|
+
}, [droppableId, isOver, showForeignPlaceholder]);
|
|
20258
|
+
return /* @__PURE__ */ jsxs(
|
|
20255
20259
|
Box,
|
|
20256
20260
|
{
|
|
20257
20261
|
ref: setNodeRef,
|
|
20258
20262
|
"data-dnd-zone": ownGroup,
|
|
20259
20263
|
"data-dnd-is-over": isOver ? "true" : "false",
|
|
20260
20264
|
className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg transition-all min-h-[3rem]" : "min-h-[3rem] rounded-lg transition-all",
|
|
20261
|
-
children
|
|
20265
|
+
children: [
|
|
20266
|
+
children,
|
|
20267
|
+
showForeignPlaceholder ? /* @__PURE__ */ jsx(
|
|
20268
|
+
Box,
|
|
20269
|
+
{
|
|
20270
|
+
"data-dnd-placeholder": true,
|
|
20271
|
+
style: { height: activeDrag2.height },
|
|
20272
|
+
className: "border-2 border-dashed border-primary/60 bg-primary/5 rounded-md my-1 transition-all"
|
|
20273
|
+
}
|
|
20274
|
+
) : null
|
|
20275
|
+
]
|
|
20262
20276
|
}
|
|
20263
20277
|
);
|
|
20264
20278
|
};
|
|
20265
20279
|
const rootContextValue = React75__default.useMemo(
|
|
20266
|
-
() => ({ registerZone, unregisterZone }),
|
|
20267
|
-
[registerZone, unregisterZone]
|
|
20280
|
+
() => ({ registerZone, unregisterZone, activeDrag }),
|
|
20281
|
+
[registerZone, unregisterZone, activeDrag]
|
|
20268
20282
|
);
|
|
20269
20283
|
const handleDragStart = React75__default.useCallback((event) => {
|
|
20270
20284
|
const sourceZone = findZoneByItem(event.active.id);
|
|
20285
|
+
const rect = event.active.rect.current.initial;
|
|
20286
|
+
const height = rect?.height && rect.height > 0 ? rect.height : 64;
|
|
20287
|
+
if (sourceZone) {
|
|
20288
|
+
setActiveDrag({ sourceGroup: sourceZone.group, height });
|
|
20289
|
+
}
|
|
20271
20290
|
dndLog.info("dragStart", {
|
|
20272
20291
|
activeId: event.active.id,
|
|
20273
20292
|
activeData: event.active.data?.current,
|
|
20274
20293
|
sourceGroup: sourceZone?.group,
|
|
20294
|
+
height,
|
|
20275
20295
|
zoneCount: zonesRef.current.size
|
|
20276
20296
|
});
|
|
20277
20297
|
}, [findZoneByItem]);
|
|
@@ -20283,11 +20303,16 @@ function useDataDnd(args) {
|
|
|
20283
20303
|
});
|
|
20284
20304
|
}, []);
|
|
20285
20305
|
const handleDragCancel = React75__default.useCallback((event) => {
|
|
20306
|
+
setActiveDrag(null);
|
|
20286
20307
|
dndLog.warn("dragCancel", {
|
|
20287
20308
|
activeId: event.active.id,
|
|
20288
20309
|
reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
|
|
20289
20310
|
});
|
|
20290
20311
|
}, []);
|
|
20312
|
+
const handleDragEndWithCleanup = React75__default.useCallback((event) => {
|
|
20313
|
+
handleDragEnd(event);
|
|
20314
|
+
setActiveDrag(null);
|
|
20315
|
+
}, [handleDragEnd]);
|
|
20291
20316
|
const wrapContainer = React75__default.useCallback(
|
|
20292
20317
|
(children) => {
|
|
20293
20318
|
if (!enabled) return children;
|
|
@@ -20301,7 +20326,7 @@ function useDataDnd(args) {
|
|
|
20301
20326
|
collisionDetection,
|
|
20302
20327
|
onDragStart: handleDragStart,
|
|
20303
20328
|
onDragOver: handleDragOver,
|
|
20304
|
-
onDragEnd:
|
|
20329
|
+
onDragEnd: handleDragEndWithCleanup,
|
|
20305
20330
|
onDragCancel: handleDragCancel,
|
|
20306
20331
|
children
|
|
20307
20332
|
}
|
|
@@ -20316,7 +20341,7 @@ function useDataDnd(args) {
|
|
|
20316
20341
|
collisionDetection,
|
|
20317
20342
|
onDragStart: handleDragStart,
|
|
20318
20343
|
onDragOver: handleDragOver,
|
|
20319
|
-
onDragEnd:
|
|
20344
|
+
onDragEnd: handleDragEndWithCleanup,
|
|
20320
20345
|
onDragCancel: handleDragCancel,
|
|
20321
20346
|
children: inner
|
|
20322
20347
|
}
|
|
@@ -20324,7 +20349,7 @@ function useDataDnd(args) {
|
|
|
20324
20349
|
}
|
|
20325
20350
|
return inner;
|
|
20326
20351
|
},
|
|
20327
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver,
|
|
20352
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver, handleDragEndWithCleanup, handleDragCancel, itemIds, isRoot, rootContextValue]
|
|
20328
20353
|
);
|
|
20329
20354
|
return {
|
|
20330
20355
|
enabled,
|
package/dist/providers/index.cjs
CHANGED
|
@@ -21359,6 +21359,7 @@ function useDataDnd(args) {
|
|
|
21359
21359
|
const unregisterZone = React81__namespace.default.useCallback((zoneId2) => {
|
|
21360
21360
|
zonesRef.current.delete(zoneId2);
|
|
21361
21361
|
}, []);
|
|
21362
|
+
const [activeDrag, setActiveDrag] = React81__namespace.default.useState(null);
|
|
21362
21363
|
const zoneId = React81__namespace.default.useId();
|
|
21363
21364
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
21364
21365
|
const meta = React81__namespace.default.useMemo(
|
|
@@ -21539,30 +21540,49 @@ function useDataDnd(args) {
|
|
|
21539
21540
|
id: droppableId,
|
|
21540
21541
|
data: sortableData
|
|
21541
21542
|
});
|
|
21543
|
+
const ctx = React81__namespace.default.useContext(RootCtx);
|
|
21544
|
+
const activeDrag2 = ctx?.activeDrag ?? null;
|
|
21545
|
+
const showForeignPlaceholder = isOver && activeDrag2 != null && activeDrag2.sourceGroup !== ownGroup;
|
|
21542
21546
|
React81__namespace.default.useEffect(() => {
|
|
21543
|
-
dndLog.debug("dropzone:isOver:change", { droppableId, group: ownGroup, isOver });
|
|
21544
|
-
}, [droppableId, isOver]);
|
|
21545
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
21547
|
+
dndLog.debug("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, showForeignPlaceholder });
|
|
21548
|
+
}, [droppableId, isOver, showForeignPlaceholder]);
|
|
21549
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
21546
21550
|
Box,
|
|
21547
21551
|
{
|
|
21548
21552
|
ref: setNodeRef,
|
|
21549
21553
|
"data-dnd-zone": ownGroup,
|
|
21550
21554
|
"data-dnd-is-over": isOver ? "true" : "false",
|
|
21551
21555
|
className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg transition-all min-h-[3rem]" : "min-h-[3rem] rounded-lg transition-all",
|
|
21552
|
-
children
|
|
21556
|
+
children: [
|
|
21557
|
+
children,
|
|
21558
|
+
showForeignPlaceholder ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
21559
|
+
Box,
|
|
21560
|
+
{
|
|
21561
|
+
"data-dnd-placeholder": true,
|
|
21562
|
+
style: { height: activeDrag2.height },
|
|
21563
|
+
className: "border-2 border-dashed border-primary/60 bg-primary/5 rounded-md my-1 transition-all"
|
|
21564
|
+
}
|
|
21565
|
+
) : null
|
|
21566
|
+
]
|
|
21553
21567
|
}
|
|
21554
21568
|
);
|
|
21555
21569
|
};
|
|
21556
21570
|
const rootContextValue = React81__namespace.default.useMemo(
|
|
21557
|
-
() => ({ registerZone, unregisterZone }),
|
|
21558
|
-
[registerZone, unregisterZone]
|
|
21571
|
+
() => ({ registerZone, unregisterZone, activeDrag }),
|
|
21572
|
+
[registerZone, unregisterZone, activeDrag]
|
|
21559
21573
|
);
|
|
21560
21574
|
const handleDragStart = React81__namespace.default.useCallback((event) => {
|
|
21561
21575
|
const sourceZone = findZoneByItem(event.active.id);
|
|
21576
|
+
const rect = event.active.rect.current.initial;
|
|
21577
|
+
const height = rect?.height && rect.height > 0 ? rect.height : 64;
|
|
21578
|
+
if (sourceZone) {
|
|
21579
|
+
setActiveDrag({ sourceGroup: sourceZone.group, height });
|
|
21580
|
+
}
|
|
21562
21581
|
dndLog.info("dragStart", {
|
|
21563
21582
|
activeId: event.active.id,
|
|
21564
21583
|
activeData: event.active.data?.current,
|
|
21565
21584
|
sourceGroup: sourceZone?.group,
|
|
21585
|
+
height,
|
|
21566
21586
|
zoneCount: zonesRef.current.size
|
|
21567
21587
|
});
|
|
21568
21588
|
}, [findZoneByItem]);
|
|
@@ -21574,11 +21594,16 @@ function useDataDnd(args) {
|
|
|
21574
21594
|
});
|
|
21575
21595
|
}, []);
|
|
21576
21596
|
const handleDragCancel = React81__namespace.default.useCallback((event) => {
|
|
21597
|
+
setActiveDrag(null);
|
|
21577
21598
|
dndLog.warn("dragCancel", {
|
|
21578
21599
|
activeId: event.active.id,
|
|
21579
21600
|
reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
|
|
21580
21601
|
});
|
|
21581
21602
|
}, []);
|
|
21603
|
+
const handleDragEndWithCleanup = React81__namespace.default.useCallback((event) => {
|
|
21604
|
+
handleDragEnd(event);
|
|
21605
|
+
setActiveDrag(null);
|
|
21606
|
+
}, [handleDragEnd]);
|
|
21582
21607
|
const wrapContainer = React81__namespace.default.useCallback(
|
|
21583
21608
|
(children) => {
|
|
21584
21609
|
if (!enabled) return children;
|
|
@@ -21592,7 +21617,7 @@ function useDataDnd(args) {
|
|
|
21592
21617
|
collisionDetection,
|
|
21593
21618
|
onDragStart: handleDragStart,
|
|
21594
21619
|
onDragOver: handleDragOver,
|
|
21595
|
-
onDragEnd:
|
|
21620
|
+
onDragEnd: handleDragEndWithCleanup,
|
|
21596
21621
|
onDragCancel: handleDragCancel,
|
|
21597
21622
|
children
|
|
21598
21623
|
}
|
|
@@ -21607,7 +21632,7 @@ function useDataDnd(args) {
|
|
|
21607
21632
|
collisionDetection,
|
|
21608
21633
|
onDragStart: handleDragStart,
|
|
21609
21634
|
onDragOver: handleDragOver,
|
|
21610
|
-
onDragEnd:
|
|
21635
|
+
onDragEnd: handleDragEndWithCleanup,
|
|
21611
21636
|
onDragCancel: handleDragCancel,
|
|
21612
21637
|
children: inner
|
|
21613
21638
|
}
|
|
@@ -21615,7 +21640,7 @@ function useDataDnd(args) {
|
|
|
21615
21640
|
}
|
|
21616
21641
|
return inner;
|
|
21617
21642
|
},
|
|
21618
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver,
|
|
21643
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver, handleDragEndWithCleanup, handleDragCancel, itemIds, isRoot, rootContextValue]
|
|
21619
21644
|
);
|
|
21620
21645
|
return {
|
|
21621
21646
|
enabled,
|
package/dist/providers/index.js
CHANGED
|
@@ -21313,6 +21313,7 @@ function useDataDnd(args) {
|
|
|
21313
21313
|
const unregisterZone = React81__default.useCallback((zoneId2) => {
|
|
21314
21314
|
zonesRef.current.delete(zoneId2);
|
|
21315
21315
|
}, []);
|
|
21316
|
+
const [activeDrag, setActiveDrag] = React81__default.useState(null);
|
|
21316
21317
|
const zoneId = React81__default.useId();
|
|
21317
21318
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
21318
21319
|
const meta = React81__default.useMemo(
|
|
@@ -21493,30 +21494,49 @@ function useDataDnd(args) {
|
|
|
21493
21494
|
id: droppableId,
|
|
21494
21495
|
data: sortableData
|
|
21495
21496
|
});
|
|
21497
|
+
const ctx = React81__default.useContext(RootCtx);
|
|
21498
|
+
const activeDrag2 = ctx?.activeDrag ?? null;
|
|
21499
|
+
const showForeignPlaceholder = isOver && activeDrag2 != null && activeDrag2.sourceGroup !== ownGroup;
|
|
21496
21500
|
React81__default.useEffect(() => {
|
|
21497
|
-
dndLog.debug("dropzone:isOver:change", { droppableId, group: ownGroup, isOver });
|
|
21498
|
-
}, [droppableId, isOver]);
|
|
21499
|
-
return /* @__PURE__ */
|
|
21501
|
+
dndLog.debug("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, showForeignPlaceholder });
|
|
21502
|
+
}, [droppableId, isOver, showForeignPlaceholder]);
|
|
21503
|
+
return /* @__PURE__ */ jsxs(
|
|
21500
21504
|
Box,
|
|
21501
21505
|
{
|
|
21502
21506
|
ref: setNodeRef,
|
|
21503
21507
|
"data-dnd-zone": ownGroup,
|
|
21504
21508
|
"data-dnd-is-over": isOver ? "true" : "false",
|
|
21505
21509
|
className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg transition-all min-h-[3rem]" : "min-h-[3rem] rounded-lg transition-all",
|
|
21506
|
-
children
|
|
21510
|
+
children: [
|
|
21511
|
+
children,
|
|
21512
|
+
showForeignPlaceholder ? /* @__PURE__ */ jsx(
|
|
21513
|
+
Box,
|
|
21514
|
+
{
|
|
21515
|
+
"data-dnd-placeholder": true,
|
|
21516
|
+
style: { height: activeDrag2.height },
|
|
21517
|
+
className: "border-2 border-dashed border-primary/60 bg-primary/5 rounded-md my-1 transition-all"
|
|
21518
|
+
}
|
|
21519
|
+
) : null
|
|
21520
|
+
]
|
|
21507
21521
|
}
|
|
21508
21522
|
);
|
|
21509
21523
|
};
|
|
21510
21524
|
const rootContextValue = React81__default.useMemo(
|
|
21511
|
-
() => ({ registerZone, unregisterZone }),
|
|
21512
|
-
[registerZone, unregisterZone]
|
|
21525
|
+
() => ({ registerZone, unregisterZone, activeDrag }),
|
|
21526
|
+
[registerZone, unregisterZone, activeDrag]
|
|
21513
21527
|
);
|
|
21514
21528
|
const handleDragStart = React81__default.useCallback((event) => {
|
|
21515
21529
|
const sourceZone = findZoneByItem(event.active.id);
|
|
21530
|
+
const rect = event.active.rect.current.initial;
|
|
21531
|
+
const height = rect?.height && rect.height > 0 ? rect.height : 64;
|
|
21532
|
+
if (sourceZone) {
|
|
21533
|
+
setActiveDrag({ sourceGroup: sourceZone.group, height });
|
|
21534
|
+
}
|
|
21516
21535
|
dndLog.info("dragStart", {
|
|
21517
21536
|
activeId: event.active.id,
|
|
21518
21537
|
activeData: event.active.data?.current,
|
|
21519
21538
|
sourceGroup: sourceZone?.group,
|
|
21539
|
+
height,
|
|
21520
21540
|
zoneCount: zonesRef.current.size
|
|
21521
21541
|
});
|
|
21522
21542
|
}, [findZoneByItem]);
|
|
@@ -21528,11 +21548,16 @@ function useDataDnd(args) {
|
|
|
21528
21548
|
});
|
|
21529
21549
|
}, []);
|
|
21530
21550
|
const handleDragCancel = React81__default.useCallback((event) => {
|
|
21551
|
+
setActiveDrag(null);
|
|
21531
21552
|
dndLog.warn("dragCancel", {
|
|
21532
21553
|
activeId: event.active.id,
|
|
21533
21554
|
reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
|
|
21534
21555
|
});
|
|
21535
21556
|
}, []);
|
|
21557
|
+
const handleDragEndWithCleanup = React81__default.useCallback((event) => {
|
|
21558
|
+
handleDragEnd(event);
|
|
21559
|
+
setActiveDrag(null);
|
|
21560
|
+
}, [handleDragEnd]);
|
|
21536
21561
|
const wrapContainer = React81__default.useCallback(
|
|
21537
21562
|
(children) => {
|
|
21538
21563
|
if (!enabled) return children;
|
|
@@ -21546,7 +21571,7 @@ function useDataDnd(args) {
|
|
|
21546
21571
|
collisionDetection,
|
|
21547
21572
|
onDragStart: handleDragStart,
|
|
21548
21573
|
onDragOver: handleDragOver,
|
|
21549
|
-
onDragEnd:
|
|
21574
|
+
onDragEnd: handleDragEndWithCleanup,
|
|
21550
21575
|
onDragCancel: handleDragCancel,
|
|
21551
21576
|
children
|
|
21552
21577
|
}
|
|
@@ -21561,7 +21586,7 @@ function useDataDnd(args) {
|
|
|
21561
21586
|
collisionDetection,
|
|
21562
21587
|
onDragStart: handleDragStart,
|
|
21563
21588
|
onDragOver: handleDragOver,
|
|
21564
|
-
onDragEnd:
|
|
21589
|
+
onDragEnd: handleDragEndWithCleanup,
|
|
21565
21590
|
onDragCancel: handleDragCancel,
|
|
21566
21591
|
children: inner
|
|
21567
21592
|
}
|
|
@@ -21569,7 +21594,7 @@ function useDataDnd(args) {
|
|
|
21569
21594
|
}
|
|
21570
21595
|
return inner;
|
|
21571
21596
|
},
|
|
21572
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver,
|
|
21597
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver, handleDragEndWithCleanup, handleDragCancel, itemIds, isRoot, rootContextValue]
|
|
21573
21598
|
);
|
|
21574
21599
|
return {
|
|
21575
21600
|
enabled,
|
package/dist/runtime/index.cjs
CHANGED
|
@@ -21128,6 +21128,7 @@ function useDataDnd(args) {
|
|
|
21128
21128
|
const unregisterZone = React80__namespace.default.useCallback((zoneId2) => {
|
|
21129
21129
|
zonesRef.current.delete(zoneId2);
|
|
21130
21130
|
}, []);
|
|
21131
|
+
const [activeDrag, setActiveDrag] = React80__namespace.default.useState(null);
|
|
21131
21132
|
const zoneId = React80__namespace.default.useId();
|
|
21132
21133
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
21133
21134
|
const meta = React80__namespace.default.useMemo(
|
|
@@ -21308,30 +21309,49 @@ function useDataDnd(args) {
|
|
|
21308
21309
|
id: droppableId,
|
|
21309
21310
|
data: sortableData
|
|
21310
21311
|
});
|
|
21312
|
+
const ctx = React80__namespace.default.useContext(RootCtx);
|
|
21313
|
+
const activeDrag2 = ctx?.activeDrag ?? null;
|
|
21314
|
+
const showForeignPlaceholder = isOver && activeDrag2 != null && activeDrag2.sourceGroup !== ownGroup;
|
|
21311
21315
|
React80__namespace.default.useEffect(() => {
|
|
21312
|
-
dndLog.debug("dropzone:isOver:change", { droppableId, group: ownGroup, isOver });
|
|
21313
|
-
}, [droppableId, isOver]);
|
|
21314
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
21316
|
+
dndLog.debug("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, showForeignPlaceholder });
|
|
21317
|
+
}, [droppableId, isOver, showForeignPlaceholder]);
|
|
21318
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
21315
21319
|
Box,
|
|
21316
21320
|
{
|
|
21317
21321
|
ref: setNodeRef,
|
|
21318
21322
|
"data-dnd-zone": ownGroup,
|
|
21319
21323
|
"data-dnd-is-over": isOver ? "true" : "false",
|
|
21320
21324
|
className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg transition-all min-h-[3rem]" : "min-h-[3rem] rounded-lg transition-all",
|
|
21321
|
-
children
|
|
21325
|
+
children: [
|
|
21326
|
+
children,
|
|
21327
|
+
showForeignPlaceholder ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
21328
|
+
Box,
|
|
21329
|
+
{
|
|
21330
|
+
"data-dnd-placeholder": true,
|
|
21331
|
+
style: { height: activeDrag2.height },
|
|
21332
|
+
className: "border-2 border-dashed border-primary/60 bg-primary/5 rounded-md my-1 transition-all"
|
|
21333
|
+
}
|
|
21334
|
+
) : null
|
|
21335
|
+
]
|
|
21322
21336
|
}
|
|
21323
21337
|
);
|
|
21324
21338
|
};
|
|
21325
21339
|
const rootContextValue = React80__namespace.default.useMemo(
|
|
21326
|
-
() => ({ registerZone, unregisterZone }),
|
|
21327
|
-
[registerZone, unregisterZone]
|
|
21340
|
+
() => ({ registerZone, unregisterZone, activeDrag }),
|
|
21341
|
+
[registerZone, unregisterZone, activeDrag]
|
|
21328
21342
|
);
|
|
21329
21343
|
const handleDragStart = React80__namespace.default.useCallback((event) => {
|
|
21330
21344
|
const sourceZone = findZoneByItem(event.active.id);
|
|
21345
|
+
const rect = event.active.rect.current.initial;
|
|
21346
|
+
const height = rect?.height && rect.height > 0 ? rect.height : 64;
|
|
21347
|
+
if (sourceZone) {
|
|
21348
|
+
setActiveDrag({ sourceGroup: sourceZone.group, height });
|
|
21349
|
+
}
|
|
21331
21350
|
dndLog.info("dragStart", {
|
|
21332
21351
|
activeId: event.active.id,
|
|
21333
21352
|
activeData: event.active.data?.current,
|
|
21334
21353
|
sourceGroup: sourceZone?.group,
|
|
21354
|
+
height,
|
|
21335
21355
|
zoneCount: zonesRef.current.size
|
|
21336
21356
|
});
|
|
21337
21357
|
}, [findZoneByItem]);
|
|
@@ -21343,11 +21363,16 @@ function useDataDnd(args) {
|
|
|
21343
21363
|
});
|
|
21344
21364
|
}, []);
|
|
21345
21365
|
const handleDragCancel = React80__namespace.default.useCallback((event) => {
|
|
21366
|
+
setActiveDrag(null);
|
|
21346
21367
|
dndLog.warn("dragCancel", {
|
|
21347
21368
|
activeId: event.active.id,
|
|
21348
21369
|
reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
|
|
21349
21370
|
});
|
|
21350
21371
|
}, []);
|
|
21372
|
+
const handleDragEndWithCleanup = React80__namespace.default.useCallback((event) => {
|
|
21373
|
+
handleDragEnd(event);
|
|
21374
|
+
setActiveDrag(null);
|
|
21375
|
+
}, [handleDragEnd]);
|
|
21351
21376
|
const wrapContainer = React80__namespace.default.useCallback(
|
|
21352
21377
|
(children) => {
|
|
21353
21378
|
if (!enabled) return children;
|
|
@@ -21361,7 +21386,7 @@ function useDataDnd(args) {
|
|
|
21361
21386
|
collisionDetection,
|
|
21362
21387
|
onDragStart: handleDragStart,
|
|
21363
21388
|
onDragOver: handleDragOver,
|
|
21364
|
-
onDragEnd:
|
|
21389
|
+
onDragEnd: handleDragEndWithCleanup,
|
|
21365
21390
|
onDragCancel: handleDragCancel,
|
|
21366
21391
|
children
|
|
21367
21392
|
}
|
|
@@ -21376,7 +21401,7 @@ function useDataDnd(args) {
|
|
|
21376
21401
|
collisionDetection,
|
|
21377
21402
|
onDragStart: handleDragStart,
|
|
21378
21403
|
onDragOver: handleDragOver,
|
|
21379
|
-
onDragEnd:
|
|
21404
|
+
onDragEnd: handleDragEndWithCleanup,
|
|
21380
21405
|
onDragCancel: handleDragCancel,
|
|
21381
21406
|
children: inner
|
|
21382
21407
|
}
|
|
@@ -21384,7 +21409,7 @@ function useDataDnd(args) {
|
|
|
21384
21409
|
}
|
|
21385
21410
|
return inner;
|
|
21386
21411
|
},
|
|
21387
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver,
|
|
21412
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver, handleDragEndWithCleanup, handleDragCancel, itemIds, isRoot, rootContextValue]
|
|
21388
21413
|
);
|
|
21389
21414
|
return {
|
|
21390
21415
|
enabled,
|
package/dist/runtime/index.js
CHANGED
|
@@ -21082,6 +21082,7 @@ function useDataDnd(args) {
|
|
|
21082
21082
|
const unregisterZone = React80__default.useCallback((zoneId2) => {
|
|
21083
21083
|
zonesRef.current.delete(zoneId2);
|
|
21084
21084
|
}, []);
|
|
21085
|
+
const [activeDrag, setActiveDrag] = React80__default.useState(null);
|
|
21085
21086
|
const zoneId = React80__default.useId();
|
|
21086
21087
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
21087
21088
|
const meta = React80__default.useMemo(
|
|
@@ -21262,30 +21263,49 @@ function useDataDnd(args) {
|
|
|
21262
21263
|
id: droppableId,
|
|
21263
21264
|
data: sortableData
|
|
21264
21265
|
});
|
|
21266
|
+
const ctx = React80__default.useContext(RootCtx);
|
|
21267
|
+
const activeDrag2 = ctx?.activeDrag ?? null;
|
|
21268
|
+
const showForeignPlaceholder = isOver && activeDrag2 != null && activeDrag2.sourceGroup !== ownGroup;
|
|
21265
21269
|
React80__default.useEffect(() => {
|
|
21266
|
-
dndLog.debug("dropzone:isOver:change", { droppableId, group: ownGroup, isOver });
|
|
21267
|
-
}, [droppableId, isOver]);
|
|
21268
|
-
return /* @__PURE__ */
|
|
21270
|
+
dndLog.debug("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, showForeignPlaceholder });
|
|
21271
|
+
}, [droppableId, isOver, showForeignPlaceholder]);
|
|
21272
|
+
return /* @__PURE__ */ jsxs(
|
|
21269
21273
|
Box,
|
|
21270
21274
|
{
|
|
21271
21275
|
ref: setNodeRef,
|
|
21272
21276
|
"data-dnd-zone": ownGroup,
|
|
21273
21277
|
"data-dnd-is-over": isOver ? "true" : "false",
|
|
21274
21278
|
className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg transition-all min-h-[3rem]" : "min-h-[3rem] rounded-lg transition-all",
|
|
21275
|
-
children
|
|
21279
|
+
children: [
|
|
21280
|
+
children,
|
|
21281
|
+
showForeignPlaceholder ? /* @__PURE__ */ jsx(
|
|
21282
|
+
Box,
|
|
21283
|
+
{
|
|
21284
|
+
"data-dnd-placeholder": true,
|
|
21285
|
+
style: { height: activeDrag2.height },
|
|
21286
|
+
className: "border-2 border-dashed border-primary/60 bg-primary/5 rounded-md my-1 transition-all"
|
|
21287
|
+
}
|
|
21288
|
+
) : null
|
|
21289
|
+
]
|
|
21276
21290
|
}
|
|
21277
21291
|
);
|
|
21278
21292
|
};
|
|
21279
21293
|
const rootContextValue = React80__default.useMemo(
|
|
21280
|
-
() => ({ registerZone, unregisterZone }),
|
|
21281
|
-
[registerZone, unregisterZone]
|
|
21294
|
+
() => ({ registerZone, unregisterZone, activeDrag }),
|
|
21295
|
+
[registerZone, unregisterZone, activeDrag]
|
|
21282
21296
|
);
|
|
21283
21297
|
const handleDragStart = React80__default.useCallback((event) => {
|
|
21284
21298
|
const sourceZone = findZoneByItem(event.active.id);
|
|
21299
|
+
const rect = event.active.rect.current.initial;
|
|
21300
|
+
const height = rect?.height && rect.height > 0 ? rect.height : 64;
|
|
21301
|
+
if (sourceZone) {
|
|
21302
|
+
setActiveDrag({ sourceGroup: sourceZone.group, height });
|
|
21303
|
+
}
|
|
21285
21304
|
dndLog.info("dragStart", {
|
|
21286
21305
|
activeId: event.active.id,
|
|
21287
21306
|
activeData: event.active.data?.current,
|
|
21288
21307
|
sourceGroup: sourceZone?.group,
|
|
21308
|
+
height,
|
|
21289
21309
|
zoneCount: zonesRef.current.size
|
|
21290
21310
|
});
|
|
21291
21311
|
}, [findZoneByItem]);
|
|
@@ -21297,11 +21317,16 @@ function useDataDnd(args) {
|
|
|
21297
21317
|
});
|
|
21298
21318
|
}, []);
|
|
21299
21319
|
const handleDragCancel = React80__default.useCallback((event) => {
|
|
21320
|
+
setActiveDrag(null);
|
|
21300
21321
|
dndLog.warn("dragCancel", {
|
|
21301
21322
|
activeId: event.active.id,
|
|
21302
21323
|
reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
|
|
21303
21324
|
});
|
|
21304
21325
|
}, []);
|
|
21326
|
+
const handleDragEndWithCleanup = React80__default.useCallback((event) => {
|
|
21327
|
+
handleDragEnd(event);
|
|
21328
|
+
setActiveDrag(null);
|
|
21329
|
+
}, [handleDragEnd]);
|
|
21305
21330
|
const wrapContainer = React80__default.useCallback(
|
|
21306
21331
|
(children) => {
|
|
21307
21332
|
if (!enabled) return children;
|
|
@@ -21315,7 +21340,7 @@ function useDataDnd(args) {
|
|
|
21315
21340
|
collisionDetection,
|
|
21316
21341
|
onDragStart: handleDragStart,
|
|
21317
21342
|
onDragOver: handleDragOver,
|
|
21318
|
-
onDragEnd:
|
|
21343
|
+
onDragEnd: handleDragEndWithCleanup,
|
|
21319
21344
|
onDragCancel: handleDragCancel,
|
|
21320
21345
|
children
|
|
21321
21346
|
}
|
|
@@ -21330,7 +21355,7 @@ function useDataDnd(args) {
|
|
|
21330
21355
|
collisionDetection,
|
|
21331
21356
|
onDragStart: handleDragStart,
|
|
21332
21357
|
onDragOver: handleDragOver,
|
|
21333
|
-
onDragEnd:
|
|
21358
|
+
onDragEnd: handleDragEndWithCleanup,
|
|
21334
21359
|
onDragCancel: handleDragCancel,
|
|
21335
21360
|
children: inner
|
|
21336
21361
|
}
|
|
@@ -21338,7 +21363,7 @@ function useDataDnd(args) {
|
|
|
21338
21363
|
}
|
|
21339
21364
|
return inner;
|
|
21340
21365
|
},
|
|
21341
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver,
|
|
21366
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver, handleDragEndWithCleanup, handleDragCancel, itemIds, isRoot, rootContextValue]
|
|
21342
21367
|
);
|
|
21343
21368
|
return {
|
|
21344
21369
|
enabled,
|