@botiverse/raft-ui 0.80.0 → 0.82.0

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 (34) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/dist/components/choice-list/choice-list.d.mts +8 -0
  3. package/dist/components/choice-list/choice-list.mjs +37 -16
  4. package/dist/components/choice-list/choice-list.recipe.mjs +17 -3
  5. package/dist/components/composer/composer-drop-overlay.d.mts +9 -4
  6. package/dist/components/composer/composer-drop-overlay.mjs +2 -5
  7. package/dist/components/composer/sortable-composer-attachments.mjs +2 -3
  8. package/dist/components/drag/drag-lift.d.mts +10 -6
  9. package/dist/components/drag/drag-lift.mjs +11 -9
  10. package/dist/components/list-row/index.d.mts +2 -2
  11. package/dist/components/list-row/list-row.d.mts +9 -0
  12. package/dist/components/list-row/list-row.mjs +20 -1
  13. package/dist/components/list-row/list-row.recipe.d.mts +3 -0
  14. package/dist/components/list-row/list-row.recipe.mjs +1 -0
  15. package/dist/components/message-action-card/index.d.mts +2 -2
  16. package/dist/components/message-action-card/message-action-card.d.mts +8 -0
  17. package/dist/components/message-action-card/message-action-card.mjs +16 -1
  18. package/dist/components/message-action-card/message-action-card.recipe.mjs +5 -0
  19. package/dist/components/resizable/resizable.recipe.mjs +4 -4
  20. package/dist/components/scroll-area/scroll-area.css +15 -2
  21. package/dist/components/scroll-area/use-scrollbars.mjs +2 -1
  22. package/dist/components/steps/otter-animation-visibility.mjs +45 -0
  23. package/dist/components/steps/otter-indicator.css +131 -106
  24. package/dist/components/steps/otter-indicator.d.mts +5 -8
  25. package/dist/components/steps/otter-indicator.mjs +38 -314
  26. package/dist/components/steps/ottie-assets/error.webp +0 -0
  27. package/dist/components/steps/ottie-assets/finish.webp +0 -0
  28. package/dist/components/steps/ottie-assets/process.webp +0 -0
  29. package/dist/components/steps/ottie-assets/wait.webp +0 -0
  30. package/dist/components/tabs/tabs.mjs +2 -3
  31. package/dist/components/task-dnd/task-dnd.d.mts +5 -1
  32. package/dist/index.d.mts +3 -3
  33. package/dist/index.mjs +3 -3
  34. package/package.json +1 -1
@@ -1,330 +1,54 @@
1
1
  import { cn } from "../../cn.mjs";
2
- import { useId } from "react";
2
+ import { useMergedRef } from "../../lib/use-merged-ref.mjs";
3
+ import { observeOtterAnimation } from "./otter-animation-visibility.mjs";
4
+ import { useEffect, useRef } from "react";
3
5
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
4
6
  //#region src/components/steps/otter-indicator.tsx
