@cellarnode/ui 0.19.1 → 0.20.1

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.
Files changed (49) hide show
  1. package/dist/chat/chat-ws.d.ts +56 -0
  2. package/dist/chat/chat-ws.d.ts.map +1 -1
  3. package/dist/chat/chat-ws.js +103 -0
  4. package/dist/chat/chat-ws.js.map +1 -1
  5. package/dist/chat/index.d.ts +1 -1
  6. package/dist/chat/index.d.ts.map +1 -1
  7. package/dist/components/journey-card.d.ts +9 -1
  8. package/dist/components/journey-card.d.ts.map +1 -1
  9. package/dist/components/journey-card.js +13 -6
  10. package/dist/components/journey-card.js.map +1 -1
  11. package/dist/components/journey-card.stories.d.ts +2 -0
  12. package/dist/components/journey-card.stories.d.ts.map +1 -1
  13. package/dist/components/journey-card.stories.js +43 -0
  14. package/dist/components/journey-card.stories.js.map +1 -1
  15. package/dist/components/sortable-card-context.d.ts +18 -0
  16. package/dist/components/sortable-card-context.d.ts.map +1 -0
  17. package/dist/components/sortable-card-context.js +18 -0
  18. package/dist/components/sortable-card-context.js.map +1 -0
  19. package/dist/components/sortable-card-shell.d.ts +40 -21
  20. package/dist/components/sortable-card-shell.d.ts.map +1 -1
  21. package/dist/components/sortable-card-shell.js +46 -39
  22. package/dist/components/sortable-card-shell.js.map +1 -1
  23. package/dist/components/sortable-card-shell.stories.d.ts +1 -1
  24. package/dist/components/sortable-card-shell.stories.d.ts.map +1 -1
  25. package/dist/components/sortable-card-shell.stories.js +28 -15
  26. package/dist/components/sortable-card-shell.stories.js.map +1 -1
  27. package/dist/components/sortable-card-shell.test.js +57 -16
  28. package/dist/components/sortable-card-shell.test.js.map +1 -1
  29. package/dist/offer/attachments-card.d.ts +7 -1
  30. package/dist/offer/attachments-card.d.ts.map +1 -1
  31. package/dist/offer/attachments-card.js +3 -3
  32. package/dist/offer/attachments-card.js.map +1 -1
  33. package/dist/offer/index.d.ts +1 -1
  34. package/dist/offer/index.d.ts.map +1 -1
  35. package/dist/offer/negotiation-section.d.ts +9 -1
  36. package/dist/offer/negotiation-section.d.ts.map +1 -1
  37. package/dist/offer/negotiation-section.js +2 -2
  38. package/dist/offer/negotiation-section.js.map +1 -1
  39. package/dist/offer/offer-document.d.ts +24 -24
  40. package/dist/offer/offer-document.d.ts.map +1 -1
  41. package/dist/offer/offer-document.js +269 -49
  42. package/dist/offer/offer-document.js.map +1 -1
  43. package/dist/offer/offer-document.stories.d.ts +11 -0
  44. package/dist/offer/offer-document.stories.d.ts.map +1 -1
  45. package/dist/offer/offer-document.stories.js +136 -84
  46. package/dist/offer/offer-document.stories.js.map +1 -1
  47. package/dist/offer/types.d.ts +81 -0
  48. package/dist/offer/types.d.ts.map +1 -1
  49. package/package.json +1 -1
@@ -1,32 +1,43 @@
1
1
  /**
2
- * SortableCardShell — shared whole-card drag wrapper with a grip affordance.
2
+ * SortableCardShell — whole-card drag wrapper.
3
3
  *
4
- * Journey/kanban board cards want three things:
5
- * 1. The whole card is the drag activation surface (not just the grip).
6
- * 2. A visible grip icon on the left hints that the card is draggable.
7
- * 3. Clicks on `<button>`/`<a>`/menus/etc. inside the card must still work —
8
- * they must NOT start a drag.
9
- *
10
- * This shell wraps children in a div whose ref is dnd-kit's activation region.
11
- * The grip icon is purely visual (`pointer-events-none` + `aria-hidden`) and
12
- * is NOT used as the drag handle — it's an affordance hint only.
4
+ * Journey/kanban cards want two things:
5
+ * 1. The whole card is the drag activation surface.
6
+ * 2. Clicks on `<button>`/`<a>`/menus/etc. inside the card must still
7
+ * work — they must NOT start a drag.
13
8
  *
14
9
  * To keep clicks on interactive descendants from activating a drag, we
15
10
  * configure `PointerSensor` per-draggable with a `preventActivation` hook
16
- * that inspects the pointer target with `Element.closest(...)`. Any element
17
- * matching a known interactive selector — or carrying a `data-no-drag`
18
- * attribute — cancels activation before the drag starts.
11
+ * that inspects the pointer target with `Element.closest(...)`. Any
12
+ * element matching a known interactive selector — or carrying a
13
+ * `data-no-drag` attribute — cancels activation before the drag starts.
14
+ *
15
+ * This shell does NOT render a grip affordance. Consumers that want one
16
+ * (e.g. JourneyCard) can read the exported `SortableCardContext` to
17
+ * detect they are inside a drag shell and render their own grip in a
18
+ * layout-appropriate position.
19
19
  *
20
20
  * Requires the optional peer dependencies `@dnd-kit/react` and `@dnd-kit/dom`.
21
21
  * Not exported from the main barrel — import directly from
22
22
  * `@cellarnode/ui/sortable-card-shell`.
23
23
  */
24
24
  import { type ReactNode } from "react";
25
+ import { SortableCardContext, type SortableCardContextValue } from "./sortable-card-context";
26
+ export { SortableCardContext };
27
+ export type { SortableCardContextValue };
25
28
  /**
26
29
  * CSS selector for elements inside a draggable card that should NOT
27
30
  * activate a drag when clicked. Consumers can opt any element out by
28
31
  * adding the `data-no-drag` attribute.
29
32
  *
33
+ * Notable exclusion: `[role='button']` and `[role='link']` are NOT in
34
+ * this list. JourneyCard (and similar card wrappers) set `role='button'`
35
+ * on their root div for keyboard a11y. If we matched those, `closest()`
36
+ * would resolve to the card wrapper itself and drag would never activate.
37
+ * `@dnd-kit/dom`'s own activation constraints (5px distance, 200ms delay)
38
+ * already prevent tap-clicks from starting accidental drags, so dropping
39
+ * these roles is safe.
40
+ *
30
41
  * Exported so consumers can extend or reuse it in custom sensor configs.
31
42
  */
