@burdenoff/microfe-bigconsole 2026.1124.7 → 2026.1124.9

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.
@@ -1,6 +1,7 @@
1
1
  import { FC } from 'react';
2
2
  import { LucideIcon } from 'lucide-react';
3
3
  import { DashboardListStatus } from '../../hooks/useDashboardOperations';
4
+ import { BoardDnd } from '../../hooks/useBoardDragLink';
4
5
  import { FleetBadgeProps } from '../fleet/FleetBadge';
5
6
  export interface DashboardCardAction {
6
7
  id: string;
@@ -29,6 +30,8 @@ export interface DashboardGalleryCardProps {
29
30
  moreLabel: string;
30
31
  actions: readonly DashboardCardAction[];
31
32
  onOpen: (dashboardId: string) => void;
33
+ /** Dragging this board onto another links it (BOFF-15410). Absent where the board cannot be moved or linked. */
34
+ dnd?: BoardDnd;
32
35
  }
33
36
  export declare const DashboardGalleryCard: FC<DashboardGalleryCardProps>;
34
37
  export default DashboardGalleryCard;
@@ -6,13 +6,17 @@ import { Eye as i, LayoutDashboard as a, MoreHorizontal as o } from "lucide-reac
6
6
  import { Button as s, DropdownMenu as c, DropdownMenuContent as l, DropdownMenuItem as u, DropdownMenuSeparator as d, DropdownMenuTrigger as f } from "@burdenoff/fe-libs/ui";
7
7
  import { jsx as p, jsxs as m } from "react/jsx-runtime";
8
8
  // src/bigconsole/components/dashboard/DashboardGalleryCard.tsx
9
- var h = (e) => e.stopPropagation(), g = r(function({ dashboard: r, description: g, statusLabel: _, meta: v, fleetBadge: y, openLabel: b, moreLabel: x, actions: S, onOpen: C }) {
10
- let w = () => C(r.id), T = S.filter((e) => !e.danger), E = S.filter((e) => e.danger);
9
+ var h = (e) => e.stopPropagation(), g = r(function({ dashboard: r, description: g, statusLabel: _, meta: v, fleetBadge: y, openLabel: b, moreLabel: x, actions: S, onOpen: C, dnd: w }) {
10
+ let T = () => C(r.id), E = S.filter((e) => !e.danger), D = S.filter((e) => e.danger);
11
11
  return /* @__PURE__ */ m("div", {
12
12
  ...e(r.id),
13
13
  "data-testid": "dashboard-card",
14
- onClick: w,
15
- className: "group flex min-h-40 cursor-pointer flex-col gap-2.5 rounded-card border border-[var(--color-border-subtle)] bg-[var(--color-bg-surface)] p-4 shadow-[var(--shadow-elevation-1)] motion-safe:transition-[box-shadow,border-color] hover:border-[var(--color-border-hover)] hover:shadow-[var(--shadow-elevation-2)]",
14
+ onClick: T,
15
+ ...w?.drag,
16
+ ...w?.drop,
17
+ "data-dragging": w?.dragging ? "true" : void 0,
18
+ "data-drop-target": w?.target ? "true" : void 0,
19
+ className: `${w?.dragging ? "opacity-60 " : ""}${w?.target ? "ring-2 ring-[var(--color-action-primary-bg)] " : ""}group flex min-h-40 cursor-pointer flex-col gap-2.5 rounded-card border border-[var(--color-border-subtle)] bg-[var(--color-bg-surface)] p-4 shadow-[var(--shadow-elevation-1)] motion-safe:transition-[box-shadow,border-color] hover:border-[var(--color-border-hover)] hover:shadow-[var(--shadow-elevation-2)]`,
16
20
  children: [
17
21
  /* @__PURE__ */ m("div", {
18
22
  className: "flex items-start gap-3",
@@ -28,7 +32,7 @@ var h = (e) => e.stopPropagation(), g = r(function({ dashboard: r, description:
28
32
  type: "button",
29
33
  className: "line-clamp-2 max-w-full text-start hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
30
34
  onClick: (e) => {
31
- e.stopPropagation(), w();
35
+ e.stopPropagation(), T();
32
36
  },
33
37
  children: r.name
34
38
  })
@@ -56,7 +60,7 @@ var h = (e) => e.stopPropagation(), g = r(function({ dashboard: r, description:
56
60
  align: "end",
57
61
  className: "min-w-52",
58
62
  children: [
59
- T.map((e) => /* @__PURE__ */ m(u, {
63
+ E.map((e) => /* @__PURE__ */ m(u, {
60
64
  disabled: e.disabled,
61
65
  onSelect: e.onSelect,
62
66
  "data-testid": e.testId,
@@ -65,8 +69,8 @@ var h = (e) => e.stopPropagation(), g = r(function({ dashboard: r, description:
65
69
  "aria-hidden": "true"
66
70
  }), e.label]
67
71
  }, e.id)),
68
- E.length > 0 && T.length > 0 && /* @__PURE__ */ p(d, {}),
69
- E.map((e) => /* @__PURE__ */ m(u, {
72
+ D.length > 0 && E.length > 0 && /* @__PURE__ */ p(d, {}),
73
+ D.map((e) => /* @__PURE__ */ m(u, {
70
74
  disabled: e.disabled,
71
75
  onSelect: e.onSelect,
72
76
  "data-testid": e.testId,
@@ -108,7 +112,7 @@ var h = (e) => e.stopPropagation(), g = r(function({ dashboard: r, description:
108
112
  size: "sm",
109
113
  className: "ms-auto",
110
114
  onClick: (e) => {
111
- e.stopPropagation(), w();
115
+ e.stopPropagation(), T();
112
116
  },
113
117
  children: [/* @__PURE__ */ p(i, {
114
118
  className: "size-4",
@@ -0,0 +1,39 @@
1
+ import { DragEvent, MouseEvent } from 'react';
2
+ export interface DragBoard {
3
+ id: string;
4
+ name: string;
5
+ }
6
+ interface Options<T extends DragBoard> {
7
+ canPickUp: (board: T) => boolean;
8
+ canDrop: (dragged: T, target: T) => boolean;
9
+ onDrop: (dragged: T, target: T) => void;
10
+ }
11
+ export interface DragProps {
12
+ draggable?: true;
13
+ onMouseDown?: (event: MouseEvent) => void;
14
+ onDragStart?: (event: DragEvent) => void;
15
+ onDragEnd?: () => void;
16
+ }
17
+ export interface DropProps {
18
+ onDragOver: (event: DragEvent) => void;
19
+ onDragLeave: (event: DragEvent) => void;
20
+ onDrop: (event: DragEvent) => void;
21
+ }
22
+ /** Everything a board card needs to take part in a drag: its handlers, and whether it is held or a target now. */
23
+ export interface BoardDnd {
24
+ drag: DragProps;
25
+ drop: DropProps;
26
+ dragging: boolean;
27
+ target: boolean;
28
+ }
29
+ interface UseBoardDragLinkResult<T extends DragBoard> {
30
+ /** The board being dragged, to show it as picked up. */
31
+ draggingId: string | null;
32
+ /** The board a drop would land on right now, to show it as a target. */
33
+ overId: string | null;
34
+ dndOf: (board: T) => BoardDnd;
35
+ /** Forgets a drag in progress (the workspace or account changed). */
36
+ reset: () => void;
37
+ }
38
+ export declare function useBoardDragLink<T extends DragBoard>(options: Options<T>): UseBoardDragLinkResult<T>;
39
+ export {};
@@ -0,0 +1,62 @@
1
+ import { useCallback as e, useEffect as t, useRef as n, useState as r } from "react";
2
+ // src/bigconsole/hooks/useBoardDragLink.ts
3
+ var i = "button, a, input, select, textarea, label, summary, [role=\"button\"], [role=\"menuitem\"], [contenteditable]";
4
+ function a(a) {
5
+ let [o, s] = r(null), [c, l] = r(null), u = n(null), d = n(null), f = n(a);
6
+ t(() => {
7
+ f.current = a;
8
+ }, [a]);
9
+ let p = e(() => {
10
+ u.current = null, s(null), l(null);
11
+ }, []), m = (e) => a.canPickUp(e) ? {
12
+ draggable: !0,
13
+ onMouseDown: (e) => {
14
+ d.current = e.target;
15
+ },
16
+ onDragStart: (t) => {
17
+ let n = d.current;
18
+ if (d.current = null, n instanceof Element) {
19
+ let e = n.closest(i);
20
+ if (e && e !== t.currentTarget && t.currentTarget.contains(e)) {
21
+ t.preventDefault();
22
+ return;
23
+ }
24
+ }
25
+ t.target === t.currentTarget && (u.current = e, t.dataTransfer.effectAllowed = "link", t.dataTransfer.setData("text/plain", e.name), setTimeout(() => {
26
+ u.current?.id === e.id && s(e.id);
27
+ }, 0));
28
+ },
29
+ onDragEnd: p
30
+ } : { onDragEnd: p }, h = (e) => ({
31
+ onDragOver: (t) => {
32
+ let n = u.current;
33
+ n && f.current.canDrop(n, e) && (t.preventDefault(), t.dataTransfer.dropEffect = "link", l((t) => t === e.id ? t : e.id));
34
+ },
35
+ onDragLeave: (t) => {
36
+ let n = t.relatedTarget;
37
+ if (!(n instanceof Node && t.currentTarget.contains(n))) {
38
+ if (n === null) {
39
+ let e = t.currentTarget.getBoundingClientRect();
40
+ if (t.clientX > e.left && t.clientX < e.right && t.clientY > e.top && t.clientY < e.bottom) return;
41
+ }
42
+ l((t) => t === e.id ? null : t);
43
+ }
44
+ },
45
+ onDrop: (t) => {
46
+ let n = u.current;
47
+ n && f.current.canDrop(n, e) && (t.preventDefault(), p(), f.current.onDrop(n, e));
48
+ }
49
+ });
50
+ return {
51
+ draggingId: o,
52
+ overId: c,
53
+ dndOf: (e) => ({
54
+ drag: m(e),
55
+ drop: h(e),
56
+ dragging: o === e.id,
57
+ target: c === e.id
58
+ }),
59
+ reset: p
60
+ };
61
+ }
62
+ export { a as useBoardDragLink };