5
- const WAVE_PATH = "M-12 30q3-1.6 6 0t6 0t6 0t6 0t6 0t6 0t6 0t6 0t6 0t6 0t6 0t6 0V48H-12Z";
6
- const FUR = "oklch(0.5 0.07 55)";
7
- const FUR_DARK = "oklch(0.42 0.06 55)";
8
- const INK = "oklch(0.22 0.03 45)";
9
- const WHITE = "oklch(1 0 0)";
10
- function Parcel({ x, y }) {
11
- return /* @__PURE__ */ jsxs("g", {
12
- transform: `translate(${x} ${y})`,
13
- children: [/* @__PURE__ */ jsx("rect", {
14
- width: "9",
15
- height: "7",
16
- rx: "0.8",
17
- fill: "oklch(0.78 0.12 75)",
18
- stroke: FUR_DARK,
19
- strokeWidth: "0.8"
20
- }), /* @__PURE__ */ jsx("path", {
21
- d: "M4.5 0v7M0 3h9",
22
- stroke: "oklch(0.63 0.11 65)",
23
- strokeWidth: "0.8"
24
- })]
25
- });
26
- }
27
- /** The face changes with the step: asleep, paddling, pleased or upset. */
28
- function Face({ status }) {
29
- const line = {
30
- fill: "none",
31
- stroke: INK,
32
- strokeWidth: .8,
33
- strokeLinecap: "round"
34
- };
35
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [
36
- status === "process" && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("circle", {
37
- cx: "36.3",
38
- cy: "20.6",
39
- r: "1.1",
40
- fill: INK
41
- }), /* @__PURE__ */ jsx("circle", {
42
- cx: "36.7",
43
- cy: "20.2",
44
- r: "0.35",
45
- fill: WHITE
46
- })] }),
47
- status === "wait" && /* @__PURE__ */ jsx("path", {
48
- d: "M35.2 20.6q1.1 0.9 2.2 0",
49
- ...line
50
- }),
51
- status === "finish" && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("path", {
52
- d: "M35.2 21.2q1.1-1.3 2.2 0",
53
- ...line
54
- }), /* @__PURE__ */ jsx("ellipse", {
55
- cx: "38.6",
56
- cy: "22.4",
57
- rx: "1.3",
58
- ry: "0.8",
59
- fill: "oklch(0.8 0.1 20)",
60
- opacity: "0.8"
61
- })] }),
62
- status === "error" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
63
- /* @__PURE__ */ jsx("circle", {
64
- cx: "36.3",
65
- cy: "20.8",
66
- r: "1.2",
67
- fill: WHITE,
68
- stroke: INK,
69
- strokeWidth: "0.5"
70
- }),
71
- /* @__PURE__ */ jsx("circle", {
72
- cx: "36.5",
73
- cy: "21",
74
- r: "0.55",
75
- fill: INK
76
- }),
77
- /* @__PURE__ */ jsx("path", {
78
- d: "M34.6 18.2l2.8 0.8",
79
- ...line
80
- })
81
- ] }),
82
- /* @__PURE__ */ jsx("ellipse", {
83
- cx: "42.6",
84
- cy: "23.6",
85
- rx: "1.4",
86
- ry: "1.1",
87
- fill: INK
88
- }),
89
- /* @__PURE__ */ jsx("path", {
90
- d: status === "error" ? "M39.6 27.2q1-0.9 2.1 0" : "M39.6 26.6q1 0.9 2.1 0",
91
- ...line,
92
- strokeWidth: .7
93
- }),
94
- /* @__PURE__ */ jsx("path", {
95
- d: "M41 25.2l4.2-0.8M41 26l4.2 0.6",
96
- stroke: FUR_DARK,
97
- strokeWidth: "0.4",
98
- strokeLinecap: "round"
99
- })
100
- ] });
101
- }
102
- /** A small badge above the head: ✓ when done, ! when failed. */
103
- function Badge({ status }) {
104
- if (status !== "finish" && status !== "error") return null;
105
- return /* @__PURE__ */ jsxs("g", {
106
- transform: "translate(43 9)",
107
- children: [/* @__PURE__ */ jsx("circle", {
108
- r: "4.6",
109
- fill: status === "finish" ? "var(--success)" : "var(--danger)",
110
- stroke: WHITE,
111
- strokeWidth: "1"
112
- }), status === "finish" ? /* @__PURE__ */ jsx("path", {
113
- d: "M-2 0l1.4 1.5L2.1-1.4",
114
- fill: "none",
115
- stroke: WHITE,
116
- strokeWidth: "1.2",
117
- strokeLinecap: "round",
118
- strokeLinejoin: "round"
119
- }) : /* @__PURE__ */ jsx("path", {
120
- d: "M0-2.4v2.6M0 2.1v0.1",
121
- stroke: WHITE,
122
- strokeWidth: "1.3",
123
- strokeLinecap: "round"
124
- })]
125
- });
126
- }
127
- /** The otter on its back, posed by the step: paddling, at ease, upset or asleep. */
128
- function OtterBody({ status }) {
129
- return /* @__PURE__ */ jsxs("g", {
130
- className: "r-otter-indicator__body",
131
- children: [
132
- /* @__PURE__ */ jsx("path", {
133
- d: "M13 26.5Q6 26.5 1.5 30.5Q7 32 13 31Z",
134
- fill: FUR_DARK
135
- }),
136
- /* @__PURE__ */ jsx("ellipse", {
137
- cx: "11",
138
- cy: "21.5",
139
- rx: "1.9",
140
- ry: "3",
141
- fill: FUR_DARK,
142
- transform: "rotate(-25 11 21.5)"
143
- }),
144
- /* @__PURE__ */ jsx("ellipse", {
145
- cx: "14.5",
146
- cy: "20.5",
147
- rx: "1.9",
148
- ry: "3",
149
- fill: FUR_DARK,
150
- transform: "rotate(-10 14.5 20.5)"
151
- }),
152
- /* @__PURE__ */ jsx("g", {
153
- className: "r-otter-indicator__arm",
154
- children: /* @__PURE__ */ jsx("path", {
155
- d: status === "process" ? "M29 27q4 3.5 2.5 8" : "M29 26q3 0.5 4-2",
156
- fill: "none",
157
- stroke: FUR_DARK,
158
- strokeWidth: "2.8",
159
- strokeLinecap: "round"
160
- })
161
- }),
162
- /* @__PURE__ */ jsx("ellipse", {
163
- cx: "22",
164
- cy: "28",
165
- rx: "12",
166
- ry: "6.5",
167
- fill: FUR
168
- }),
169
- /* @__PURE__ */ jsx("ellipse", {
170
- cx: "22",
171
- cy: "25",
172
- rx: "9",
173
- ry: "3.6",
174
- fill: "oklch(0.8 0.06 70)"
175
- }),
176
- status !== "error" && /* @__PURE__ */ jsx(Parcel, {
177
- x: 16.5,
178
- y: 16.5
179
- }),
180
- /* @__PURE__ */ jsx("ellipse", {
181
- cx: "26.5",
182
- cy: "21",
183
- rx: "1.7",
184
- ry: "2.4",
185
- fill: FUR_DARK,
186
- transform: "rotate(30 26.5 21)"
187
- }),
188
- status === "finish" && /* @__PURE__ */ jsx("ellipse", {
189
- cx: "16",
190
- cy: "21.5",
191
- rx: "1.6",
192
- ry: "2.2",
193
- fill: FUR_DARK,
194
- transform: "rotate(-30 16 21.5)"
195
- }),
196
- /* @__PURE__ */ jsx("circle", {
197
- cx: "31.5",
198
- cy: "17.3",
199
- r: "1.8",
200
- fill: FUR_DARK
201
- }),
202
- /* @__PURE__ */ jsx("circle", {
203
- cx: "35",
204
- cy: "23",
205
- r: "7",
206
- fill: FUR
207
- }),
208
- /* @__PURE__ */ jsx("ellipse", {
209
- cx: "39",
210
- cy: "25",
211
- rx: "4.2",
212
- ry: "3.2",
213
- fill: "oklch(0.87 0.05 75)"
214
- }),
215
- /* @__PURE__ */ jsx(Face, { status }),
216
- status === "error" && /* @__PURE__ */ jsx("path", {
217
- d: "M37.4 22.3q-0.8 1.4 0 1.9q0.8-0.5 0-1.9Z",
218
- fill: "oklch(0.8 0.08 230)"
219
- })
220
- ]
221
- });
222
- }
223
7
  /**
224
- * An otter on its back, one pose per status:
225
- * - `wait`: asleep on the dry bank, the parcel still on its belly.
226
- * - `process`: afloat, paddling with one arm, the parcel on its belly.
227
- * - `finish`: drifting at ease, hugging the delivered parcel.
228
- * - `error`: shivering in the water; the parcel has slipped away.
229
- *
230
- * It fills its box; give it 48px or more so the poses read.
8
+ * Ottie resting, quietly typing, tilting its head or celebrating.
9
+ * Wait/process loop only while visible. Error/finish play once on entry.
10
+ * Reduced motion shows a still pose. Give it an explicit square box, 40px or larger.
11
+ * Decorative by default; the consumer supplies the nearby status text.
231
12
  */
