@smwb/ui-react 2.5.0 → 2.6.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 (66) hide show
  1. package/dist/assets/styles/less/components/confirmDialog/confirmDialog.entry.css +1 -0
  2. package/dist/assets/styles/less/components/fileDrop/fileDrop.entry.css +1 -0
  3. package/dist/assets/styles/less/components/fileInput/fileInput.entry.css +1 -0
  4. package/dist/assets/styles/less/components/floatingWindow/floatingWindow.entry.css +1 -0
  5. package/dist/assets/styles/less/components/treeView/treeView.entry.css +1 -1
  6. package/dist/components/dataDisplay/chat/chat.d.ts +1 -1
  7. package/dist/components/dataDisplay/chat/chat.js.map +1 -1
  8. package/dist/components/dataDisplay/chat/useChatFileUpload.d.ts +16 -4
  9. package/dist/components/dataDisplay/chat/useChatFileUpload.js +38 -29
  10. package/dist/components/dataDisplay/chat/useChatFileUpload.js.map +1 -1
  11. package/dist/components/feedBack/confirmDialog/confirmDialog.d.ts +27 -0
  12. package/dist/components/feedBack/confirmDialog/confirmDialog.js +49 -0
  13. package/dist/components/feedBack/confirmDialog/confirmDialog.js.map +1 -0
  14. package/dist/components/feedBack/confirmDialog/index.d.ts +2 -0
  15. package/dist/components/inputs/fileDrop/countPreview.js +15 -0
  16. package/dist/components/inputs/fileDrop/countPreview.js.map +1 -0
  17. package/dist/components/inputs/fileDrop/fileDrop.d.ts +1 -1
  18. package/dist/components/inputs/fileDrop/fileDrop.js +60 -0
  19. package/dist/components/inputs/fileDrop/fileDrop.js.map +1 -0
  20. package/dist/components/inputs/fileDrop/index.d.ts +9 -0
  21. package/dist/components/inputs/fileDrop/preview.js +41 -0
  22. package/dist/components/inputs/fileDrop/preview.js.map +1 -0
  23. package/dist/components/inputs/fileDrop/previewWrapper.js +27 -0
  24. package/dist/components/inputs/fileDrop/previewWrapper.js.map +1 -0
  25. package/dist/components/inputs/fileDrop/utils.js +7 -0
  26. package/dist/components/inputs/fileDrop/utils.js.map +1 -0
  27. package/dist/components/inputs/fileInput/fileInput.d.ts +1 -1
  28. package/dist/components/inputs/fileInput/fileInput.js +35 -0
  29. package/dist/components/inputs/fileInput/fileInput.js.map +1 -0
  30. package/dist/components/inputs/fileInput/index.d.ts +2 -0
  31. package/dist/components/layout/floatingWindow/floatingWindow.d.ts +92 -0
  32. package/dist/components/layout/floatingWindow/floatingWindow.js +326 -0
  33. package/dist/components/layout/floatingWindow/floatingWindow.js.map +1 -0
  34. package/dist/components/layout/floatingWindow/index.d.ts +2 -0
  35. package/dist/headless/components/dataDisplay/chat/chat.js.map +1 -1
  36. package/dist/headless/components/dataDisplay/chat/useChatFileUpload.js +38 -29
  37. package/dist/headless/components/dataDisplay/chat/useChatFileUpload.js.map +1 -1
  38. package/dist/headless/components/feedBack/confirmDialog/confirmDialog.js +48 -0
  39. package/dist/headless/components/feedBack/confirmDialog/confirmDialog.js.map +1 -0
  40. package/dist/headless/components/inputs/fileDrop/countPreview.js +15 -0
  41. package/dist/headless/components/inputs/fileDrop/countPreview.js.map +1 -0
  42. package/dist/headless/components/inputs/fileDrop/fileDrop.js +59 -0
  43. package/dist/headless/components/inputs/fileDrop/fileDrop.js.map +1 -0
  44. package/dist/headless/components/inputs/fileDrop/preview.js +41 -0
  45. package/dist/headless/components/inputs/fileDrop/preview.js.map +1 -0
  46. package/dist/headless/components/inputs/fileDrop/previewWrapper.js +27 -0
  47. package/dist/headless/components/inputs/fileDrop/previewWrapper.js.map +1 -0
  48. package/dist/headless/components/inputs/fileDrop/utils.js +7 -0
  49. package/dist/headless/components/inputs/fileDrop/utils.js.map +1 -0
  50. package/dist/headless/components/inputs/fileInput/fileInput.js +34 -0
  51. package/dist/headless/components/inputs/fileInput/fileInput.js.map +1 -0
  52. package/dist/headless/components/layout/floatingWindow/floatingWindow.js +325 -0
  53. package/dist/headless/components/layout/floatingWindow/floatingWindow.js.map +1 -0
  54. package/dist/headless/hooks/useDropzone.js +47 -0
  55. package/dist/headless/hooks/useDropzone.js.map +1 -0
  56. package/dist/headless/index.js +277 -259
  57. package/dist/headless/index.js.map +1 -1
  58. package/dist/hooks/useDropzone.d.ts +44 -0
  59. package/dist/hooks/useDropzone.js +47 -0
  60. package/dist/hooks/useDropzone.js.map +1 -0
  61. package/dist/index.cjs +2 -2
  62. package/dist/index.cjs.map +1 -1
  63. package/dist/index.d.ts +10 -0
  64. package/dist/index.js +277 -259
  65. package/dist/index.js.map +1 -1
  66. package/package.json +2 -3