32
43
  export declare const SORTABLE_CARD_NO_DRAG_SELECTOR: string;
@@ -47,14 +58,20 @@ interface SortableCardShellCommonProps {
47
58
  isShaking?: boolean;
48
59
  /** Extra classes for the wrapper element. */
49
60
  className?: string;
50
- /** Override classes for the grip icon container. */
61
+ /**
62
+ * @deprecated The shell no longer renders a grip. Card components
63
+ * render their own grip internally (see `JourneyCard`). Retained as
64
+ * a no-op for backwards compatibility with older consumer code.
65
+ */
51
66
  gripClassName?: string;
52
- /** Hide the grip affordance entirely (rare — whole card is still draggable). */
67
+ /**
68
+ * @deprecated The shell no longer renders a grip. Card components
69
+ * render their own grip internally. No-op.
70
+ */
53
71
  hideGrip?: boolean;
54
72
  /**
55
- * Browser tooltip (`title` attribute) shown on hover for the grip icon.
56
- * Purely visual — NOT an a11y label (the grip is `aria-hidden` +
57
- * `pointer-events-none`). Defaults to "Drag to reorder".
73
+ * @deprecated The shell no longer renders a grip. Card components
74
+ * render their own grip internally. No-op.
58
75
  */
59
76
  gripTitle?: string;
60
77
  children: ReactNode;
@@ -86,13 +103,15 @@ interface SortableCardShellDraggableProps {
86
103
  */
87
104
  export type SortableCardShellProps = SortableCardShellCommonProps & (SortableCardShellSortableProps | SortableCardShellDraggableProps);
88
105
  /**
89
- * Shared whole-card drag wrapper used by producer + importer journey boards.
106
+ * Whole-card drag wrapper used by producer + importer journey boards.
90
107
  *
91
- * Visual states:
108
+ * Visual states applied to the wrapper:
92
109
  * - `isDragSource` / `isDragging`: wrapper dims to `opacity-40`.
93
110
  * - `isDropTarget` (sortable only): 2px primary line above the card.
94
111
  * - `isShaking`: applies `card-shake` class (consumer-defined keyframes).
112
+ *
113
+ * The shell exposes `SortableCardContext` so children can render their
114
+ * own drag affordance (e.g. a grip icon in `JourneyCard`).
95
115
  */
96
116
  export declare function SortableCardShell(props: SortableCardShellProps): import("react/jsx-runtime").JSX.Element;
97
- export {};
98
117
  //# sourceMappingURL=sortable-card-shell.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sortable-card-shell.d.ts","sourceRoot":"","sources":["../../src/components/sortable-card-shell.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAW,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AAQ1D;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B,QAwB9B,CAAC;AAcd,MAAM,MAAM,qBAAqB,GAAG,UAAU,GAAG,WAAW,CAAC;AAE7D;;GAEG;AACH,UAAU,4BAA4B;IACpC,qDAAqD;IACrD,EAAE,EAAE,MAAM,CAAC;IAEX;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE/B,QA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qBAAqB,GAAG,UAAU,GAAG,WAAW,CAAC;AAE7D;;GAEG;AACH,UAAU,4BAA4B;IACpC,qDAAqD;IACrD,EAAE,EAAE,MAAM,CAAC;IAEX;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,oFAAoF;IACpF,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;GAGG;AACH,UAAU,8BAA8B;IACtC,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,UAAU,+BAA+B;IACvC,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,4BAA4B,GAC/D,CAAC,8BAA8B,GAAG,+BAA+B,CAAC,CAAC;AAIrE;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,2CAsD9D"}
@@ -1,22 +1,22 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  /**
3
- * SortableCardShell — shared whole-card drag wrapper with a grip affordance.
3
+ * SortableCardShell — whole-card drag wrapper.
4
4
  *
5
- * Journey/kanban board cards want three things:
6
- * 1. The whole card is the drag activation surface (not just the grip).
7
- * 2. A visible grip icon on the left hints that the card is draggable.
8
- * 3. Clicks on `<button>`/`<a>`/menus/etc. inside the card must still work —
9
- * they must NOT start a drag.
10
- *
11
- * This shell wraps children in a div whose ref is dnd-kit's activation region.
12
- * The grip icon is purely visual (`pointer-events-none` + `aria-hidden`) and
13
- * is NOT used as the drag handle — it's an affordance hint only.
5
+ * Journey/kanban cards want two things:
6
+ * 1. The whole card is the drag activation surface.
7
+ * 2. Clicks on `<button>`/`<a>`/menus/etc. inside the card must still
8
+ * work — they must NOT start a drag.
14
9
  *
15
10
  * To keep clicks on interactive descendants from activating a drag, we
16
11
  * configure `PointerSensor` per-draggable with a `preventActivation` hook
17
- * that inspects the pointer target with `Element.closest(...)`. Any element
18
- * matching a known interactive selector — or carrying a `data-no-drag`
19
- * attribute — cancels activation before the drag starts.
12
+ * that inspects the pointer target with `Element.closest(...)`. Any
13
+ * element matching a known interactive selector — or carrying a
14
+ * `data-no-drag` attribute — cancels activation before the drag starts.
15
+ *
16
+ * This shell does NOT render a grip affordance. Consumers that want one
17
+ * (e.g. JourneyCard) can read the exported `SortableCardContext` to
18
+ * detect they are inside a drag shell and render their own grip in a
19
+ * layout-appropriate position.
20
20
  *
21
21
  * Requires the optional peer dependencies `@dnd-kit/react` and `@dnd-kit/dom`.
22
22
  * Not exported from the main barrel — import directly from
@@ -24,15 +24,28 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
24
  */
25
25
  import { useMemo } from "react";
26
26
  import { PointerSensor } from "@dnd-kit/dom";
27
- import { GripVertical } from "lucide-react";
28
27
  import { cn } from "../lib/utils";
29
28
  import { useDraggableCard, useSortableCard } from "../hooks/use-kanban-dnd";
29
+ import { SortableCardContext, } from "./sortable-card-context";
30
+ // Re-export for backwards compatibility: consumers that imported the
31
+ // context + type from `./sortable-card-shell` should keep working without
32
+ // changes. New code should import directly from `./sortable-card-context`
33
+ // to avoid pulling in `@dnd-kit/dom` at module load.
34
+ export { SortableCardContext };
30
35
  // ─── Interactive-element guard ──────────────────────────────────────────────
31
36
  /**
32
37
  * CSS selector for elements inside a draggable card that should NOT
33
38
  * activate a drag when clicked. Consumers can opt any element out by
34
39
  * adding the `data-no-drag` attribute.
35
40
  *
41
+ * Notable exclusion: `[role='button']` and `[role='link']` are NOT in
42
+ * this list. JourneyCard (and similar card wrappers) set `role='button'`
43
+ * on their root div for keyboard a11y. If we matched those, `closest()`
44
+ * would resolve to the card wrapper itself and drag would never activate.
45
+ * `@dnd-kit/dom`'s own activation constraints (5px distance, 200ms delay)
46
+ * already prevent tap-clicks from starting accidental drags, so dropping
47
+ * these roles is safe.
48
+ *
36
49
  * Exported so consumers can extend or reuse it in custom sensor configs.
37
50
  */
38
51
  export const SORTABLE_CARD_NO_DRAG_SELECTOR = [
@@ -44,8 +57,6 @@ export const SORTABLE_CARD_NO_DRAG_SELECTOR = [
44
57
  "select",
45
58
  "label",
46
59
  "summary",
47
- "[role='button']",
48
- "[role='link']",
49
60
  "[role='menuitem']",
50
61
  "[role='menu']",
51
62
  "[role='menubar']",
@@ -71,15 +82,18 @@ function shouldPreventDragActivation(event) {
71
82
  }
72
83
  // ─── Component ──────────────────────────────────────────────────────────────
73
84
  /**
74
- * Shared whole-card drag wrapper used by producer + importer journey boards.
85
+ * Whole-card drag wrapper used by producer + importer journey boards.
75
86
  *
76
- * Visual states:
87
+ * Visual states applied to the wrapper:
77
88
  * - `isDragSource` / `isDragging`: wrapper dims to `opacity-40`.
78
89
  * - `isDropTarget` (sortable only): 2px primary line above the card.
79
90
  * - `isShaking`: applies `card-shake` class (consumer-defined keyframes).
91
+ *
92
+ * The shell exposes `SortableCardContext` so children can render their
93
+ * own drag affordance (e.g. a grip icon in `JourneyCard`).
80
94
  */
81
95
  export function SortableCardShell(props) {
82
- const { id, data, disabled, isShaking, className, gripClassName, hideGrip, gripTitle = "Drag to reorder", children, } = props;
96
+ const { id, data, disabled, isShaking, className, children } = props;
83
97
  // Per-draggable PointerSensor with an interactive-element guard. Stable
84
98
  // across renders — the sensor constructor doesn't depend on props.
85
99
  const sensors = useMemo(() => [
@@ -87,14 +101,15 @@ export function SortableCardShell(props) {
87
101
  preventActivation: (event) => shouldPreventDragActivation(event),
88
102
  }),
89
103
  ], []);
104
+ const contextValue = useMemo(() => ({ isDraggable: !disabled }), [disabled]);
90
105
  if (props.mode === "draggable") {
91
- return (_jsx(DraggableShell, { id: id, data: data, disabled: disabled, isShaking: isShaking, className: className, gripClassName: gripClassName, hideGrip: hideGrip, gripTitle: gripTitle, sensors: sensors, children: children }));
106
+ return (_jsx(SortableCardContext, { value: contextValue, children: _jsx(DraggableShell, { id: id, data: data, disabled: disabled, isShaking: isShaking, className: className, sensors: sensors, children: children }) }));
92
107
  }
93
- // Sortable mode (default). TS narrows `props` so `index` and `group` are
94
- // guaranteed to be `number` + `string` — no casts needed.
95
- return (_jsx(SortableShell, { id: id, index: props.index, group: props.group, data: data, disabled: disabled, isShaking: isShaking, className: className, gripClassName: gripClassName, hideGrip: hideGrip, gripTitle: gripTitle, sensors: sensors, children: children }));
108
+ // Sortable mode (default). TS narrows `props` so `index` and `group`
109
+ // are guaranteed to be `number` + `string` — no casts needed.
110
+ return (_jsx(SortableCardContext, { value: contextValue, children: _jsx(SortableShell, { id: id, index: props.index, group: props.group, data: data, disabled: disabled, isShaking: isShaking, className: className, sensors: sensors, children: children }) }));
96
111
  }
97
- function SortableShell({ id, index, group, data, disabled, isShaking, className, gripClassName, hideGrip, gripTitle, sensors, children, }) {
112
+ function SortableShell({ id, index, group, data, disabled, isShaking, className, sensors, children, }) {
98
113
  const { ref, isDragSource, isDropTarget } = useSortableCard({
99
114
  id,
100
115
  index,
@@ -103,32 +118,24 @@ function SortableShell({ id, index, group, data, disabled, isShaking, className,
103
118
  disabled,
104
119
  sensors,
105
120
  });
106
- return (_jsx(Wrapper, { innerRef: ref, isDragSource: isDragSource, isDropTarget: isDropTarget, showDropTargetLine: true, isShaking: isShaking, className: className, gripClassName: gripClassName, hideGrip: hideGrip, gripTitle: gripTitle, children: children }));
121
+ return (_jsx(Wrapper, { innerRef: ref, isDragSource: isDragSource, isDropTarget: isDropTarget, showDropTargetLine: true, isShaking: isShaking, className: className, children: children }));
107
122
  }
108
- function DraggableShell({ id, data, disabled, isShaking, className, gripClassName, hideGrip, gripTitle, sensors, children, }) {
123
+ function DraggableShell({ id, data, disabled, isShaking, className, sensors, children, }) {
109
124
  const { ref, isDragging } = useDraggableCard({
110
125
  id,
111
126
  data,
112
127
  disabled,
113
128
  sensors,
114
129
  });
115
- return (_jsx(Wrapper, { innerRef: ref, isDragSource: isDragging, isDropTarget: false, showDropTargetLine: false, isShaking: isShaking, className: className, gripClassName: gripClassName, hideGrip: hideGrip, gripTitle: gripTitle, children: children }));
130
+ return (_jsx(Wrapper, { innerRef: ref, isDragSource: isDragging, isDropTarget: false, showDropTargetLine: false, isShaking: isShaking, className: className, children: children }));
116
131
  }
117
- function Wrapper({ innerRef, isDragSource, isDropTarget, showDropTargetLine, isShaking, className, gripClassName, hideGrip, gripTitle, children, }) {
118
- return (_jsxs("div", { ref: innerRef,
119
- // No ARIA role — let the consumer's card content own semantics.
120
- className: cn("relative group flex cursor-grab select-none items-stretch gap-1 transition-all hover:z-10 has-[[data-open]]:z-50 active:cursor-grabbing",
132
+ function Wrapper({ innerRef, isDragSource, isDropTarget, showDropTargetLine, isShaking, className, children, }) {
133
+ return (_jsx("div", { ref: innerRef, className: cn("relative cursor-grab select-none transition-all hover:z-10 has-[[data-open]]:z-50 active:cursor-grabbing",
121
134
  // Unified drag-source dim (producer used 30, importer 50, standardizing on 40)
122
135
  isDragSource && "opacity-40",
123
136
  // Drop-target insertion line (sortable only)
124
137
  showDropTargetLine &&
125
138
  isDropTarget &&
126
- "before:absolute before:-top-1 before:left-0 before:right-0 before:h-0.5 before:rounded-full before:bg-primary", isShaking && "card-shake", className), "data-drag-source": isDragSource ? "true" : undefined, "data-drop-target": isDropTarget ? "true" : undefined, children: [!hideGrip ? (_jsx("span", { "aria-hidden": "true", title: gripTitle, className: cn(
127
- // Pointer-events off — grip is purely visual. The wrapper is the
128
- // drag activation surface.
129
- "pointer-events-none flex shrink-0 items-center justify-center p-1 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-60",
130
- // While dragging, keep the grip visible (parent wrapper already
131
- // dims to 40%, so this gives a ~40% grip which reads correctly).
132
- isDragSource && "opacity-100", gripClassName), children: _jsx(GripVertical, { className: "size-3.5" }) })) : null, _jsx("div", { className: "min-w-0 flex-1", children: children })] }));
139
+ "before:absolute before:-top-1 before:left-0 before:right-0 before:h-0.5 before:rounded-full before:bg-primary", isShaking && "card-shake", className), "data-drag-source": isDragSource ? "true" : undefined, "data-drop-target": isDropTarget ? "true" : undefined, children: children }));
133
140
  }
134
141
  //# sourceMappingURL=sortable-card-shell.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sortable-card-shell.js","sourceRoot":"","sources":["../../src/components/sortable-card-shell.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,OAAO,EAA4B,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE5E,+EAA+E;AAE/E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,8BAA8B,GACzC;IACE,gBAAgB;IAChB,QAAQ;IACR,GAAG;IACH,OAAO;IACP,UAAU;IACV,QAAQ;IACR,OAAO;IACP,SAAS;IACT,iBAAiB;IACjB,eAAe;IACf,mBAAmB;IACnB,eAAe;IACf,kBAAkB;IAClB,cAAc;IACd,iBAAiB;IACjB,mBAAmB;IACnB,gBAAgB;IAChB,mBAAmB;IACnB,iBAAiB;IACj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,YAAY,EAAE,UAAU,EACxB,YAAY,EAAE,KAAK,EACnB,kBAAkB,EAAE,KAAK,EACzB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,YAEnB,QAAQ,GACD,CACX,CAAC;AACJ,CAAC;AAiBD,SAAS,OAAO,CAAC,EACf,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,SAAS,EACT,SAAS,EACT,aAAa,EACb,QAAQ,EACR,SAAS,EACT,QAAQ,GACK;IACb,OAAO,CACL,eACE,GAAG,EAAE,QAA+B;QACpC,gEAAgE;QAChE,SAAS,EAAE,EAAE,CACX,yIAAyI;QACzI,+EAA+E;QAC/E,YAAY,IAAI,YAAY;QAC5B,6CAA6C;QAC7C,kBAAkB;YAChB,YAAY;YACZ,+GAA+G,EACjH,SAAS,IAAI,YAAY,EACzB,SAAS,CACV,sBACiB,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,sBACjC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,aAElD,CAAC,QAAQ,CAAC,CAAC,CAAC,CACX,8BACc,MAAM,EAClB,KAAK,EAAE,SAAS,EAChB,SAAS,EAAE,EAAE;gBACX,iEAAiE;gBACjE,2BAA2B;gBAC3B,6IAA6I;gBAC7I,gEAAgE;gBAChE,iEAAiE;gBACjE,YAAY,IAAI,aAAa,EAC7B,aAAa,CACd,YAED,KAAC,YAAY,IAAC,SAAS,EAAC,UAAU,GAAG,GAChC,CACR,CAAC,CAAC,CAAC,IAAI,EACR,cAAK,SAAS,EAAC,gBAAgB,YAAE,QAAQ,GAAO,IAC5C,CACP,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"sortable-card-shell.js","sourceRoot":"","sources":["../../src/components/sortable-card-shell.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;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,CAAC"}
@@ -6,8 +6,8 @@ type Story = StoryObj<SortableCardShellProps>;
6
6
  export declare const Default: Story;
7
7
  export declare const Draggable: Story;
8
8
  export declare const Shaking: Story;
9
- export declare const HideGrip: Story;
10
9
  export declare const DraggingVisual: Story;
11
10
  export declare const DropTargetVisual: Story;
12
11
  export declare const WithInteractiveButtons: Story;
12
+ export declare const WithRoleButtonWrapper: Story;
13
13
  //# sourceMappingURL=sortable-card-shell.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sortable-card-shell.stories.d.ts","sourceRoot":"","sources":["../../src/components/sortable-card-shell.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAqB,KAAK,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAEvF,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,sBAAsB,CA0BtC,CAAC;AAEF,eAAe,IAAI,CAAC;AAIpB,KAAK,KAAK,GAAG,QAAQ,CAAC,sBAAsB,CAAC,CAAC;AAe9C,eAAO,MAAM,OAAO,EAAE,KASrB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAOvB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAUrB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAUtB,CAAC;AAOF,eAAO,MAAM,cAAc,EAAE,KAgC5B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KA+B9B,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,KAqDpC,CAAC"}
1
+ {"version":3,"file":"sortable-card-shell.stories.d.ts","sourceRoot":"","sources":["../../src/components/sortable-card-shell.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAqB,KAAK,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAEvF,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,sBAAsB,CAiCtC,CAAC;AAEF,eAAe,IAAI,CAAC;AAIpB,KAAK,KAAK,GAAG,QAAQ,CAAC,sBAAsB,CAAC,CAAC;AAe9C,eAAO,MAAM,OAAO,EAAE,KASrB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAOvB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAUrB,CAAC;AAOF,eAAO,MAAM,cAAc,EAAE,KAO5B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAO9B,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,KAqDpC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,KAkCnC,CAAC"}
@@ -5,7 +5,14 @@ const meta = {
5
5
  title: "Components/SortableCardShell",
6
6
  component: SortableCardShell,
7
7
  tags: ["autodocs"],
8
- parameters: { layout: "centered" },
8
+ parameters: {
9
+ layout: "centered",
10
+ docs: {
11
+ description: {
12
+ component: "Whole-card drag wrapper. The shell no longer renders a grip affordance — cards (e.g. `JourneyCard`) render their own grip internally via the exported `SortableCardContext`. The shell is responsible for drag sensor wiring, the interactive-element guard (click-through), and drag-source / drop-target visual states.",
13
+ },
14
+ },
15
+ },
9
16
  argTypes: {
10
17
  mode: {
11
18
  control: { type: "inline-radio" },
@@ -16,7 +23,6 @@ const meta = {
16
23
  group: { control: { type: "text" } },
17
24
  disabled: { control: { type: "boolean" } },
18
25
  isShaking: { control: { type: "boolean" } },
19
- hideGrip: { control: { type: "boolean" } },
20
26
  },
21
27
  decorators: [
22
28
  (Story) => (_jsx(DragDropProvider, { children: _jsx("div", { style: { width: 320 }, children: _jsx(Story, {}) }) })),
@@ -55,28 +61,17 @@ export const Shaking = {
55
61
  children: _jsx(SampleCardBody, {}),
56
62
  },
57
63
  };
58
- export const HideGrip = {
59
- args: {
60
- id: "card-4",
61
- index: 0,
62
- group: "drafting",
63
- data: { itemId: "card-4", columnId: "drafting" },
64
- mode: "sortable",
65
- hideGrip: true,
66
- children: _jsx(SampleCardBody, {}),
67
- },
68
- };
69
64
  // Visual mock — these states are normally driven by live drag events, so
70
65
  // for Storybook we demo them via the inline layout classes directly on a
71
66
  // static wrapper. They match what `SortableCardShell` renders under
72
67
  // `isDragSource` and `isDropTarget`.
73
68
  export const DraggingVisual = {
74
69
  name: "Visual: Dragging source",
75
- render: () => (_jsxs("div", { className: "relative group flex cursor-grab items-stretch gap-1 opacity-40", children: [_jsx("span", { "aria-hidden": "true", className: "pointer-events-none flex shrink-0 items-center justify-center p-1 text-muted-foreground opacity-100", children: _jsxs("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [_jsx("circle", { cx: "9", cy: "12", r: "1" }), _jsx("circle", { cx: "9", cy: "5", r: "1" }), _jsx("circle", { cx: "9", cy: "19", r: "1" }), _jsx("circle", { cx: "15", cy: "12", r: "1" }), _jsx("circle", { cx: "15", cy: "5", r: "1" }), _jsx("circle", { cx: "15", cy: "19", r: "1" })] }) }), _jsx("div", { className: "min-w-0 flex-1", children: _jsx(SampleCardBody, {}) })] })),
70
+ render: () => (_jsx("div", { className: "relative cursor-grab opacity-40", children: _jsx(SampleCardBody, {}) })),
76
71
  };
77
72
  export const DropTargetVisual = {
78
73
  name: "Visual: Drop target insertion line",
79
- render: () => (_jsxs("div", { className: "relative group flex cursor-grab items-stretch gap-1 before:absolute before:-top-1 before:left-0 before:right-0 before:h-0.5 before:rounded-full before:bg-primary", children: [_jsx("span", { "aria-hidden": "true", className: "pointer-events-none flex shrink-0 items-center justify-center p-1 text-muted-foreground opacity-60", children: _jsxs("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [_jsx("circle", { cx: "9", cy: "12", r: "1" }), _jsx("circle", { cx: "9", cy: "5", r: "1" }), _jsx("circle", { cx: "9", cy: "19", r: "1" }), _jsx("circle", { cx: "15", cy: "12", r: "1" }), _jsx("circle", { cx: "15", cy: "5", r: "1" }), _jsx("circle", { cx: "15", cy: "19", r: "1" })] }) }), _jsx("div", { className: "min-w-0 flex-1", children: _jsx(SampleCardBody, {}) })] })),
74
+ render: () => (_jsx("div", { className: "relative cursor-grab before:absolute before:-top-1 before:left-0 before:right-0 before:h-0.5 before:rounded-full before:bg-primary", children: _jsx(SampleCardBody, {}) })),
80
75
  };
81
76
  export const WithInteractiveButtons = {
82
77
  args: {
@@ -91,4 +86,22 @@ export const WithInteractiveButtons = {
91
86
  }, className: "rounded border border-border px-2 py-1 text-xs", children: "View" }), _jsx("span", { "data-no-drag": true, onClick: () => alert("data-no-drag element clicked"), className: "cursor-default rounded border border-dashed border-border px-2 py-1 text-xs", children: "data-no-drag" })] })] })),
92
87
  },
93
88
  };
89
+ export const WithRoleButtonWrapper = {
90
+ name: "Regression: role='button' wrapper must drag",
91
+ args: {
92
+ id: "card-role-btn",
93
+ index: 0,
94
+ group: "drafting",
95
+ data: { itemId: "card-role-btn", columnId: "drafting" },
96
+ mode: "sortable",
97
+ children: (_jsxs("div", { role: "button", tabIndex: 0, onClick: () => alert("card clicked"), className: "rounded-lg border border-border bg-background p-3 shadow-xs", children: [_jsx("p", { className: "text-sm/5 font-medium text-foreground", children: "Clickable card (role=button)" }), _jsxs("p", { className: "mt-1 text-xs text-muted-foreground", children: ["This card's root div has role=\"button\". The whole card should still be draggable \u2014 if it isn't, the no-drag selector regressed by reintroducing ", _jsx("code", { children: "[role='button']" }), "."] })] })),
98
+ },
99
+ parameters: {
100
+ docs: {
101
+ description: {
102
+ story: "JourneyCard sets `role='button'` on its root when `onClick` is provided. The interactive-element guard MUST exclude `[role='button']` (and `[role='link']`) or drag activation is blocked by the card wrapper itself.",
103
+ },
104
+ },
105
+ },
106
+ };
94
107
  //# sourceMappingURL=sortable-card-shell.stories.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sortable-card-shell.stories.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D,uBAG7D,IACL,EACN,YAAG,SAAS,EAAC,oCAAoC,0FAE7C,EACJ,eAAK,SAAS,EAAC,iBAAiB,aAC9B,iBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,EACpC,SAAS,EAAC,gDAAgD,qBAGnD,EACT,YACE,IAAI,EAAC,GAAG,EACR,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;gCACb,CAAC,CAAC,cAAc,EAAE,CAAC;gCACnB,KAAK,CAAC,cAAc,CAAC,CAAC;4BACxB,CAAC,EACD,SAAS,EAAC,gDAAgD,qBAGxD,EACJ,qCAEE,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,8BAA8B,CAAC,EACpD,SAAS,EAAC,6EAA6E,6BAGlF,IACH,IACF,CACP;KACF;CACF,CAAC"}
1
+ {"version":3,"file":"sortable-card-shell.stories.js","sourceRoot":"","sources":["../../src/components/sortable-card-shell.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAA+B,MAAM,uBAAuB,CAAC;AAEvF,MAAM,IAAI,GAAiC;IACzC,KAAK,EAAE,8BAA8B;IACrC,SAAS,EAAE,iBAAiB;IAC5B,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,UAAU,EAAE;QACV,MAAM,EAAE,UAAU;QAClB,IAAI,EAAE;YACJ,WAAW,EAAE;gBACX,SAAS,EACP,2TAA2T;aAC9T;SACF;KACF;IACD,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,OAAO,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE;YACjC,OAAO,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC;SACnC;QACD,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;QACjC,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAA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AE,GAAG,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,EACpC,SAAS,EAAC,gDAAgD,qBAGnD,EACT,YACE,IAAI,EAAC,GAAG,EACR,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;gCACb,CAAC,CAAC,cAAc,EAAE,CAAC;gCACnB,KAAK,CAAC,cAAc,CAAC,CAAC;4BACxB,CAAC,EACD,SAAS,EAAC,gDAAgD,qBAGxD,EACJ,qCAEE,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,8BAA8B,CAAC,EACpD,SAAS,EAAC,6EAA6E,6BAGlF,IACH,IACF,CACP;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAU;IAC1C,IAAI,EAAE,6CAA6C;IACnD,IAAI,EAAE;QACJ,EAAE,EAAE,eAAe;QACnB,KAAK,EAAE,CAAC;QACR,KAAK,EAAE,UAAU;QACjB,IAAI,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,UAAU,EAAE;QACvD,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE,CACR,eACE,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,CAAC,EACX,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,EACpC,SAAS,EAAC,6DAA6D,aAEvE,YAAG,SAAS,EAAC,uCAAuC,6CAEhD,EACJ,aAAG,SAAS,EAAC,oCAAoC,wKAGjC,6CAA4B,SACxC,IACA,CACP;KACF;IACD,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,WAAW,EAAE;gBACX,KAAK,EACH,uNAAuN;aAC1N;SACF;KACF;CACF,CAAC"}
@@ -1,6 +1,7 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { describe, it, expect, beforeAll } from "vitest";
3
3
  import { render, screen } from "@testing-library/react";
4
+ import * as React from "react";
4
5
  // @dnd-kit/dom touches `ResizeObserver` at module load time; jsdom does not
5
6
  // provide one. Install a no-op polyfill BEFORE importing @dnd-kit/react or
6
7
  // the shell (which transitively imports @dnd-kit/dom).
@@ -15,7 +16,7 @@ if (typeof globalThis.ResizeObserver === "undefined") {
15
16
  }
16
17
  // Imports deferred to after the polyfill so module-level access succeeds.
17
18
  const { DragDropProvider } = await import("@dnd-kit/react");
18
- const { SortableCardShell, SORTABLE_CARD_NO_DRAG_SELECTOR } = await import("./sortable-card-shell");
19
+ const { SortableCardShell, SortableCardContext, SORTABLE_CARD_NO_DRAG_SELECTOR } = await import("./sortable-card-shell");
19
20
  beforeAll(() => {
20
21
  // Sanity check — confirm the polyfill stuck.
21
22
  expect(typeof globalThis.ResizeObserver).toBe("function");
@@ -39,6 +40,16 @@ beforeAll(() => {
39
40
  function renderWithProvider(ui) {
40
41
  return render(_jsx(DragDropProvider, { children: ui }));
41
42
  }
43
+ /**
44
+ * Test helper: reads `SortableCardContext` and renders "yes"/"no" based on
45
+ * `isDraggable`. Kept at module level so eslint's
46
+ * `@eslint-react/component-hook-factories` stays happy (components must not
47
+ * be defined inside other functions).
48
+ */
49
+ function ContextProbe() {
50
+ const ctx = React.use(SortableCardContext);
51
+ return _jsx("span", { "data-testid": "probe", children: ctx.isDraggable ? "yes" : "no" });
52
+ }
42
53
  describe("SortableCardShell", () => {
43
54
  it("renders children (smoke test, sortable mode)", () => {
44
55
  renderWithProvider(_jsx(SortableCardShell, { id: "card-1", index: 0, group: "col-a", children: _jsx("div", { "data-testid": "card-body", children: "Ch\u00E2teau Margaux" }) }));
@@ -49,21 +60,24 @@ describe("SortableCardShell", () => {
49
60
  renderWithProvider(_jsx(SortableCardShell, { id: "card-2", mode: "draggable", children: _jsx("div", { "data-testid": "card-body", children: "P\u00E9trus 2015" }) }));
50
61
  expect(screen.getByTestId("card-body")).toBeInTheDocument();
51
62
  });
52
- it("renders a grip affordance that is aria-hidden and pointer-events-none", () => {
53
- const { container } = renderWithProvider(_jsx(SortableCardShell, { id: "card-grip", index: 0, group: "col-a", children: _jsx("div", { children: "body" }) }));
54
- // The grip is an aria-hidden <span> sibling of the card body. Query it
55
- // by attribute — this is the most robust selector since the grip has no
56
- // accessible name by design.
57
- const grip = container.querySelector('[aria-hidden="true"]');
58
- expect(grip).not.toBeNull();
59
- // Pointer events must be disabled so the whole card remains the drag
60
- // activation surface — the grip is purely visual.
61
- expect(grip?.className).toContain("pointer-events-none");
62
- // lucide-react renders an inline SVG inside the grip.
63
- expect(grip?.querySelector("svg")).not.toBeNull();
63
+ it("provides SortableCardContext with isDraggable=true to children", () => {
64
+ // Children read this context to decide whether to render their own grip
65
+ // affordance (e.g. JourneyCard's top-left corner dot-grid).
66
+ renderWithProvider(_jsx(SortableCardShell, { id: "card-ctx", index: 0, group: "col-a", children: _jsx(ContextProbe, {}) }));
67
+ expect(screen.getByTestId("probe").textContent).toBe("yes");
68
+ });
69
+ it("provides isDraggable=false when disabled", () => {
70
+ renderWithProvider(_jsx(SortableCardShell, { id: "card-disabled", index: 0, group: "col-a", disabled: true, children: _jsx(ContextProbe, {}) }));
71
+ expect(screen.getByTestId("probe").textContent).toBe("no");
64
72
  });
65
- it("omits the grip when hideGrip is true", () => {
66
- const { container } = renderWithProvider(_jsx(SortableCardShell, { id: "card-no-grip", index: 0, group: "col-a", hideGrip: true, children: _jsx("div", { children: "body" }) }));
73
+ it("does not render a grip inside the shell itself", () => {
74
+ // The shell used to render an outer grip <span>. It no longer does —
75
+ // cards (e.g. JourneyCard) render their own grip internally. This test
76
+ // locks that contract so a future regression that reintroduces an outer
77
+ // grip (and the horizontal-space waste that came with it) is flagged.
78
+ const { container } = renderWithProvider(_jsx(SortableCardShell, { id: "card-no-outer-grip", index: 0, group: "col-a", children: _jsx("div", { "data-testid": "body", children: "body" }) }));
79
+ // The only aria-hidden element should be absent — the shell doesn't own
80
+ // any purely-visual affordance now.
67
81
  expect(container.querySelector('[aria-hidden="true"]')).toBeNull();
68
82
  });
69
83
  // ─── Interactive-element guard ────────────────────────────────────────────
@@ -111,5 +125,32 @@ describe("SortableCardShell", () => {
111
125
  expect(SORTABLE_CARD_NO_DRAG_SELECTOR).toContain("input");
112
126
  expect(SORTABLE_CARD_NO_DRAG_SELECTOR).toContain("[role='menuitem']");
113
127
  });
128
+ it("interactive guard: a role='button' wrapper does NOT block drag activation (regression)", () => {
129
+ // Critical regression: JourneyCard sets role='button' on its root div
130
+ // whenever onClick is provided (for keyboard a11y). If the no-drag
131
+ // selector matched [role='button'], closest() would walk up and match
132
+ // the card wrapper itself — so every pointerdown on a card would
133
+ // cancel drag activation and drag would be silently broken.
134
+ //
135
+ // The selector MUST NOT include [role='button'] (or [role='link']).
136
+ // dnd-kit's activation constraints (5px distance, 200ms delay) already
137
+ // prevent tap-clicks from starting an accidental drag, so dropping
138
+ // these roles from the no-drag list is safe.
139
+ renderWithProvider(_jsx(SortableCardShell, { id: "card-role-btn", index: 0, group: "col-a", children: _jsxs("div", { role: "button", tabIndex: 0, "data-testid": "card-root", onClick: () => { }, children: [_jsx("span", { "data-testid": "title", children: "Product name" }), _jsx("button", { type: "button", "data-testid": "inner-btn", children: "Kebab" })] }) }));
140
+ const title = screen.getByTestId("title");
141
+ const cardRoot = screen.getByTestId("card-root");
142
+ const innerBtn = screen.getByTestId("inner-btn");
143
+ // A click on the title (non-interactive area) should NOT match — drag
144
+ // proceeds as expected. This is the primary regression check.
145
+ expect(title.closest(SORTABLE_CARD_NO_DRAG_SELECTOR)).toBeNull();
146
+ // The card root itself carries role='button' but must ALSO not match.
147
+ expect(cardRoot.closest(SORTABLE_CARD_NO_DRAG_SELECTOR)).toBeNull();
148
+ // Real <button> descendants are still protected by the plain `button`
149
+ // selector — click-through works for kebab menus.
150
+ expect(innerBtn.closest(SORTABLE_CARD_NO_DRAG_SELECTOR)).toBe(innerBtn);
151
+ // Sanity: the selector does NOT contain role='button'/'link'.
152
+ expect(SORTABLE_CARD_NO_DRAG_SELECTOR).not.toContain("[role='button']");
153
+ expect(SORTABLE_CARD_NO_DRAG_SELECTOR).not.toContain("[role='link']");
154
+ });
114
155
  });
115
156
  //# sourceMappingURL=sortable-card-shell.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sortable-card-shell.test.js","sourceRoot":"","sources":["../../src/components/sortable-card-shell.test.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAGxD,4EAA4E;AAC5E,2EAA2E;AAC3E,uDAAuD;AACvD,IAAI,OAAO,UAAU,CAAC,cAAc,KAAK,WAAW,EAAE,CAAC;IACrD,MAAM,sBAAsB;QAC1B,OAAO,KAAI,CAAC;QACZ,SAAS,KAAI,CAAC;QACd,UAAU,KAAI,CAAC;KAChB;IACA,UAA2E,CAAC,cAAc;QACzF,sBAAsB,CAAC;AAC3B,CAAC;AAED,0EAA0E;AAC1E,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAC5D,MAAM,EAAE,iBAAiB,EAAE,8BAA8B,EAAE,GAAG,MAAM,MAAM,CACxE,uBAAuB,CACxB,CAAC;AAEF,SAAS,CAAC,GAAG,EAAE;IACb,6CAA6C;IAC7C,MAAM,CAAC,OAAO,UAAU,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AAC5D,CAAC,CAAC,CAAC;AAEH,+EAA+E;AAC/E,EAAE;AACF,+EAA+E;AAC/E,8EAA8E;AAC9E,wEAAwE;AACxE,yEAAyE;AACzE,mBAAmB;AACnB,uEAAuE;AACvE,sEAAsE;AACtE,0EAA0E;AAC1E,2EAA2E;AAC3E,+DAA+D;AAC/D,EAAE;AACF,yEAAyE;AACzE,yEAAyE;AACzE,kDAAkD;AAElD,SAAS,kBAAkB,CAAC,EAAa;IACvC,OAAO,MAAM,CAAC,KAAC,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,SAAS,CAAC,iBAAiB,CAAC,CAAC;QACxE,MAAM,CAAC,8BAA8B,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -3,7 +3,13 @@ export interface AttachmentsCardProps {
3
3
  attachments: OfferAttachmentItem[];
4
4
  onOpen: (attachment: OfferAttachmentItem) => void;
5
5
  onDelete?: (attachment: OfferAttachmentItem) => void;
6
+ /**
7
+ * Show an upload CTA alongside the heading. The handler is purely a
8
+ * trigger — the consumer owns the file picker + the actual upload flow
9
+ * (commonly a `click()` on a hidden `<input type="file">`).
10
+ */
11
+ onUpload?: () => void;
6
12
  className?: string;
7
13
  }
8
- export declare function AttachmentsCard({ attachments, onOpen, onDelete, className, }: AttachmentsCardProps): import("react/jsx-runtime").JSX.Element;
14
+ export declare function AttachmentsCard({ attachments, onOpen, onDelete, onUpload, className, }: AttachmentsCardProps): import("react/jsx-runtime").JSX.Element;
9
15
  //# sourceMappingURL=attachments-card.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"attachments-card.d.ts","sourceRoot":"","sources":["../../src/offer/attachments-card.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,mBAAmB,EAAE,CAAC;IACnC,MAAM,EAAE,CAAC,UAAU,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAClD,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAQD,wBAAgB,eAAe,CAAC,EAC9B,WAAW,EACX,MAAM,EACN,QAAQ,EACR,SAAS,GACV,EAAE,oBAAoB,2CAmDtB"}
1
+ {"version":3,"file":"attachments-card.d.ts","sourceRoot":"","sources":["../../src/offer/attachments-card.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,mBAAmB,EAAE,CAAC;IACnC,MAAM,EAAE,CAAC,UAAU,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAClD,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACrD;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAQD,wBAAgB,eAAe,CAAC,EAC9B,WAAW,EACX,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,SAAS,GACV,EAAE,oBAAoB,2CAkEtB"}
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { FileText, Trash2 } from "lucide-react";
2
+ import { FileText, Trash2, Upload } from "lucide-react";
3
3
  import { cn } from "../lib/utils";
4
4
  import { ShadcnBadge as Badge } from "../components/shadcn-badge";
5
5
  import { ShadcnButton as Button } from "../components/shadcn-button";
@@ -10,7 +10,7 @@ function formatBytes(n) {
10
10
  return `${(n / 1024).toFixed(1)} KB`;
11
11
  return `${(n / 1024 / 1024).toFixed(1)} MB`;
12
12
  }
13
- export function AttachmentsCard({ attachments, onOpen, onDelete, className, }) {
14
- return (_jsxs("section", { "aria-labelledby": "attachments-heading", className: cn("rounded-2xl border border-border/60 bg-card p-4", className), children: [_jsx("h2", { id: "attachments-heading", className: "text-xs/5 font-semibold uppercase tracking-wide text-muted-foreground", children: "Attachments" }), attachments.length === 0 ? (_jsx("p", { className: "mt-3 text-sm/6 text-muted-foreground", children: "No attachments yet." })) : (_jsx("ul", { className: "mt-3 grid grid-cols-1 gap-2 sm:grid-cols-2", children: attachments.map((a) => (_jsxs("li", { className: "flex items-start gap-3 rounded-lg border border-border/60 p-3", children: [_jsx(FileText, { "aria-hidden": true, className: "size-5 shrink-0 text-muted-foreground" }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("button", { type: "button", onClick: () => onOpen(a), className: "block truncate text-left text-sm/6 font-medium hover:underline", "aria-label": `Open ${a.fileName}`, children: a.fileName }), _jsxs("div", { className: "mt-1 flex flex-wrap items-center gap-2 text-xs text-muted-foreground", children: [_jsx("span", { children: formatBytes(a.sizeBytes) }), _jsx(Badge, { variant: "ghost", className: "text-[10px]", children: a.sourceLabel ?? a.source })] })] }), onDelete && (_jsx(Button, { variant: "ghost", size: "icon", "aria-label": `Remove ${a.fileName}`, onClick: () => onDelete(a), children: _jsx(Trash2, { "aria-hidden": true, className: "size-4" }) }))] }, a.id))) }))] }));
13
+ export function AttachmentsCard({ attachments, onOpen, onDelete, onUpload, className, }) {
14
+ return (_jsxs("section", { "aria-labelledby": "attachments-heading", className: cn("rounded-2xl border border-border/60 bg-card p-4", className), children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("h2", { id: "attachments-heading", className: "text-xs/5 font-semibold uppercase tracking-wide text-muted-foreground", children: "Attachments" }), onUpload && (_jsxs(Button, { type: "button", size: "sm", variant: "ghost", onClick: onUpload, "aria-label": "Upload attachment", className: "-my-1 h-7 px-2", children: [_jsx(Upload, { "aria-hidden": true, className: "mr-1 size-3.5" }), "Upload"] }))] }), attachments.length === 0 ? (_jsx("p", { className: "mt-3 text-sm/6 text-muted-foreground", children: "No attachments yet." })) : (_jsx("ul", { className: "mt-3 grid grid-cols-1 gap-2 sm:grid-cols-2", children: attachments.map((a) => (_jsxs("li", { className: "flex items-start gap-3 rounded-lg border border-border/60 p-3", children: [_jsx(FileText, { "aria-hidden": true, className: "size-5 shrink-0 text-muted-foreground" }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("button", { type: "button", onClick: () => onOpen(a), className: "block truncate text-left text-sm/6 font-medium hover:underline", "aria-label": `Open ${a.fileName}`, children: a.fileName }), _jsxs("div", { className: "mt-1 flex flex-wrap items-center gap-2 text-xs text-muted-foreground", children: [_jsx("span", { children: formatBytes(a.sizeBytes) }), _jsx(Badge, { variant: "ghost", className: "text-[10px]", children: a.sourceLabel ?? a.source })] })] }), onDelete && (_jsx(Button, { variant: "ghost", size: "icon", "aria-label": `Remove ${a.fileName}`, onClick: () => onDelete(a), children: _jsx(Trash2, { "aria-hidden": true, className: "size-4" }) }))] }, a.id))) }))] }));
15
15
  }
16
16
  //# sourceMappingURL=attachments-card.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"attachments-card.js","sourceRoot":"","sources":["../../src/offer/attachments-card.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,WAAW,IAAI,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,YAAY,IAAI,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAUrE,SAAS,WAAW,CAAC,CAAS;IAC5B,IAAI,CAAC,GAAG,IAAI;QAAE,OAAO,GAAG,CAAC,IAAI,CAAC;IAC9B,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI;QAAE,OAAO,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;IAC1D,OAAO,GAAG,CAAC,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,EAC9B,WAAW,EACX,MAAM,EACN,QAAQ,EACR,SAAS,GACY;IACrB,OAAO,CACL,sCACkB,qBAAqB,EACrC,SAAS,EAAE,EAAE,CAAC,iDAAiD,EAAE,SAAS,CAAC,aAE3E,aAAI,EAAE,EAAC,qBAAqB,EAAC,SAAS,EAAC,uEAAuE,4BAEzG,EACJ,WAAW,CAAC,MAAM,KAAK,CAAC,CAAC,C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