232
- function OtterIndicator({ status, className, ...props }) {
233
- const pondId = `otter-pond${useId().replace(/[^\w-]/g, "")}`;
234
- const pond = `url(#${pondId})`;
235
- const wet = status !== "wait";
13
+ function OtterIndicator({ status, className, ref, ...props }) {
14
+ const node = useRef(null);
15
+ const [mergedRef] = useMergedRef(node, ref);
16
+ useEffect(() => {
17
+ if (node.current) return observeOtterAnimation(node.current);
18
+ }, []);
236
19
  return /* @__PURE__ */ jsxs("svg", {
237
20
  "aria-hidden": "true",
238
- viewBox: "0 0 48 48",
239
21
  width: "100%",
240
22
  height: "100%",
241
23
  "data-slot": "otter-indicator",
242
24
  ...props,
25
+ ref: mergedRef,
243
26
  className: cn("r-otter-indicator", `r-otter-indicator--${status}`, className),
244
- children: [
245
- /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", {
246
- id: pondId,
247
- children: /* @__PURE__ */ jsx("ellipse", {
248
- cx: "24",
249
- cy: "35",
250
- rx: "23.5",
251
- ry: "8"
27
+ children: [/* @__PURE__ */ jsx("foreignObject", {
28
+ width: "100%",
29
+ height: "100%",
30
+ children: /* @__PURE__ */ jsx("div", {
31
+ className: "r-otter-indicator__viewport",
32
+ children: /* @__PURE__ */ jsx("div", {
33
+ className: "r-otter-indicator__art",
34
+ children: status === "wait" ? /* @__PURE__ */ jsx("div", { className: "r-otter-indicator__rest" }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [status !== "finish" && /* @__PURE__ */ jsx("div", { className: "r-otter-indicator__base" }), /* @__PURE__ */ jsx("div", { className: "r-otter-indicator__frames" })] })
252
35
  })
253
- }) }),
254
- /* @__PURE__ */ jsxs("g", {
255
- transform: "translate(0 -5)",
256
- children: [
257
- wet ? /* @__PURE__ */ jsx("g", {
258
- clipPath: pond,
259
- children: /* @__PURE__ */ jsx("path", {
260
- className: "r-otter-indicator__wave r-otter-indicator__wave--back",
261
- d: WAVE_PATH,
262
- fill: "oklch(0.88 0.07 215)",
263
- transform: "translate(0 -1.5)"
264
- })
265
- }) : /* @__PURE__ */ jsxs("g", { children: [
266
- /* @__PURE__ */ jsx("ellipse", {
267
- cx: "24",
268
- cy: "34",
269
- rx: "22",
270
- ry: "5.5",
271
- fill: "oklch(0.9 0.06 85)"
272
- }),
273
- /* @__PURE__ */ jsx("ellipse", {
274
- cx: "7",
275
- cy: "34.5",
276
- rx: "1.6",
277
- ry: "1",
278
- fill: "oklch(0.78 0.06 75)"
279
- }),
280
- /* @__PURE__ */ jsx("ellipse", {
281
- cx: "41",
282
- cy: "35.5",
283
- rx: "1.2",
284
- ry: "0.8",
285
- fill: "oklch(0.78 0.06 75)"
286
- })
287
- ] }),
288
- status === "process" && ["", " r-otter-indicator__ripple--late"].map((late) => /* @__PURE__ */ jsx("ellipse", {
289
- className: `r-otter-indicator__ripple${late}`,
290
- cx: "6",
291
- cy: "30.5",
292
- rx: "5",
293
- ry: "1.4",
294
- fill: "none",
295
- stroke: WHITE,
296
- strokeWidth: "0.8"
297
- }, late)),
298
- status === "error" && /* @__PURE__ */ jsx("g", {
299
- className: "r-otter-indicator__parcel--adrift",
300
- children: /* @__PURE__ */ jsx(Parcel, {
301
- x: 1.5,
302
- y: 22
303
- })
304
- }),
305
- /* @__PURE__ */ jsx(OtterBody, { status }),
306
- wet && /* @__PURE__ */ jsx("g", {
307
- clipPath: pond,
308
- children: /* @__PURE__ */ jsx("path", {
309
- className: "r-otter-indicator__wave",
310
- d: WAVE_PATH,
311
- fill: "oklch(0.78 0.11 220)",
312
- fillOpacity: "0.9"
313
- })
314
- }),
315
- status === "wait" && ["", " r-otter-indicator__z--late"].map((late, i) => /* @__PURE__ */ jsx("text", {
316
- className: `r-otter-indicator__z${late}`,
317
- x: i === 0 ? 38 : 43,
318
- y: i === 0 ? 15 : 9,
319
- fontSize: i === 0 ? 9 : 7,
320
- fontWeight: "700",
321
- fill: "var(--foreground-muted, currentColor)",
322
- children: "z"
323
- }, late))
324
- ]
325
- }),
326
- /* @__PURE__ */ jsx(Badge, { status })
327
- ]
36
+ })
37
+ }, `art-${status}`), status === "error" && /* @__PURE__ */ jsx("svg", {
38
+ viewBox: "0 0 48 48",
39
+ width: "100%",
40
+ height: "100%",
41
+ overflow: "visible",
42
+ children: /* @__PURE__ */ jsx("text", {
43
+ className: "r-otter-indicator__question",
44
+ x: "40.3",
45
+ y: "11.4",
46
+ fontSize: "11.4",
47
+ fontWeight: "800",
48
+ transform: "rotate(10 40.3 11.4)",
49
+ children: "?"
50
+ }, `question-${status}`)
51
+ })]
328
52
  });