@@ -0,0 +1,92 @@
1
+ import React, { type ReactNode } from "react";
2
+ export interface FloatingWindowPosition {
3
+ x: number;
4
+ y: number;
5
+ }
6
+ export interface FloatingWindowSize {
7
+ width: number;
8
+ height: number;
9
+ }
10
+ /** The eight edge/corner resize directions. */
11
+ export type FloatingWindowResizeDir = "n" | "s" | "e" | "w" | "ne" | "nw" | "se" | "sw";
12
+ export interface FloatingWindowProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onResize" | "title" | "children"> {
13
+ /** Controlled open state of the window. */
14
+ open: boolean;
15
+ /** Title bar content. When given, the window is labelled by it. */
16
+ title?: ReactNode;
17
+ /** Extra header controls, rendered before the built-in collapse/close buttons. */
18
+ headerActions?: ReactNode;
19
+ /** Controlled top-left position in viewport px. */
20
+ position?: FloatingWindowPosition;
21
+ /** Initial position when uncontrolled. */
22
+ defaultPosition?: FloatingWindowPosition;
23
+ /** Called on every move frame and on viewport re-clamp, with the clamped position. */
24
+ onPositionChange?: (position: FloatingWindowPosition) => void;
25
+ /** Called once when a move gesture ends — the point at which to persist. */
26
+ onMoveEnd?: (position: FloatingWindowPosition) => void;
27
+ /** Controlled size in px. */
28
+ size?: FloatingWindowSize;
29
+ /** Initial size when uncontrolled. */
30
+ defaultSize?: FloatingWindowSize;
31
+ /** Called on every resize frame and on viewport re-clamp, with the clamped size. */
32
+ onResize?: (size: FloatingWindowSize) => void;
33
+ /** Called once when a resize gesture ends — the point at which to persist. */
34
+ onResizeEnd?: (size: FloatingWindowSize) => void;
35
+ /** Minimum width in px (default 200). */
36
+ minWidth?: number;
37
+ /** Minimum height in px (default 120). */
38
+ minHeight?: number;
39
+ /** Maximum width in px (default: viewport width). */
40
+ maxWidth?: number;
41
+ /** Maximum height in px (default: viewport height). */
42
+ maxHeight?: number;
43
+ /** Px of the window that must stay inside the viewport (default 56). */
44
+ keepVisible?: number;
45
+ /** Step in px for keyboard moving (default 24). */
46
+ moveStep?: number;
47
+ /** Step in px for keyboard resizing (default 24). */
48
+ resizeStep?: number;
49
+ /** Inline stacking order. The host owns z-order across several windows. */
50
+ zIndex?: number;
51
+ /** Called on pointerdown anywhere in the window, so the host can raise it. */
52
+ onActivate?: () => void;
53
+ /** Shade the window down to its title bar. */
54
+ collapsed?: boolean;
55
+ /** Initial collapsed state when uncontrolled. */
56
+ defaultCollapsed?: boolean;
57
+ onCollapsedChange?: (collapsed: boolean) => void;
58
+ /** Render the built-in collapse toggle (default true). */
59
+ collapsible?: boolean;
60
+ /** Allow drag-to-move by the title bar (default true). */
61
+ movable?: boolean;
62
+ /** Allow drag-to-resize from the edges and corners (default true). */
63
+ resizable?: boolean;
64
+ /** Close on Escape while focus is inside the window (default false). */
65
+ closeOnEsc?: boolean;
66
+ onClose?: () => void;
67
+ /** Accessible label for the move handle. */
68
+ moveHandleAriaLabel?: string;
69
+ /** Accessible label for the resize handle. */
70
+ resizeHandleAriaLabel?: string;
71
+ /** Accessible label for the close button. */
72
+ closeAriaLabel?: string;
73
+ /** Accessible label for the collapse toggle while expanded. */
74
+ collapseAriaLabel?: string;
75
+ /** Accessible label for the collapse toggle while collapsed. */
76
+ expandAriaLabel?: string;
77
+ "aria-label"?: string;
78
+ }
79
+ /**
80
+ * Free-floating, non-modal window: draggable by its title bar, resizable from every
81
+ * edge and corner, clamped so a grabbable strip always stays on screen.
82
+ *
83
+ * Unlike Sheet/Modal it is deliberately NOT an overlay layer: no backdrop, no focus
84
+ * trap, no `data-smwb-overlay-layer`. Several windows are meant to be open and usable
85
+ * at once alongside the page behind them, so it must not trap focus, swallow clicks,
86
+ * or steal Escape from a Modal stacked above it. Stacking order is the host's job —
87
+ * pass `zIndex` and raise the window from `onActivate`.
88
+ */
89
+ export declare const FloatingWindow: React.ForwardRefExoticComponent<FloatingWindowProps & {
90
+ children?: ReactNode | undefined;
91
+ } & React.RefAttributes<HTMLDivElement>>;
92
+ export default FloatingWindow;
@@ -0,0 +1,326 @@
1
+ import { jsx as s, Fragment as Ht, jsxs as T } from "react/jsx-runtime";
2
+ import '../../../assets/styles/less/components/floatingWindow/floatingWindow.entry.css';/* empty css */
3
+ import { forwardRef as Ut, useState as et, useRef as R, useId as $t, useCallback as A, useEffect as K } from "react";
4
+ import { createPortal as Vt } from "react-dom";
5
+ import { CSSTransition as Xt } from "react-transition-group";
6
+ import nt from "clsx";
7
+ import { Icon as v } from "../../base/icon/icon.js";
8
+ import { useControllableState as O } from "../../../hooks/useControllableState.js";
9
+ import { useForkRef as Yt } from "../../../hooks/useForkRef.js";
10
+ import { useSafeLayoutEffect as Zt } from "../../../hooks/useSafeLayoutEffect.js";
11
+ const jt = {
12
+ n: { dx: 0, dy: 1, dw: 0, dh: -1 },
13
+ s: { dx: 0, dy: 0, dw: 0, dh: 1 },
14
+ e: { dx: 0, dy: 0, dw: 1, dh: 0 },
15
+ w: { dx: 1, dy: 0, dw: -1, dh: 0 },
16
+ ne: { dx: 0, dy: 1, dw: 1, dh: -1 },
17
+ nw: { dx: 1, dy: 1, dw: -1, dh: -1 },
18
+ se: { dx: 0, dy: 0, dw: 1, dh: 1 },
19
+ sw: { dx: 1, dy: 0, dw: -1, dh: 1 }
20
+ }, Gt = ["n", "s", "e", "w", "ne", "nw", "se", "sw"], u = () => typeof window == "undefined" ? { width: 0, height: 0 } : { width: window.innerWidth, height: window.innerHeight }, qt = { x: 24, y: 24 }, Bt = { width: 360, height: 420 }, de = Ut(
21
+ function(ot, it) {
22
+ const {
23
+ open: c,
24
+ title: I,
25
+ headerActions: rt,
26
+ position: at,
27
+ defaultPosition: st = qt,
28
+ onPositionChange: dt,
29
+ onMoveEnd: f,
30
+ size: lt,
31
+ defaultSize: ct = Bt,
32
+ onResize: wt,
33
+ onResizeEnd: p,
34
+ minWidth: P = 200,
35
+ minHeight: D = 120,
36
+ maxWidth: a,
37
+ maxHeight: d,
38
+ keepVisible: F = 56,
39
+ moveStep: ht = 24,
40
+ resizeStep: E = 24,
41
+ zIndex: H,
42
+ onActivate: M,
43
+ collapsed: ut,
44
+ defaultCollapsed: ft = !1,
45
+ onCollapsedChange: pt,
46
+ collapsible: mt = !0,
47
+ movable: gt = !0,
48
+ resizable: yt = !0,
49
+ closeOnEsc: U = !1,
50
+ onClose: _,
51
+ moveHandleAriaLabel: xt = "Move window",
52
+ resizeHandleAriaLabel: bt = "Resize window",
53
+ closeAriaLabel: Pt = "Close window",
54
+ collapseAriaLabel: _t = "Collapse window",
55
+ expandAriaLabel: Rt = "Expand window",
56
+ className: Dt,
57
+ style: S,
58
+ children: Mt,
59
+ ...Ct
60
+ } = ot, [$, kt] = et(), C = R(null), zt = Yt(it, C), V = $t();
61
+ Zt(() => {
62
+ kt(document.body);
63
+ }, []);
64
+ const [m, X] = O({
65
+ value: at,
66
+ defaultValue: st,
67
+ onChange: dt
68
+ }), [g, Y] = O({
69
+ value: lt,
70
+ defaultValue: ct,
71
+ onChange: wt
72
+ }), [w, At] = O({
73
+ value: ut,
74
+ defaultValue: ft,
75
+ onChange: pt
76
+ }), y = A(
77
+ (t, e) => {
78
+ const n = a != null ? a : e.width, i = d != null ? d : e.height, o = Math.max(P, Math.min(n, t.width)), r = Math.max(D, Math.min(i, t.height)), b = Math.min(F, o), L = Math.max(b - o, Math.min(e.width - b, t.x)), N = Math.max(0, Math.min(Math.max(0, e.height - b), t.y));
79
+ return { x: L, y: N, width: o, height: r };
80
+ },
81
+ [F, d, a, D, P]
82
+ ), It = A(
83
+ (t, e) => {
84
+ const n = y(t, e);
85
+ return {
86
+ ...n,
87
+ x: Math.max(0, Math.min(n.x, e.width - n.width)),
88
+ y: Math.max(0, Math.min(n.y, e.height - n.height))
89
+ };
90
+ },
91
+ [y]
92
+ ), [Et, Z] = et(!1);
93
+ K(() => {
94
+ c || Z(!1);
95
+ }, [c]);
96
+ const j = { x: m.x, y: m.y, width: g.width, height: g.height }, h = Et ? y(j, u()) : It(j, u()), l = R(h);
97
+ l.current = h;
98
+ const x = A(
99
+ (t, e = !0) => {
100
+ e && Z(!0);
101
+ const n = y(t, u());
102
+ (n.x !== m.x || n.y !== m.y) && X({ x: n.x, y: n.y }), (n.width !== g.width || n.height !== g.height) && Y({ width: n.width, height: n.height });
103
+ },
104
+ [y, m.x, m.y, X, Y, g.height, g.width]
105
+ ), G = R(x);
106
+ G.current = x, K(() => {
107
+ if (!c) return;
108
+ const t = () => G.current(l.current, !1);
109
+ return window.addEventListener("resize", t), () => window.removeEventListener("resize", t);
110
+ }, [c]), K(() => {
111
+ if (!c || !U || !_) return;
112
+ const t = (e) => {
113
+ if (e.key !== "Escape") return;
114
+ const n = C.current;
115
+ !n || !n.contains(document.activeElement) || _();
116
+ };
117
+ return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
118
+ }, [U, _, c]);
119
+ const q = A(() => {
120
+ M == null || M();
121
+ const t = C.current;
122
+ t && !t.contains(document.activeElement) && t.focus({ preventScroll: !0 });
123
+ }, [M]), k = R(null), St = (t) => {
124
+ var n, i, o;
125
+ if (!gt || (n = t.target) != null && n.closest("button,[data-no-drag]")) return;
126
+ t.preventDefault();
127
+ const e = l.current;
128
+ k.current = { px: t.clientX, py: t.clientY, x: e.x, y: e.y };
129
+ try {
130
+ (o = (i = t.currentTarget).setPointerCapture) == null || o.call(i, t.pointerId);
131
+ } catch {
132
+ }
133
+ }, Lt = (t) => {
134
+ const e = k.current;
135
+ e && x({
136
+ ...l.current,
137
+ x: e.x + t.clientX - e.px,
138
+ y: e.y + t.clientY - e.py
139
+ });
140
+ }, B = (t) => {
141
+ var e, n, i, o;
142
+ if (k.current) {
143
+ k.current = null;
144
+ const r = l.current;
145
+ f == null || f({ x: r.x, y: r.y });
146
+ }
147
+ (n = (e = t.currentTarget).hasPointerCapture) != null && n.call(e, t.pointerId) && ((o = (i = t.currentTarget).releasePointerCapture) == null || o.call(i, t.pointerId));
148
+ }, z = R(null), Nt = (t, e) => {
149
+ var n, i;
150
+ e.preventDefault(), e.stopPropagation(), z.current = { dir: t, px: e.clientX, py: e.clientY, rect: l.current }, q();
151
+ try {
152
+ (i = (n = e.currentTarget).setPointerCapture) == null || i.call(n, e.pointerId);
153
+ } catch {
154
+ }
155
+ }, Tt = (t) => {
156
+ const e = z.current;
157
+ if (!e) return;
158
+ const n = jt[e.dir], i = t.clientX - e.px, o = t.clientY - e.py, r = e.rect, b = u(), L = a != null ? a : b.width, N = d != null ? d : b.height, W = Math.min(L, Math.max(P, r.width + n.dw * i)), tt = Math.min(N, Math.max(D, r.height + n.dh * o));
159
+ x({
160
+ x: n.dx ? r.x + r.width - W : r.x,
161
+ y: n.dy ? r.y + r.height - tt : r.y,
162
+ width: W,
163
+ height: tt
164
+ });
165
+ }, J = (t) => {
166
+ var e, n, i, o;
167
+ if (z.current) {
168
+ z.current = null;
169
+ const r = l.current;
170
+ p == null || p({ width: r.width, height: r.height });
171
+ }
172
+ (n = (e = t.currentTarget).hasPointerCapture) != null && n.call(e, t.pointerId) && ((o = (i = t.currentTarget).releasePointerCapture) == null || o.call(i, t.pointerId));
173
+ }, Q = (t, e) => {
174
+ const n = y(e, u());
175
+ t ? p == null || p({ width: n.width, height: n.height }) : f == null || f({ x: n.x, y: n.y });
176
+ }, Kt = (t) => {
177
+ const e = l.current, n = t.shiftKey ? E : ht, o = {
178
+ ArrowLeft: [-n, 0],
179
+ ArrowRight: [n, 0],
180
+ ArrowUp: [0, -n],
181
+ ArrowDown: [0, n]
182
+ }[t.key];
183
+ if (!o) return;
184
+ t.preventDefault();
185
+ const r = t.shiftKey ? { ...e, width: e.width + o[0], height: e.height + o[1] } : { ...e, x: e.x + o[0], y: e.y + o[1] };
186
+ x(r), Q(t.shiftKey, r);
187
+ }, vt = (t) => {
188
+ const e = l.current, n = u();
189
+ let i;
190
+ if (t.key === "ArrowLeft" || t.key === "ArrowRight") {
191
+ t.preventDefault();
192
+ const o = t.key === "ArrowRight" ? 1 : -1;
193
+ i = { ...e, width: e.width + o * E };
194
+ } else if (t.key === "ArrowUp" || t.key === "ArrowDown") {
195
+ t.preventDefault();
196
+ const o = t.key === "ArrowDown" ? 1 : -1;
197
+ i = { ...e, height: e.height + o * E };
198
+ } else if (t.key === "Home")
199
+ t.preventDefault(), i = { ...e, width: P, height: D };
200
+ else if (t.key === "End")
201
+ t.preventDefault(), i = { ...e, width: a != null ? a : n.width, height: d != null ? d : n.height };
202
+ else
203
+ return;
204
+ x(i), Q(!0, i);
205
+ }, Ot = () => At((t) => !t);
206
+ if (!$)
207
+ return /* @__PURE__ */ s(Ht, {});
208
+ const Ft = {
209
+ left: `${h.x}px`,
210
+ top: `${h.y}px`,
211
+ width: `${h.width}px`,
212
+ ...w ? {} : { height: `${h.height}px` },
213
+ ...H === void 0 ? {} : { zIndex: H },
214
+ ...S != null ? S : {}
215
+ };
216
+ return Vt(
217
+ /* @__PURE__ */ s(
218
+ Xt,
219
+ {
220
+ in: c,
221
+ timeout: 120,
222
+ mountOnEnter: !0,
223
+ unmountOnExit: !0,
224
+ appear: !0,
225
+ classNames: { enterDone: "smwb-floating-window_entered" },
226
+ nodeRef: C,
227
+ children: /* @__PURE__ */ T(
228
+ "div",
229
+ {
230
+ ...Ct,
231
+ ref: zt,
232
+ "data-testid": "floating-window",
233
+ role: "dialog",
234
+ tabIndex: -1,
235
+ "aria-labelledby": I ? V : void 0,
236
+ className: nt("smwb-floating-window", Dt, { "smwb-collapsed": w }),
237
+ style: Ft,
238
+ onPointerDown: q,
239
+ children: [
240
+ /* @__PURE__ */ T(
241
+ "div",
242
+ {
243
+ className: "smwb-floating-window__header",
244
+ "data-testid": "floating-window-header",
245
+ onPointerDown: St,
246
+ onPointerMove: Lt,
247
+ onPointerUp: B,
248
+ onPointerCancel: B,
249
+ children: [
250
+ /* @__PURE__ */ s(
251
+ "span",
252
+ {
253
+ className: "smwb-floating-window__grip",
254
+ "data-testid": "floating-window-move",
255
+ role: "button",
256
+ tabIndex: 0,
257
+ "aria-label": xt,
258
+ onKeyDown: Kt,
259
+ children: /* @__PURE__ */ s(v, { name: "drag_indicator" })
260
+ }
261
+ ),
262
+ I ? /* @__PURE__ */ s("span", { className: "smwb-floating-window__title", id: V, children: I }) : null,
263
+ /* @__PURE__ */ T("div", { className: "smwb-floating-window__actions", "data-no-drag": !0, children: [
264
+ rt,
265
+ mt ? /* @__PURE__ */ s(
266
+ "button",
267
+ {
268
+ type: "button",
269
+ className: "smwb-floating-window__action",
270
+ "data-testid": "floating-window-collapse",
271
+ "aria-label": w ? Rt : _t,
272
+ "aria-expanded": !w,
273
+ onClick: Ot,
274
+ children: /* @__PURE__ */ s(v, { name: w ? "open_in_full" : "close_fullscreen" })
275
+ }
276
+ ) : null,
277
+ _ ? /* @__PURE__ */ s(
278
+ "button",
279
+ {
280
+ type: "button",
281
+ className: "smwb-floating-window__action",
282
+ "data-testid": "floating-window-close",
283
+ "aria-label": Pt,
284
+ onClick: _,
285
+ children: /* @__PURE__ */ s(v, { name: "close" })
286
+ }
287
+ ) : null
288
+ ] })
289
+ ]
290
+ }
291
+ ),
292
+ w ? null : /* @__PURE__ */ s("div", { className: "smwb-floating-window__body", "data-testid": "floating-window-body", children: Mt }),
293
+ yt && !w ? Gt.map((t) => /* @__PURE__ */ s(
294
+ "div",
295
+ {
296
+ className: nt("smwb-floating-window__resize", `smwb-floating-window__resize_${t}`),
297
+ "data-testid": `floating-window-resize-${t}`,
298
+ ...t === "se" ? {
299
+ role: "separator",
300
+ tabIndex: 0,
301
+ "aria-label": bt,
302
+ "aria-valuemin": P,
303
+ "aria-valuemax": Math.round(a != null ? a : u().width),
304
+ "aria-valuenow": Math.round(h.width),
305
+ onKeyDown: vt
306
+ } : { "aria-hidden": !0, tabIndex: -1 },
307
+ onPointerDown: (e) => Nt(t, e),
308
+ onPointerMove: Tt,
309
+ onPointerUp: J,
310
+ onPointerCancel: J
311
+ },
312
+ t
313
+ )) : null
314
+ ]
315
+ }
316
+ )
317
+ }
318
+ ),
319
+ $
320
+ );
321
+ }
322
+ );
323
+ export {
324
+ de as FloatingWindow
325
+ };
326
+ //# sourceMappingURL=floatingWindow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"floatingWindow.js","sources":["../../../../src/components/layout/floatingWindow/floatingWindow.tsx"],"sourcesContent":["import React, {\n type CSSProperties,\n type PropsWithChildren,\n type ReactNode,\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useRef,\n useState,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { CSSTransition } from \"react-transition-group\";\nimport cn from \"clsx\";\nimport Icon from \"../../base/icon/icon\";\nimport { useControllableState } from \"../../../hooks/useControllableState\";\nimport { useForkRef } from \"../../../hooks/useForkRef\";\nimport { useSafeLayoutEffect } from \"../../../hooks/useSafeLayoutEffect\";\n\nexport interface FloatingWindowPosition {\n x: number;\n y: number;\n}\n\nexport interface FloatingWindowSize {\n width: number;\n height: number;\n}\n\n/** The eight edge/corner resize directions. */\nexport type FloatingWindowResizeDir = \"n\" | \"s\" | \"e\" | \"w\" | \"ne\" | \"nw\" | \"se\" | \"sw\";\n\nexport interface FloatingWindowProps extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n \"onResize\" | \"title\" | \"children\"\n> {\n /** Controlled open state of the window. */\n open: boolean;\n /** Title bar content. When given, the window is labelled by it. */\n title?: ReactNode;\n /** Extra header controls, rendered before the built-in collapse/close buttons. */\n headerActions?: ReactNode;\n\n /** Controlled top-left position in viewport px. */\n position?: FloatingWindowPosition;\n /** Initial position when uncontrolled. */\n defaultPosition?: FloatingWindowPosition;\n /** Called on every move frame and on viewport re-clamp, with the clamped position. */\n onPositionChange?: (position: FloatingWindowPosition) => void;\n /** Called once when a move gesture ends — the point at which to persist. */\n onMoveEnd?: (position: FloatingWindowPosition) => void;\n\n /** Controlled size in px. */\n size?: FloatingWindowSize;\n /** Initial size when uncontrolled. */\n defaultSize?: FloatingWindowSize;\n /** Called on every resize frame and on viewport re-clamp, with the clamped size. */\n onResize?: (size: FloatingWindowSize) => void;\n /** Called once when a resize gesture ends — the point at which to persist. */\n onResizeEnd?: (size: FloatingWindowSize) => void;\n\n /** Minimum width in px (default 200). */\n minWidth?: number;\n /** Minimum height in px (default 120). */\n minHeight?: number;\n /** Maximum width in px (default: viewport width). */\n maxWidth?: number;\n /** Maximum height in px (default: viewport height). */\n maxHeight?: number;\n /** Px of the window that must stay inside the viewport (default 56). */\n keepVisible?: number;\n /** Step in px for keyboard moving (default 24). */\n moveStep?: number;\n /** Step in px for keyboard resizing (default 24). */\n resizeStep?: number;\n\n /** Inline stacking order. The host owns z-order across several windows. */\n zIndex?: number;\n /** Called on pointerdown anywhere in the window, so the host can raise it. */\n onActivate?: () => void;\n\n /** Shade the window down to its title bar. */\n collapsed?: boolean;\n /** Initial collapsed state when uncontrolled. */\n defaultCollapsed?: boolean;\n onCollapsedChange?: (collapsed: boolean) => void;\n /** Render the built-in collapse toggle (default true). */\n collapsible?: boolean;\n\n /** Allow drag-to-move by the title bar (default true). */\n movable?: boolean;\n /** Allow drag-to-resize from the edges and corners (default true). */\n resizable?: boolean;\n /** Close on Escape while focus is inside the window (default false). */\n closeOnEsc?: boolean;\n onClose?: () => void;\n\n /** Accessible label for the move handle. */\n moveHandleAriaLabel?: string;\n /** Accessible label for the resize handle. */\n resizeHandleAriaLabel?: string;\n /** Accessible label for the close button. */\n closeAriaLabel?: string;\n /** Accessible label for the collapse toggle while expanded. */\n collapseAriaLabel?: string;\n /** Accessible label for the collapse toggle while collapsed. */\n expandAriaLabel?: string;\n\n \"aria-label\"?: string;\n}\n\ninterface Rect {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\ninterface Viewport {\n width: number;\n height: number;\n}\n\n/** Sign vector per resize direction: how the pointer delta maps onto x/y/width/height. */\nconst RESIZE_DIRS: Record<FloatingWindowResizeDir, { dx: 0 | 1; dy: 0 | 1; dw: -1 | 0 | 1; dh: -1 | 0 | 1 }> = {\n n: { dx: 0, dy: 1, dw: 0, dh: -1 },\n s: { dx: 0, dy: 0, dw: 0, dh: 1 },\n e: { dx: 0, dy: 0, dw: 1, dh: 0 },\n w: { dx: 1, dy: 0, dw: -1, dh: 0 },\n ne: { dx: 0, dy: 1, dw: 1, dh: -1 },\n nw: { dx: 1, dy: 1, dw: -1, dh: -1 },\n se: { dx: 0, dy: 0, dw: 1, dh: 1 },\n sw: { dx: 1, dy: 0, dw: -1, dh: 1 },\n};\n\nconst RESIZE_ORDER: FloatingWindowResizeDir[] = [\"n\", \"s\", \"e\", \"w\", \"ne\", \"nw\", \"se\", \"sw\"];\n\nconst viewportOf = (): Viewport =>\n typeof window === \"undefined\" ? { width: 0, height: 0 } : { width: window.innerWidth, height: window.innerHeight };\n\nconst DEFAULT_POSITION: FloatingWindowPosition = { x: 24, y: 24 };\nconst DEFAULT_SIZE: FloatingWindowSize = { width: 360, height: 420 };\n\n/**\n * Free-floating, non-modal window: draggable by its title bar, resizable from every\n * edge and corner, clamped so a grabbable strip always stays on screen.\n *\n * Unlike Sheet/Modal it is deliberately NOT an overlay layer: no backdrop, no focus\n * trap, no `data-smwb-overlay-layer`. Several windows are meant to be open and usable\n * at once alongside the page behind them, so it must not trap focus, swallow clicks,\n * or steal Escape from a Modal stacked above it. Stacking order is the host's job —\n * pass `zIndex` and raise the window from `onActivate`.\n */\nexport const FloatingWindow = forwardRef<HTMLDivElement, PropsWithChildren<FloatingWindowProps>>(\n function FloatingWindow(props, ref) {\n const {\n open,\n title,\n headerActions,\n position: positionProp,\n defaultPosition = DEFAULT_POSITION,\n onPositionChange,\n onMoveEnd,\n size: sizeProp,\n defaultSize = DEFAULT_SIZE,\n onResize,\n onResizeEnd,\n minWidth = 200,\n minHeight = 120,\n maxWidth,\n maxHeight,\n keepVisible = 56,\n moveStep = 24,\n resizeStep = 24,\n zIndex,\n onActivate,\n collapsed: collapsedProp,\n defaultCollapsed = false,\n onCollapsedChange,\n collapsible = true,\n movable = true,\n resizable = true,\n closeOnEsc = false,\n onClose,\n moveHandleAriaLabel = \"Move window\",\n resizeHandleAriaLabel = \"Resize window\",\n closeAriaLabel = \"Close window\",\n collapseAriaLabel = \"Collapse window\",\n expandAriaLabel = \"Expand window\",\n className,\n style,\n children,\n ...rest\n } = props;\n\n const [domRoot, setDomRoot] = useState<HTMLElement>();\n const rootRef = useRef<HTMLDivElement>(null);\n const forkedRootRef = useForkRef<HTMLDivElement>(ref, rootRef);\n const titleId = useId();\n\n useSafeLayoutEffect(() => {\n setDomRoot(document.body);\n }, []);\n\n const [position, setPosition] = useControllableState<FloatingWindowPosition>({\n value: positionProp,\n defaultValue: defaultPosition,\n onChange: onPositionChange,\n });\n const [size, setSize] = useControllableState<FloatingWindowSize>({\n value: sizeProp,\n defaultValue: defaultSize,\n onChange: onResize,\n });\n const [collapsed, setCollapsed] = useControllableState<boolean>({\n value: collapsedProp,\n defaultValue: defaultCollapsed,\n onChange: onCollapsedChange,\n });\n\n /**\n * Size first, then position against the clamped size. `y` is never negative, so the\n * title bar can never be dragged above the top edge and become ungrabbable — the gap\n * that makes an off-screen Sheet unrecoverable.\n */\n const clampRect = useCallback(\n (rectIn: Rect, vp: Viewport): Rect => {\n const maxW = maxWidth ?? vp.width;\n const maxH = maxHeight ?? vp.height;\n const width = Math.max(minWidth, Math.min(maxW, rectIn.width));\n const height = Math.max(minHeight, Math.min(maxH, rectIn.height));\n const keep = Math.min(keepVisible, width);\n const x = Math.max(keep - width, Math.min(vp.width - keep, rectIn.x));\n const y = Math.max(0, Math.min(Math.max(0, vp.height - keep), rectIn.y));\n return { x, y, width, height };\n },\n [keepVisible, maxHeight, maxWidth, minHeight, minWidth]\n );\n\n /**\n * Where a window is placed before anyone touches it: fully inside the viewport when\n * it fits at all. `clampRect` alone only keeps `keepVisible` px reachable, which is\n * right for a window the user parked at an edge but wrong on opening — a 760px\n * default on a 375px phone opened a quarter of a screen off to the right.\n */\n const fitRect = useCallback(\n (rectIn: Rect, vp: Viewport): Rect => {\n const clamped = clampRect(rectIn, vp);\n return {\n ...clamped,\n x: Math.max(0, Math.min(clamped.x, vp.width - clamped.width)),\n y: Math.max(0, Math.min(clamped.y, vp.height - clamped.height)),\n };\n },\n [clampRect]\n );\n\n // Set by the first move/resize: from then on the user's placement wins and only the\n // reachability clamp applies, so a window can still be parked half off-screen.\n const [placed, setPlaced] = useState(false);\n useEffect(() => {\n // A closed window forgets that it was moved: opening it again should land on\n // screen like the first time, whatever the viewport is now.\n if (!open) setPlaced(false);\n }, [open]);\n\n /** The geometry actually rendered. Clamping the CONTROLLED value (not just drag\n * frames) means a rect restored from a larger monitor lands on screen immediately. */\n const current = { x: position.x, y: position.y, width: size.width, height: size.height };\n const rect = placed ? clampRect(current, viewportOf()) : fitRect(current, viewportOf());\n\n // The gesture handlers are attached once (pointer capture), so they must not close over a\n // stale rect. A ref mirroring the rendered rect keeps them reading the current geometry.\n const rectRef = useRef(rect);\n rectRef.current = rect;\n\n const commitRect = useCallback(\n (next: Rect, gesture = true): void => {\n if (gesture) setPlaced(true);\n const clamped = clampRect(next, viewportOf());\n if (clamped.x !== position.x || clamped.y !== position.y) setPosition({ x: clamped.x, y: clamped.y });\n if (clamped.width !== size.width || clamped.height !== size.height) {\n setSize({ width: clamped.width, height: clamped.height });\n }\n },\n [clampRect, position.x, position.y, setPosition, setSize, size.height, size.width]\n );\n\n const commitRectRef = useRef(commitRect);\n commitRectRef.current = commitRect;\n\n // Re-clamp when the viewport shrinks, so a window parked near an edge on a large\n // screen stays reachable on a small one. Sheet has no such listener, which is why a\n // dragged sheet survives a viewport shrink oversized.\n useEffect(() => {\n if (!open) return undefined;\n const onViewportResize = (): void => commitRectRef.current(rectRef.current, false);\n window.addEventListener(\"resize\", onViewportResize);\n return () => window.removeEventListener(\"resize\", onViewportResize);\n }, [open]);\n\n // Escape only while focus is inside this window. FloatingWindow is not an overlay\n // layer, so `isTopOverlayLayer` (document order, not z-index) would be the wrong\n // arbiter with several windows open.\n useEffect(() => {\n if (!open || !closeOnEsc || !onClose) return undefined;\n const onKeyDown = (event: KeyboardEvent): void => {\n if (event.key !== \"Escape\") return;\n const root = rootRef.current;\n if (!root || !root.contains(document.activeElement)) return;\n onClose();\n };\n document.addEventListener(\"keydown\", onKeyDown);\n return () => document.removeEventListener(\"keydown\", onKeyDown);\n }, [closeOnEsc, onClose, open]);\n\n const activate = useCallback((): void => {\n onActivate?.();\n // Only when focus is elsewhere — an unconditional focus() would steal the caret\n // from an input inside the window on every raise.\n const root = rootRef.current;\n if (root && !root.contains(document.activeElement)) root.focus({ preventScroll: true });\n }, [onActivate]);\n\n // Pointer capture keeps `pointermove` flowing to the handle even outside it, so there\n // are no document-level listeners to leak (Sheet's pattern, not screenDivider's).\n const move = useRef<{ px: number; py: number; x: number; y: number } | null>(null);\n\n const onMoveHandlePointerDown = (event: React.PointerEvent<HTMLDivElement>): void => {\n if (!movable) return;\n // Header buttons stay clickable.\n if ((event.target as Element | null)?.closest(\"button,[data-no-drag]\")) return;\n event.preventDefault();\n const current = rectRef.current;\n move.current = { px: event.clientX, py: event.clientY, x: current.x, y: current.y };\n try {\n event.currentTarget.setPointerCapture?.(event.pointerId);\n } catch {\n /* best-effort */\n }\n };\n\n const onMoveHandlePointerMove = (event: React.PointerEvent<HTMLDivElement>): void => {\n const start = move.current;\n if (!start) return;\n commitRect({\n ...rectRef.current,\n x: start.x + event.clientX - start.px,\n y: start.y + event.clientY - start.py,\n });\n };\n\n const endMove = (event: React.PointerEvent<HTMLDivElement>): void => {\n if (move.current) {\n move.current = null;\n const current = rectRef.current;\n onMoveEnd?.({ x: current.x, y: current.y });\n }\n if (event.currentTarget.hasPointerCapture?.(event.pointerId)) {\n event.currentTarget.releasePointerCapture?.(event.pointerId);\n }\n };\n\n const resize = useRef<{ dir: FloatingWindowResizeDir; px: number; py: number; rect: Rect } | null>(null);\n\n const onResizePointerDown = (dir: FloatingWindowResizeDir, event: React.PointerEvent<HTMLDivElement>): void => {\n event.preventDefault();\n event.stopPropagation();\n resize.current = { dir, px: event.clientX, py: event.clientY, rect: rectRef.current };\n // Grabbing a resize grip is an interaction with the window, so raise it too — the\n // root handler does not see it because this handler stops propagation.\n activate();\n try {\n event.currentTarget.setPointerCapture?.(event.pointerId);\n } catch {\n /* best-effort */\n }\n };\n\n const onResizePointerMove = (event: React.PointerEvent<HTMLDivElement>): void => {\n const gesture = resize.current;\n if (!gesture) return;\n const sign = RESIZE_DIRS[gesture.dir];\n const dx = event.clientX - gesture.px;\n const dy = event.clientY - gesture.py;\n const start = gesture.rect;\n // A west/north drag moves the origin AND changes the size, so width is recomputed from\n // the moved edge rather than from the delta alone — otherwise dragging past minWidth\n // would keep sliding the window instead of stopping at the minimum.\n //\n // The size must be clamped to BOTH bounds here, before the origin is derived from it.\n // Clamping only the minimum and leaving the maximum to commitRect's own clamp would\n // compute the origin from a width that then gets shrunk, so the edge the user is NOT\n // dragging would drift away under the cursor.\n const vp = viewportOf();\n const maxW = maxWidth ?? vp.width;\n const maxH = maxHeight ?? vp.height;\n const width = Math.min(maxW, Math.max(minWidth, start.width + sign.dw * dx));\n const height = Math.min(maxH, Math.max(minHeight, start.height + sign.dh * dy));\n commitRect({\n x: sign.dx ? start.x + start.width - width : start.x,\n y: sign.dy ? start.y + start.height - height : start.y,\n width,\n height,\n });\n };\n\n const endResize = (event: React.PointerEvent<HTMLDivElement>): void => {\n if (resize.current) {\n resize.current = null;\n const current = rectRef.current;\n onResizeEnd?.({ width: current.width, height: current.height });\n }\n if (event.currentTarget.hasPointerCapture?.(event.pointerId)) {\n event.currentTarget.releasePointerCapture?.(event.pointerId);\n }\n };\n\n /** A keypress is a COMPLETE gesture, so it reports move/resize end as well as the\n * per-frame change — otherwise a consumer that persists only on `*End` (the documented\n * way to avoid thrashing storage during a drag) would silently never save\n * keyboard-driven geometry. */\n const endKeyboardGesture = (resized: boolean, next: Rect): void => {\n const current = clampRect(next, viewportOf());\n if (resized) onResizeEnd?.({ width: current.width, height: current.height });\n else onMoveEnd?.({ x: current.x, y: current.y });\n };\n\n /** Arrows move; Shift+Arrows resize. */\n const onMoveHandleKeyDown = (event: React.KeyboardEvent<HTMLSpanElement>): void => {\n const current = rectRef.current;\n const step = event.shiftKey ? resizeStep : moveStep;\n const delta: Record<string, [number, number]> = {\n ArrowLeft: [-step, 0],\n ArrowRight: [step, 0],\n ArrowUp: [0, -step],\n ArrowDown: [0, step],\n };\n const d = delta[event.key];\n if (!d) return;\n event.preventDefault();\n const next = event.shiftKey\n ? { ...current, width: current.width + d[0], height: current.height + d[1] }\n : { ...current, x: current.x + d[0], y: current.y + d[1] };\n commitRect(next);\n endKeyboardGesture(event.shiftKey, next);\n };\n\n const onResizeHandleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>): void => {\n const current = rectRef.current;\n const vp = viewportOf();\n let next: Rect;\n if (event.key === \"ArrowLeft\" || event.key === \"ArrowRight\") {\n event.preventDefault();\n const dir = event.key === \"ArrowRight\" ? 1 : -1;\n next = { ...current, width: current.width + dir * resizeStep };\n } else if (event.key === \"ArrowUp\" || event.key === \"ArrowDown\") {\n event.preventDefault();\n const dir = event.key === \"ArrowDown\" ? 1 : -1;\n next = { ...current, height: current.height + dir * resizeStep };\n } else if (event.key === \"Home\") {\n event.preventDefault();\n next = { ...current, width: minWidth, height: minHeight };\n } else if (event.key === \"End\") {\n event.preventDefault();\n next = { ...current, width: maxWidth ?? vp.width, height: maxHeight ?? vp.height };\n } else {\n return;\n }\n commitRect(next);\n endKeyboardGesture(true, next);\n };\n\n const toggleCollapsed = (): void => setCollapsed((prev) => !prev);\n\n if (!domRoot) {\n return <></>;\n }\n\n const windowStyle: CSSProperties = {\n left: `${rect.x}px`,\n top: `${rect.y}px`,\n width: `${rect.width}px`,\n ...(collapsed ? {} : { height: `${rect.height}px` }),\n ...(zIndex === undefined ? {} : { zIndex }),\n ...(style ?? {}),\n };\n\n return createPortal(\n <CSSTransition\n in={open}\n timeout={120}\n mountOnEnter\n unmountOnExit\n appear\n classNames={{ enterDone: \"smwb-floating-window_entered\" }}\n nodeRef={rootRef}\n >\n <div\n {...rest}\n ref={forkedRootRef}\n data-testid=\"floating-window\"\n role=\"dialog\"\n tabIndex={-1}\n aria-labelledby={title ? titleId : undefined}\n className={cn(\"smwb-floating-window\", className, { \"smwb-collapsed\": collapsed })}\n style={windowStyle}\n onPointerDown={activate}\n >\n <div\n className=\"smwb-floating-window__header\"\n data-testid=\"floating-window-header\"\n onPointerDown={onMoveHandlePointerDown}\n onPointerMove={onMoveHandlePointerMove}\n onPointerUp={endMove}\n onPointerCancel={endMove}\n >\n {/* The move affordance is the grip, not the header: the header also hosts the\n collapse/close buttons and any consumer `headerActions`, and nesting those\n inside a role=\"button\" is an a11y violation. Pointer drag still works\n anywhere on the header; only the keyboard affordance lives here. */}\n <span\n className=\"smwb-floating-window__grip\"\n data-testid=\"floating-window-move\"\n role=\"button\"\n tabIndex={0}\n aria-label={moveHandleAriaLabel}\n onKeyDown={onMoveHandleKeyDown}\n >\n <Icon name=\"drag_indicator\" />\n </span>\n {title ? (\n <span className=\"smwb-floating-window__title\" id={titleId}>\n {title}\n </span>\n ) : null}\n <div className=\"smwb-floating-window__actions\" data-no-drag>\n {headerActions}\n {collapsible ? (\n <button\n type=\"button\"\n className=\"smwb-floating-window__action\"\n data-testid=\"floating-window-collapse\"\n aria-label={collapsed ? expandAriaLabel : collapseAriaLabel}\n aria-expanded={!collapsed}\n onClick={toggleCollapsed}\n >\n <Icon name={collapsed ? \"open_in_full\" : \"close_fullscreen\"} />\n </button>\n ) : null}\n {onClose ? (\n <button\n type=\"button\"\n className=\"smwb-floating-window__action\"\n data-testid=\"floating-window-close\"\n aria-label={closeAriaLabel}\n onClick={onClose}\n >\n <Icon name=\"close\" />\n </button>\n ) : null}\n </div>\n </div>\n\n {!collapsed ? (\n <div className=\"smwb-floating-window__body\" data-testid=\"floating-window-body\">\n {children}\n </div>\n ) : null}\n\n {resizable && !collapsed\n ? RESIZE_ORDER.map((dir) => (\n <div\n key={dir}\n className={cn(\"smwb-floating-window__resize\", `smwb-floating-window__resize_${dir}`)}\n data-testid={`floating-window-resize-${dir}`}\n // Only the south-east grip is reachable by keyboard: eight tab stops per\n // window would make Tab unusable once a few windows are open.\n {...(dir === \"se\"\n ? {\n role: \"separator\" as const,\n tabIndex: 0,\n \"aria-label\": resizeHandleAriaLabel,\n \"aria-valuemin\": minWidth,\n \"aria-valuemax\": Math.round(maxWidth ?? viewportOf().width),\n \"aria-valuenow\": Math.round(rect.width),\n onKeyDown: onResizeHandleKeyDown,\n }\n : { \"aria-hidden\": true, tabIndex: -1 })}\n onPointerDown={(event) => onResizePointerDown(dir, event)}\n onPointerMove={onResizePointerMove}\n onPointerUp={endResize}\n onPointerCancel={endResize}\n />\n ))\n : null}\n </div>\n </CSSTransition>,\n domRoot\n );\n }\n);\n\nexport default FloatingWindow;\n"],"names":["RESIZE_DIRS","RESIZE_ORDER","viewportOf","DEFAULT_POSITION","DEFAULT_SIZE","FloatingWindow","forwardRef","props","ref","open","title","headerActions","positionProp","defaultPosition","onPositionChange","onMoveEnd","sizeProp","defaultSize","onResize","onResizeEnd","minWidth","minHeight","maxWidth","maxHeight","keepVisible","moveStep","resizeStep","zIndex","onActivate","collapsedProp","defaultCollapsed","onCollapsedChange","collapsible","movable","resizable","closeOnEsc","onClose","moveHandleAriaLabel","resizeHandleAriaLabel","closeAriaLabel","collapseAriaLabel","expandAriaLabel","className","style","children","rest","domRoot","setDomRoot","useState","rootRef","useRef","forkedRootRef","useForkRef","titleId","useId","useSafeLayoutEffect","position","setPosition","useControllableState","size","setSize","collapsed","setCollapsed","clampRect","useCallback","rectIn","vp","maxW","maxH","width","height","keep","x","y","fitRect","clamped","placed","setPlaced","useEffect","current","rect","rectRef","commitRect","next","gesture","commitRectRef","onViewportResize","onKeyDown","event","root","activate","move","onMoveHandlePointerDown","_a","_c","_b","onMoveHandlePointerMove","start","endMove","_d","resize","onResizePointerDown","dir","onResizePointerMove","sign","dx","dy","endResize","endKeyboardGesture","resized","onMoveHandleKeyDown","step","d","onResizeHandleKeyDown","toggleCollapsed","prev","jsx","Fragment","windowStyle","createPortal","CSSTransition","jsxs","cn","Icon"],"mappings":";;;;;;;;;;AA6HA,MAAMA,KAAyG;AAAA,EAC7G,GAAG,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAA;AAAA,EAC9B,GAAG,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,EAAA;AAAA,EAC9B,GAAG,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,EAAA;AAAA,EAC9B,GAAG,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,IAAI,IAAI,EAAA;AAAA,EAC/B,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAA;AAAA,EAC/B,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,IAAI,IAAI,GAAA;AAAA,EAChC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,EAAA;AAAA,EAC/B,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,IAAI,IAAI,EAAA;AAClC,GAEMC,KAA0C,CAAC,KAAK,KAAK,KAAK,KAAK,MAAM,MAAM,MAAM,IAAI,GAErFC,IAAa,MACjB,OAAO,UAAW,cAAc,EAAE,OAAO,GAAG,QAAQ,EAAA,IAAM,EAAE,OAAO,OAAO,YAAY,QAAQ,OAAO,YAAA,GAEjGC,KAA2C,EAAE,GAAG,IAAI,GAAG,GAAA,GACvDC,KAAmC,EAAE,OAAO,KAAK,QAAQ,IAAA,GAYlDC,KAAiBC;AAAA,EAC5B,SAAwBC,IAAOC,IAAK;AAClC,UAAM;AAAA,MACJ,MAAAC;AAAA,MACA,OAAAC;AAAA,MACA,eAAAC;AA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AK,MAAME,KAAA,OAAAA,IAAYpB,EAAA,EAAa,KAAK;AAAA,sBAC1D,iBAAiB,KAAK,MAAM8E,EAAK,KAAK;AAAA,sBACtC,WAAWiC;AAAA,oBAAA,IAEb,EAAE,eAAe,IAAM,UAAU,GAAA;AAAA,oBACrC,eAAe,CAACzB,MAAUa,GAAoBC,GAAKd,CAAK;AAAA,oBACxD,eAAee;AAAA,oBACf,aAAaI;AAAA,oBACb,iBAAiBA;AAAA,kBAAA;AAAA,kBAnBZL;AAAA,gBAAA,CAqBR,IACD;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACN;AAAA,MAAA;AAAA,MAEFxD;AAAA,IAAA;AAAA,EAEJ;AACF;"}
@@ -0,0 +1,2 @@
1
+ export { FloatingWindow, default } from "./floatingWindow";
2
+ export type { FloatingWindowProps, FloatingWindowPosition, FloatingWindowSize, FloatingWindowResizeDir, } from "./floatingWindow";
@@ -1 +1 @@
1
- {"version":3,"file":"chat.js","sources":["../../../../../src/components/dataDisplay/chat/chat.tsx"],"sourcesContent":["import React, { PropsWithChildren, ReactNode, useId, useMemo } from \"react\";\nimport cn from \"clsx\";\nimport type { Accept } from \"react-dropzone\";\nimport { FloatingButton } from \"../../inputs/floatingButton/floatingButton\";\nimport Icon from \"../../base/icon/icon\";\nimport { useControllableState } from \"../../../hooks/useControllableState\";\nimport ChatComposer from \"./chatComposer\";\nimport ChatHeader from \"./chatHeader\";\nimport ChatMessages, { ChatMessagesProps } from \"./chatMessages\";\nimport ChatShell from \"./chatShell\";\nimport useChatFileUpload from \"./useChatFileUpload\";\nimport {\n ChatAnchor,\n ChatLayoutMode,\n ChatMessage,\n ChatMessageRenderContext,\n ChatThemeMode,\n CHAT_EXPAND_LAYOUTS,\n} from \"./types\";\nimport { pickInitialLayout, resolveAllowedLayouts, shouldShowChatCloseButton } from \"./utils\";\n\nexport interface ChatProps\n extends PropsWithChildren, Omit<ChatMessageRenderContext, \"showAvatars\" | \"showAttachments\"> {\n className?: string;\n messages: ChatMessage[];\n showAvatars?: boolean;\n showAttachments?: boolean;\n headerTitle?: ReactNode;\n headerSubtitle?: ReactNode;\n headerActions?: ReactNode;\n footer?: ReactNode;\n anchor?: ChatAnchor;\n themeMode?: ChatThemeMode;\n allowedLayouts?: ChatLayoutMode[];\n layout?: ChatLayoutMode;\n defaultLayout?: ChatLayoutMode;\n onLayoutChange?: (layout: ChatLayoutMode) => void;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n floatingTrigger?: boolean;\n triggerIcon?: ReactNode;\n triggerLabel?: string;\n onLoadMore?: () => void | Promise<void>;\n hasMore?: boolean;\n onSendMessage?: (text: string) => void | Promise<void>;\n composerPlaceholder?: string;\n composerDisabled?: boolean;\n composerShiftEnterNewline?: boolean;\n composerCtrlEnterNewline?: boolean;\n fileUpload?: boolean;\n onUploadFiles?: (files: File[]) => void | Promise<void>;\n fileUploadAccept?: Accept;\n fileUploadMaxFiles?: number;\n attachAriaLabel?: string;\n loading?: boolean;\n loadingMore?: boolean;\n loadingSkeletonCount?: number;\n renderMessage?: ChatMessagesProps[\"renderMessage\"];\n embedded?: boolean;\n overlayContext?: boolean;\n showStatus?: boolean;\n statusIcons?: ChatMessageRenderContext[\"statusIcons\"];\n renderStatus?: ChatMessageRenderContext[\"renderStatus\"];\n showCloseButton?: boolean;\n}\n\nexport function Chat({\n className,\n messages,\n showAvatars = false,\n showAttachments = false,\n headerTitle,\n headerSubtitle,\n headerActions,\n footer,\n children,\n anchor = \"bottom-right\",\n themeMode = \"inherit\",\n allowedLayouts: allowedLayoutsProp,\n layout: layoutProp,\n defaultLayout,\n onLayoutChange,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n floatingTrigger = false,\n triggerIcon,\n triggerLabel,\n onLoadMore,\n hasMore,\n onSendMessage,\n composerPlaceholder = \"message\",\n composerDisabled,\n composerShiftEnterNewline = true,\n composerCtrlEnterNewline = true,\n fileUpload = false,\n onUploadFiles,\n fileUploadAccept,\n fileUploadMaxFiles,\n attachAriaLabel,\n loading,\n loadingMore,\n loadingSkeletonCount,\n renderMessage,\n embedded = false,\n overlayContext = false,\n showStatus = false,\n statusIcons,\n renderStatus,\n showCloseButton,\n}: ChatProps) {\n const allowedLayouts = useMemo(\n () => resolveAllowedLayouts(allowedLayoutsProp ?? CHAT_EXPAND_LAYOUTS),\n [allowedLayoutsProp]\n );\n\n const [open, setOpen] = useControllableState<boolean>({\n value: openProp,\n defaultValue: defaultOpen,\n onChange: onOpenChange,\n });\n\n const [layout, setLayout] = useControllableState<ChatLayoutMode>({\n value: layoutProp,\n defaultValue: pickInitialLayout(allowedLayouts, defaultLayout),\n onChange: onLayoutChange,\n });\n\n const effectiveLayout: ChatLayoutMode = embedded\n ? \"fullHeight\"\n : floatingTrigger\n ? open\n ? layout\n : \"closed\"\n : layout;\n\n const handleOpen = () => {\n setOpen(true);\n if (layout === \"closed\") {\n setLayout(pickInitialLayout(allowedLayouts, defaultLayout));\n }\n };\n\n const handleClose = () => {\n setOpen(false);\n };\n\n const handleLayoutChange = (next: ChatLayoutMode) => {\n setOpen(true);\n setLayout(next);\n };\n\n const {\n enabled: fileUploadEnabled,\n getRootProps,\n getInputProps,\n isDragActive,\n } = useChatFileUpload({\n enabled: fileUpload,\n accept: fileUploadAccept,\n maxFiles: fileUploadMaxFiles,\n onUploadFiles,\n disabled: composerDisabled,\n });\n\n const attachInputId = useId();\n\n const showComposer = Boolean(onSendMessage) || fileUploadEnabled;\n\n const fileInput = fileUploadEnabled ? (\n <input {...getInputProps({ id: attachInputId })} data-testid=\"chat-file-input\" />\n ) : null;\n\n const resolvedFooter =\n footer ??\n children ??\n (showComposer ? (\n <>\n {fileInput}\n <ChatComposer\n onSendMessage={onSendMessage}\n placeholder={composerPlaceholder}\n disabled={composerDisabled}\n shiftEnterNewline={composerShiftEnterNewline}\n ctrlEnterNewline={composerCtrlEnterNewline}\n fileUpload={fileUploadEnabled}\n attachInputId={fileUploadEnabled ? attachInputId : undefined}\n attachAriaLabel={attachAriaLabel}\n />\n </>\n ) : undefined);\n\n const chatMessages = (\n <ChatMessages\n messages={messages}\n showAvatars={showAvatars}\n showAttachments={showAttachments}\n showStatus={showStatus}\n statusIcons={statusIcons}\n renderStatus={renderStatus}\n onLoadMore={onLoadMore}\n hasMore={hasMore}\n loading={loading}\n loadingMore={loadingMore}\n loadingSkeletonCount={loadingSkeletonCount}\n renderMessage={renderMessage}\n />\n );\n\n const chatBody = chatMessages;\n\n const fileDropzoneRootProps = fileUploadEnabled ? getRootProps() : undefined;\n\n const closeButtonVisible = shouldShowChatCloseButton({\n floatingTrigger,\n embedded,\n overlayContext,\n effectiveLayout,\n showCloseButton,\n });\n\n return (\n <div\n className={cn(\n \"smwb-chat\",\n !embedded && `smwb-chat_${anchor}`,\n embedded && \"smwb-chat_embedded\",\n overlayContext && \"smwb-chat_overlay-context\",\n className\n )}\n data-testid=\"chat\"\n >\n {floatingTrigger && !embedded && !open ? (\n <FloatingButton\n className=\"smwb-chat__trigger\"\n aria-label={triggerLabel ?? \"Open chat\"}\n data-testid=\"chat-trigger\"\n onClick={handleOpen}\n >\n {triggerIcon ?? <Icon name=\"chat\" size={24} />}\n </FloatingButton>\n ) : null}\n <ChatShell\n layout={effectiveLayout}\n anchor={anchor}\n themeMode={themeMode}\n embedded={embedded}\n overlayContext={overlayContext}\n fileDropzoneRootProps={fileDropzoneRootProps}\n fileDropzoneActive={fileUploadEnabled && isDragActive}\n header={\n <ChatHeader\n title={headerTitle}\n subtitle={headerSubtitle}\n actions={headerActions}\n layout={effectiveLayout === \"closed\" ? layout : effectiveLayout}\n allowedLayouts={allowedLayouts}\n onLayoutChange={handleLayoutChange}\n onClose={closeButtonVisible ? handleClose : undefined}\n />\n }\n footer={resolvedFooter}\n >\n {chatBody}\n </ChatShell>\n </div>\n );\n}\n\nexport default Chat;\n"],"names":["Chat","className","messages","showAvatars","showAttachments","headerTitle","headerSubtitle","headerActions","footer","children","anchor","themeMode","allowedLayoutsProp","layoutProp","defaultLayout","onLayoutChange","openProp","defaultOpen","onOpenChange","floatingTrigger","triggerIcon","triggerLabel","onLoadMore","hasMore","onSendMessage","composerPlaceholder","composerDisabled","composerShiftEnterNewline","composerCtrlEnterNewline","fileUpload","onUploadFiles","fileUploadAccept","fileUploadMaxFiles","attachAriaLabel","loading","loadingMore","loadingSkeletonCount","renderMessage","embedded","overlayContext","showStatus","statusIcons","renderStatus","showCloseButton","allowedLayouts","useMemo","resolveAllowedLayouts","CHAT_EXPAND_LAYOUTS","open","setOpen","useControllableState","layout","setLayout","pickInitialLayout","effectiveLayout","handleOpen","handleClose","handleLayoutChange","next","fileUploadEnabled","getRootProps","getInputProps","isDragActive","useChatFileUpload","attachInputId","useId","showComposer","fileInput","jsx","resolvedFooter","_a","jsxs","Fragment","ChatComposer","chatBody","ChatMessages","fileDropzoneRootProps","closeButtonVisible","shouldShowChatCloseButton","cn","FloatingButton","Icon","ChatShell","ChatHeader"],"mappings":";;;;;;;;;;;;;AAmEO,SAASA,GAAK;AAAA,EACnB,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,iBAAAC,IAAkB;AAAA,EAClB,aAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,eAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,WAAAC,IAAY;AAAA,EACZ,gBAAgBC;AAAA,EAChB,QAAQC;AAAA,EACR,eAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,MAAMC;AAAA,EACN,aAAAC,IAAc;AAAA,EACd,cAAAC;AAAA,EACA,iBAAAC,IAAkB;AAAA,EAClB,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,YAAAC;AAAA,EACA,SAAAC;AAAA,EACA,eAAAC;AAAA,EACA,qBAAAC,IAAsB;AAAA,EACtB,kBAAAC;AAAA,EACA,2BAAAC,IAA4B;AAAA,EAC5B,0BAAAC,IAA2B;AAAA,EAC3B,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,KAAmB,CAACmB,KAAY,CAACU,IAChC,gBAAAoB;AAAA,UAACY;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,cAAY3D,KAAA,OAAAA,IAAgB;AAAA,YAC5B,eAAY;AAAA,YACZ,SAASkC;AAAA,YAER,0BAAe,gBAAAa,EAACa,IAAA,EAAK,MAAK,QAAO,MAAM,GAAA,CAAI;AAAA,UAAA;AAAA,QAAA,IAE5C;AAAA,QACJ,gBAAAb;AAAA,UAACc;AAAA,UAAA;AAAA,YACC,QAAQ5B;AAAA,YACR,QAAA5C;AAAA,YACA,WAAAC;AAAA,YACA,UAAA2B;AAAA,YACA,gBAAAC;AAAA,YACA,uBAAAqC;AAAA,YACA,oBAAoBjB,KAAqBG;AAAA,YACzC,QACE,gBAAAM;AAAA,cAACe;AAAA,cAAA;AAAA,gBACC,OAAO9E;AAAA,gBACP,UAAUC;AAAA,gBACV,SAASC;AAAA,gBACT,QAAQ+C,MAAoB,WAAWH,IAASG;AAAA,gBAChD,gBAAAV;AAAA,gBACA,gBAAgBa;AAAA,gBAChB,SAASoB,KAAqBrB,KAAc;AAAA,cAAA;AAAA,YAAA;AAAA,YAGhD,QAAQa;AAAA,YAEP,UAAAK;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"chat.js","sources":["../../../../../src/components/dataDisplay/chat/chat.tsx"],"sourcesContent":["import React, { PropsWithChildren, ReactNode, useId, useMemo } from \"react\";\nimport cn from \"clsx\";\nimport type { Accept } from \"./useChatFileUpload\";\nimport { FloatingButton } from \"../../inputs/floatingButton/floatingButton\";\nimport Icon from \"../../base/icon/icon\";\nimport { useControllableState } from \"../../../hooks/useControllableState\";\nimport ChatComposer from \"./chatComposer\";\nimport ChatHeader from \"./chatHeader\";\nimport ChatMessages, { ChatMessagesProps } from \"./chatMessages\";\nimport ChatShell from \"./chatShell\";\nimport useChatFileUpload from \"./useChatFileUpload\";\nimport {\n ChatAnchor,\n ChatLayoutMode,\n ChatMessage,\n ChatMessageRenderContext,\n ChatThemeMode,\n CHAT_EXPAND_LAYOUTS,\n} from \"./types\";\nimport { pickInitialLayout, resolveAllowedLayouts, shouldShowChatCloseButton } from \"./utils\";\n\nexport interface ChatProps\n extends PropsWithChildren, Omit<ChatMessageRenderContext, \"showAvatars\" | \"showAttachments\"> {\n className?: string;\n messages: ChatMessage[];\n showAvatars?: boolean;\n showAttachments?: boolean;\n headerTitle?: ReactNode;\n headerSubtitle?: ReactNode;\n headerActions?: ReactNode;\n footer?: ReactNode;\n anchor?: ChatAnchor;\n themeMode?: ChatThemeMode;\n allowedLayouts?: ChatLayoutMode[];\n layout?: ChatLayoutMode;\n defaultLayout?: ChatLayoutMode;\n onLayoutChange?: (layout: ChatLayoutMode) => void;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n floatingTrigger?: boolean;\n triggerIcon?: ReactNode;\n triggerLabel?: string;\n onLoadMore?: () => void | Promise<void>;\n hasMore?: boolean;\n onSendMessage?: (text: string) => void | Promise<void>;\n composerPlaceholder?: string;\n composerDisabled?: boolean;\n composerShiftEnterNewline?: boolean;\n composerCtrlEnterNewline?: boolean;\n fileUpload?: boolean;\n onUploadFiles?: (files: File[]) => void | Promise<void>;\n fileUploadAccept?: Accept;\n fileUploadMaxFiles?: number;\n attachAriaLabel?: string;\n loading?: boolean;\n loadingMore?: boolean;\n loadingSkeletonCount?: number;\n renderMessage?: ChatMessagesProps[\"renderMessage\"];\n embedded?: boolean;\n overlayContext?: boolean;\n showStatus?: boolean;\n statusIcons?: ChatMessageRenderContext[\"statusIcons\"];\n renderStatus?: ChatMessageRenderContext[\"renderStatus\"];\n showCloseButton?: boolean;\n}\n\nexport function Chat({\n className,\n messages,\n showAvatars = false,\n showAttachments = false,\n headerTitle,\n headerSubtitle,\n headerActions,\n footer,\n children,\n anchor = \"bottom-right\",\n themeMode = \"inherit\",\n allowedLayouts: allowedLayoutsProp,\n layout: layoutProp,\n defaultLayout,\n onLayoutChange,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n floatingTrigger = false,\n triggerIcon,\n triggerLabel,\n onLoadMore,\n hasMore,\n onSendMessage,\n composerPlaceholder = \"message\",\n composerDisabled,\n composerShiftEnterNewline = true,\n composerCtrlEnterNewline = true,\n fileUpload = false,\n onUploadFiles,\n fileUploadAccept,\n fileUploadMaxFiles,\n attachAriaLabel,\n loading,\n loadingMore,\n loadingSkeletonCount,\n renderMessage,\n embedded = false,\n overlayContext = false,\n showStatus = false,\n statusIcons,\n renderStatus,\n showCloseButton,\n}: ChatProps) {\n const allowedLayouts = useMemo(\n () => resolveAllowedLayouts(allowedLayoutsProp ?? CHAT_EXPAND_LAYOUTS),\n [allowedLayoutsProp]\n );\n\n const [open, setOpen] = useControllableState<boolean>({\n value: openProp,\n defaultValue: defaultOpen,\n onChange: onOpenChange,\n });\n\n const [layout, setLayout] = useControllableState<ChatLayoutMode>({\n value: layoutProp,\n defaultValue: pickInitialLayout(allowedLayouts, defaultLayout),\n onChange: onLayoutChange,\n });\n\n const effectiveLayout: ChatLayoutMode = embedded\n ? \"fullHeight\"\n : floatingTrigger\n ? open\n ? layout\n : \"closed\"\n : layout;\n\n const handleOpen = () => {\n setOpen(true);\n if (layout === \"closed\") {\n setLayout(pickInitialLayout(allowedLayouts, defaultLayout));\n }\n };\n\n const handleClose = () => {\n setOpen(false);\n };\n\n const handleLayoutChange = (next: ChatLayoutMode) => {\n setOpen(true);\n setLayout(next);\n };\n\n const {\n enabled: fileUploadEnabled,\n getRootProps,\n getInputProps,\n isDragActive,\n } = useChatFileUpload({\n enabled: fileUpload,\n accept: fileUploadAccept,\n maxFiles: fileUploadMaxFiles,\n onUploadFiles,\n disabled: composerDisabled,\n });\n\n const attachInputId = useId();\n\n const showComposer = Boolean(onSendMessage) || fileUploadEnabled;\n\n const fileInput = fileUploadEnabled ? (\n <input {...getInputProps({ id: attachInputId })} data-testid=\"chat-file-input\" />\n ) : null;\n\n const resolvedFooter =\n footer ??\n children ??\n (showComposer ? (\n <>\n {fileInput}\n <ChatComposer\n onSendMessage={onSendMessage}\n placeholder={composerPlaceholder}\n disabled={composerDisabled}\n shiftEnterNewline={composerShiftEnterNewline}\n ctrlEnterNewline={composerCtrlEnterNewline}\n fileUpload={fileUploadEnabled}\n attachInputId={fileUploadEnabled ? attachInputId : undefined}\n attachAriaLabel={attachAriaLabel}\n />\n </>\n ) : undefined);\n\n const chatMessages = (\n <ChatMessages\n messages={messages}\n showAvatars={showAvatars}\n showAttachments={showAttachments}\n showStatus={showStatus}\n statusIcons={statusIcons}\n renderStatus={renderStatus}\n onLoadMore={onLoadMore}\n hasMore={hasMore}\n loading={loading}\n loadingMore={loadingMore}\n loadingSkeletonCount={loadingSkeletonCount}\n renderMessage={renderMessage}\n />\n );\n\n const chatBody = chatMessages;\n\n const fileDropzoneRootProps = fileUploadEnabled ? getRootProps() : undefined;\n\n const closeButtonVisible = shouldShowChatCloseButton({\n floatingTrigger,\n embedded,\n overlayContext,\n effectiveLayout,\n showCloseButton,\n });\n\n return (\n <div\n className={cn(\n \"smwb-chat\",\n !embedded && `smwb-chat_${anchor}`,\n embedded && \"smwb-chat_embedded\",\n overlayContext && \"smwb-chat_overlay-context\",\n className\n )}\n data-testid=\"chat\"\n >\n {floatingTrigger && !embedded && !open ? (\n <FloatingButton\n className=\"smwb-chat__trigger\"\n aria-label={triggerLabel ?? \"Open chat\"}\n data-testid=\"chat-trigger\"\n onClick={handleOpen}\n >\n {triggerIcon ?? <Icon name=\"chat\" size={24} />}\n </FloatingButton>\n ) : null}\n <ChatShell\n layout={effectiveLayout}\n anchor={anchor}\n themeMode={themeMode}\n embedded={embedded}\n overlayContext={overlayContext}\n fileDropzoneRootProps={fileDropzoneRootProps}\n fileDropzoneActive={fileUploadEnabled && isDragActive}\n header={\n <ChatHeader\n title={headerTitle}\n subtitle={headerSubtitle}\n actions={headerActions}\n layout={effectiveLayout === \"closed\" ? layout : effectiveLayout}\n allowedLayouts={allowedLayouts}\n onLayoutChange={handleLayoutChange}\n onClose={closeButtonVisible ? handleClose : undefined}\n />\n }\n footer={resolvedFooter}\n >\n {chatBody}\n </ChatShell>\n </div>\n );\n}\n\nexport default Chat;\n"],"names":["Chat","className","messages","showAvatars","showAttachments","headerTitle","headerSubtitle","headerActions","footer","children","anchor","themeMode","allowedLayoutsProp","layoutProp","defaultLayout","onLayoutChange","openProp","defaultOpen","onOpenChange","floatingTrigger","triggerIcon","triggerLabel","onLoadMore","hasMore","onSendMessage","composerPlaceholder","composerDisabled","composerShiftEnterNewline","composerCtrlEnterNewline","fileUpload","onUploadFiles","fileUploadAccept","fileUploadMaxFiles","attachAriaLabel","loading","loadingMore","loadingSkeletonCount","renderMessage","embedded","overlayContext","showStatus","statusIcons","renderStatus","showCloseButton","allowedLayouts","useMemo","resolveAllowedLayouts","CHAT_EXPAND_LAYOUTS","open","setOpen","useControllableState","layout","setLayout","pickInitialLayout","effectiveLayout","handleOpen","handleClose","handleLayoutChange","next","fileUploadEnabled","getRootProps","getInputProps","isDragActive","useChatFileUpload","attachInputId","useId","showComposer","fileInput","jsx","resolvedFooter","_a","jsxs","Fragment","ChatComposer","chatBody","ChatMessages","fileDropzoneRootProps","closeButtonVisible","shouldShowChatCloseButton","cn","FloatingButton","Icon","ChatShell","ChatHeader"],"mappings":";;;;;;;;;;;;;AAmEO,SAASA,GAAK;AAAA,EACnB,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,iBAAAC,IAAkB;AAAA,EAClB,aAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,eAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,WAAAC,IAAY;AAAA,EACZ,gBAAgBC;AAAA,EAChB,QAAQC;AAAA,EACR,eAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,MAAMC;AAAA,EACN,aAAAC,IAAc;AAAA,EACd,cAA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