@almadar/ui 4.50.9 → 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.
@@ -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.jsx(
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: handleDragEnd,
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: handleDragEnd,
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, handleDragEnd, handleDragCancel, itemIds, isRoot, rootContextValue]
21643
+ [enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver, handleDragEndWithCleanup, handleDragCancel, itemIds, isRoot, rootContextValue]
21619
21644
  );
21620
21645
  return {
21621
21646
  enabled,
@@ -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__ */ jsx(
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: handleDragEnd,
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: handleDragEnd,
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, handleDragEnd, handleDragCancel, itemIds, isRoot, rootContextValue]
21597
+ [enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver, handleDragEndWithCleanup, handleDragCancel, itemIds, isRoot, rootContextValue]
21573
21598
  );
21574
21599
  return {
21575
21600
  enabled,
@@ -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.jsx(
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: handleDragEnd,
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: handleDragEnd,
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, handleDragEnd, handleDragCancel, itemIds, isRoot, rootContextValue]
21412
+ [enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver, handleDragEndWithCleanup, handleDragCancel, itemIds, isRoot, rootContextValue]
21388
21413
  );
21389
21414
  return {
21390
21415
  enabled,
@@ -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__ */ jsx(
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: handleDragEnd,
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: handleDragEnd,
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, handleDragEnd, handleDragCancel, itemIds, isRoot, rootContextValue]
21366
+ [enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver, handleDragEndWithCleanup, handleDragCancel, itemIds, isRoot, rootContextValue]
21342
21367
  );
21343
21368
  return {
21344
21369
  enabled,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/ui",
3
- "version": "4.50.9",
3
+ "version": "4.50.11",
4
4
  "description": "React UI components, hooks, and providers for Almadar",
5
5
  "type": "module",
6
6
  "sideEffects": [