329
53
  }
330
54
  //#endregion
@@ -2,7 +2,7 @@ import { tv } from "../../lib/tv.mjs";
2
2
  import { useMergedRef } from "../../lib/use-merged-ref.mjs";
3
3
  import { useTapActivation } from "../../lib/tap-activation.mjs";
4
4
  import { createDragAnnouncements, dragInstructions } from "../drag/drag-announcements.mjs";
5
- import { DragLift, useDragSiblingTransition, useLiftContainer } from "../drag/drag-lift.mjs";
5
+ import { DragLift, useDragSiblingTransition } from "../drag/drag-lift.mjs";
6
6
  import { useDragSensors } from "../drag/drag-sensors.mjs";
7
7
  import { DropPlaceholder } from "../drag/drop-placeholder.mjs";
8
8
  import { createContext, use, useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
@@ -275,7 +275,6 @@ function SortableTabsList({ value, onReorder, onDragStart, messages, container,
275
275
  const sensors = useDragSensors();
276
276
  const [copies] = useState(() => /* @__PURE__ */ new Map());
277
277
  const [nodes] = useState(() => /* @__PURE__ */ new Map());
278
- const liftContainer = useLiftContainer(container);
279
278
  const selectedValue = use(TabsValueContext);
280
279
  const { tab: tabClassName, content: contentClassName } = tabs({
281
280
  variant,
@@ -353,7 +352,7 @@ function SortableTabsList({ value, onReorder, onDragStart, messages, container,
353
352
  })
354
353
  }), /* @__PURE__ */ jsx(DragLift, {
355
354
  className: "rounded-control",
356
- container: liftContainer,
355
+ container,
357
356
  children: activeId === void 0 ? null : /* @__PURE__ */ jsx("span", {
358
357
  "data-slot": "tabs-tab",
359
358
  "data-active": selectedValue === activeId ? "" : void 0,
@@ -62,7 +62,11 @@ export declare function TaskDropPlaceholder({ id, placement, className, render,
62
62
  export type TaskDragOverlayProps = {
63
63
  children?: ReactNode;
64
64
  className?: string;
65
- /** Render the copy in another element, such as `document.body` when an ancestor has a transform. */
65
+ /**
66
+ * Where the copy renders: `document.body` by default, so it rises above
67
+ * everything outside a ScrollArea the board is in. `null` renders it in
68
+ * place (`DragLift`'s `container`).
69
+ */
66
70
  container?: Element | DocumentFragment | null;
67
71
  };
68
72
  /**