@iclips/ui 3.1.0 → 4.0.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.
@@ -0,0 +1,617 @@
1
+ import { jsxs as i, jsx as e } from "react/jsx-runtime";
2
+ import * as v from "react";
3
+ import { format as V } from "date-fns";
4
+ import { ptBR as X } from "date-fns/locale";
5
+ import { cn as o } from "../utils.js";
6
+ import { Avatar as U, AvatarImage as B, AvatarFallback as D } from "../primitives/avatar.js";
7
+ import { Button as l } from "../primitives/button.js";
8
+ import { Badge as O } from "../primitives/badge.js";
9
+ import { Tooltip as L, TooltipTrigger as R, TooltipContent as T } from "../overlays/tooltip.js";
10
+ import { Separator as P } from "../primitives/separator.js";
11
+ import { MoreHorizontal as J, Smile as q, Trash2 as Q, AlertCircle as _, Paperclip as j, Plus as Y, GripVertical as Z, X as ee, Type as te, Send as re, Bold as ie, Italic as ae, Underline as se, List as ne, ListOrdered as oe, ListChecks as le, Highlighter as ce, Table as de, ChevronsDownUp as me, Link as he } from "lucide-react";
12
+ import { ReactRenderer as ue, useEditor as ge, EditorContent as fe } from "@tiptap/react";
13
+ import pe from "@tiptap/starter-kit";
14
+ import be from "@tiptap/extension-underline";
15
+ import ve from "@tiptap/extension-link";
16
+ import xe from "@tiptap/extension-image";
17
+ import Ne from "@tiptap/extension-mention";
18
+ import we from "@tiptap/extension-task-list";
19
+ import ye from "@tiptap/extension-task-item";
20
+ import Ce from "@tiptap/extension-file-handler";
21
+ import ke from "@tiptap/extension-highlight";
22
+ import Ae from "@tiptap/extension-typography";
23
+ import { Placeholder as Le, CharacterCount as Re } from "@tiptap/extensions";
24
+ import { TableKit as Te } from "@tiptap/extension-table";
25
+ import { Details as je, DetailsSummary as ze, DetailsContent as Se } from "@tiptap/extension-details";
26
+ import { DragHandle as Ee } from "@tiptap/extension-drag-handle-react";
27
+ import Ie from "tippy.js";
28
+ import { MentionList as Me } from "./mention-list.js";
29
+ import z from "emoji-picker-react";
30
+ import { Popover as S, PopoverTrigger as E, PopoverContent as I } from "../overlays/popover.js";
31
+ const He = ({ role: t }) => {
32
+ const h = {
33
+ internal: { label: "Equipe iClips", className: "bg-primary/10 text-primary border-primary/20" },
34
+ client: { label: "Cliente", className: "bg-info/10 text-info-emphasis border-info/20" },
35
+ freelancer: { label: "Freelancer", className: "bg-warning/10 text-warning-emphasis border-warning/20" }
36
+ }, { label: m, className: n } = h[t];
37
+ return /* @__PURE__ */ e(O, { variant: "outline", className: o("text-[10px] h-5 px-1.5 font-medium border-0", n), children: m });
38
+ }, Pe = ({
39
+ editor: t,
40
+ visible: h,
41
+ features: m = {}
42
+ }) => !t || !h ? null : /* @__PURE__ */ i("div", { className: "flex items-center gap-1 border-b p-1 bg-muted/20 animate-in slide-in-from-bottom-2 duration-200", children: [
43
+ /* @__PURE__ */ e(
44
+ l,
45
+ {
46
+ variant: "ghost",
47
+ size: "icon",
48
+ className: o("h-7 w-7", t.isActive("bold") && "bg-muted text-primary"),
49
+ onClick: () => t.chain().focus().toggleBold().run(),
50
+ title: "Negrito (Ctrl+B)",
51
+ "aria-label": "Negrito",
52
+ children: /* @__PURE__ */ e(ie, { className: "h-3.5 w-3.5" })
53
+ }
54
+ ),
55
+ /* @__PURE__ */ e(
56
+ l,
57
+ {
58
+ variant: "ghost",
59
+ size: "icon",
60
+ className: o("h-7 w-7", t.isActive("italic") && "bg-muted text-primary"),
61
+ onClick: () => t.chain().focus().toggleItalic().run(),
62
+ title: "Itálico (Ctrl+I)",
63
+ "aria-label": "Itálico",
64
+ children: /* @__PURE__ */ e(ae, { className: "h-3.5 w-3.5" })
65
+ }
66
+ ),
67
+ /* @__PURE__ */ e(
68
+ l,
69
+ {
70
+ variant: "ghost",
71
+ size: "icon",
72
+ className: o("h-7 w-7", t.isActive("underline") && "bg-muted text-primary"),
73
+ onClick: () => t.chain().focus().toggleUnderline().run(),
74
+ title: "Sublinhado (Ctrl+U)",
75
+ "aria-label": "Sublinhado",
76
+ children: /* @__PURE__ */ e(se, { className: "h-3.5 w-3.5" })
77
+ }
78
+ ),
79
+ /* @__PURE__ */ e(P, { orientation: "vertical", className: "h-4 mx-1" }),
80
+ /* @__PURE__ */ e(
81
+ l,
82
+ {
83
+ variant: "ghost",
84
+ size: "icon",
85
+ className: o("h-7 w-7", t.isActive("bulletList") && "bg-muted text-primary"),
86
+ onClick: () => t.chain().focus().toggleBulletList().run(),
87
+ "aria-label": "Lista com marcadores",
88
+ children: /* @__PURE__ */ e(ne, { className: "h-3.5 w-3.5" })
89
+ }
90
+ ),
91
+ /* @__PURE__ */ e(
92
+ l,
93
+ {
94
+ variant: "ghost",
95
+ size: "icon",
96
+ className: o("h-7 w-7", t.isActive("orderedList") && "bg-muted text-primary"),
97
+ onClick: () => t.chain().focus().toggleOrderedList().run(),
98
+ "aria-label": "Lista numerada",
99
+ children: /* @__PURE__ */ e(oe, { className: "h-3.5 w-3.5" })
100
+ }
101
+ ),
102
+ /* @__PURE__ */ e(
103
+ l,
104
+ {
105
+ variant: "ghost",
106
+ size: "icon",
107
+ className: o("h-7 w-7", t.isActive("taskList") && "bg-muted text-primary"),
108
+ onClick: () => t.chain().focus().toggleTaskList().run(),
109
+ title: "Lista de tarefas",
110
+ "aria-label": "Lista de tarefas",
111
+ children: /* @__PURE__ */ e(le, { className: "h-3.5 w-3.5" })
112
+ }
113
+ ),
114
+ /* @__PURE__ */ e(P, { orientation: "vertical", className: "h-4 mx-1" }),
115
+ /* @__PURE__ */ e(
116
+ l,
117
+ {
118
+ variant: "ghost",
119
+ size: "icon",
120
+ className: o("h-7 w-7", t.isActive("highlight") && "bg-muted text-primary"),
121
+ onClick: () => t.chain().focus().toggleHighlight().run(),
122
+ title: "Marca-texto",
123
+ "aria-label": "Marca-texto",
124
+ children: /* @__PURE__ */ e(ce, { className: "h-3.5 w-3.5" })
125
+ }
126
+ ),
127
+ m.table && /* @__PURE__ */ e(
128
+ l,
129
+ {
130
+ variant: "ghost",
131
+ size: "icon",
132
+ className: o("h-7 w-7", t.isActive("table") && "bg-muted text-primary"),
133
+ onClick: () => t.chain().focus().insertTable({ rows: 3, cols: 3, withHeaderRow: !0 }).run(),
134
+ title: "Inserir tabela 3x3",
135
+ "aria-label": "Inserir tabela",
136
+ children: /* @__PURE__ */ e(de, { className: "h-3.5 w-3.5" })
137
+ }
138
+ ),
139
+ m.details && /* @__PURE__ */ e(
140
+ l,
141
+ {
142
+ variant: "ghost",
143
+ size: "icon",
144
+ className: o("h-7 w-7", t.isActive("details") && "bg-muted text-primary"),
145
+ onClick: () => t.chain().focus().setDetails().run(),
146
+ title: "Bloco recolhivel",
147
+ "aria-label": "Bloco recolhivel",
148
+ children: /* @__PURE__ */ e(me, { className: "h-3.5 w-3.5" })
149
+ }
150
+ ),
151
+ /* @__PURE__ */ e(
152
+ l,
153
+ {
154
+ variant: "ghost",
155
+ size: "icon",
156
+ className: o("h-7 w-7", t.isActive("link") && "bg-muted text-primary"),
157
+ "aria-label": "Inserir link",
158
+ onClick: () => {
159
+ const n = t.getAttributes("link").href, u = window.prompt("URL", n);
160
+ if (u !== null) {
161
+ if (u === "") {
162
+ t.chain().focus().extendMarkRange("link").unsetLink().run();
163
+ return;
164
+ }
165
+ t.chain().focus().extendMarkRange("link").setLink({ href: u }).run();
166
+ }
167
+ },
168
+ children: /* @__PURE__ */ e(he, { className: "h-3.5 w-3.5" })
169
+ }
170
+ )
171
+ ] }), Ue = ({
172
+ currentUser: t,
173
+ onSubmit: h,
174
+ users: m = [],
175
+ maxLength: n,
176
+ placeholder: u = "Escreva um comentario... use @ para mencionar",
177
+ onImageUpload: b,
178
+ features: s = {},
179
+ extensions: w
180
+ }) => {
181
+ const [x, y] = v.useState(!1), [N, k] = v.useState(!1), [f, g] = v.useState([]), [K, M] = v.useState(!0), H = v.useRef(null), A = v.useCallback(
182
+ async (r, a, c) => {
183
+ for (const p of a) {
184
+ const C = b ? await b(p) : URL.createObjectURL(p);
185
+ r.chain().insertContentAt(c ?? r.state.selection.anchor, { type: "image", attrs: { src: C } }).focus().run();
186
+ }
187
+ },
188
+ [b]
189
+ ), $ = v.useMemo(() => [
190
+ pe.configure({
191
+ link: !1,
192
+ underline: !1
193
+ }),
194
+ be,
195
+ ve.configure({
196
+ openOnClick: !1
197
+ }),
198
+ xe,
199
+ Ne.configure({
200
+ HTMLAttributes: {
201
+ class: "bg-secondary text-secondary-foreground rounded-sm px-1 py-0.5 font-medium decoration-clone"
202
+ },
203
+ suggestion: {
204
+ items: ({ query: r }) => m.filter((a) => a.name.toLowerCase().startsWith(r.toLowerCase())).slice(0, 5),
205
+ render: () => {
206
+ let r = null, a = null;
207
+ return {
208
+ onStart: (c) => {
209
+ r = new ue(Me, {
210
+ props: c,
211
+ editor: c.editor
212
+ }), c.clientRect && (a = Ie("body", {
213
+ // tiptap tipa como `() => DOMRect | null`; tippy exige não-nulo.
214
+ getReferenceClientRect: c.clientRect,
215
+ appendTo: () => document.body,
216
+ content: r.element,
217
+ showOnCreate: !0,
218
+ interactive: !0,
219
+ trigger: "manual",
220
+ placement: "bottom-start"
221
+ }));
222
+ },
223
+ onUpdate(c) {
224
+ r == null || r.updateProps(c), c.clientRect && (a == null || a[0].setProps({
225
+ getReferenceClientRect: c.clientRect
226
+ }));
227
+ },
228
+ onKeyDown(c) {
229
+ var p, C;
230
+ return c.event.key === "Escape" ? (a == null || a[0].hide(), !0) : !!((C = (p = r == null ? void 0 : r.ref) == null ? void 0 : p.onKeyDown) != null && C.call(p, c));
231
+ },
232
+ onExit() {
233
+ a == null || a[0].destroy(), r == null || r.destroy();
234
+ }
235
+ };
236
+ }
237
+ }
238
+ }),
239
+ we,
240
+ ye.configure({
241
+ nested: !0,
242
+ // Sem isso o checkbox nasce sem nome acessivel: o <label> que o tiptap
243
+ // gera envolve o input mas nao tem texto. Violacao critica no axe.
244
+ a11y: {
245
+ checkboxLabel: (r, a) => `${a ? "Concluido" : "Pendente"}: ${r.textContent || "tarefa vazia"}`
246
+ }
247
+ }),
248
+ ke,
249
+ Ae,
250
+ Le.configure({ placeholder: u }),
251
+ ...n ? [Re.configure({ limit: n })] : [],
252
+ Ce.configure({
253
+ allowedMimeTypes: ["image/png", "image/jpeg", "image/gif", "image/webp"],
254
+ onDrop: (r, a, c) => {
255
+ A(r, a, c);
256
+ },
257
+ onPaste: (r, a) => {
258
+ A(r, a);
259
+ }
260
+ }),
261
+ ...s.table ? [Te.configure({ table: { resizable: !0 } })] : [],
262
+ ...s.details ? [je, ze, Se] : [],
263
+ ...w ?? []
264
+ ], [m, n, u, A, s.table, s.details, w]), d = ge({
265
+ extensions: $,
266
+ content: "",
267
+ onUpdate: ({ editor: r }) => {
268
+ M(r.isEmpty);
269
+ },
270
+ editorProps: {
271
+ attributes: {
272
+ class: "prose prose-sm dark:prose-invert max-w-none focus:outline-none min-h-[80px] px-3 py-2 text-sm"
273
+ }
274
+ }
275
+ }), F = (r) => {
276
+ if (r.target.files && r.target.files[0]) {
277
+ const a = r.target.files[0], c = URL.createObjectURL(a), p = {
278
+ id: Math.random().toString(36).substr(2, 9),
279
+ name: a.name,
280
+ url: c,
281
+ type: a.type.startsWith("image/") ? "image" : "file"
282
+ };
283
+ g([...f, p]), r.target.value = "";
284
+ }
285
+ }, W = (r) => {
286
+ g(f.filter((a) => a.id !== r));
287
+ }, G = () => {
288
+ !d || d.isEmpty && f.length === 0 || (h({
289
+ content: d.getHTML(),
290
+ isRevisionRequest: x,
291
+ attachments: f
292
+ }), d.commands.clearContent(), g([]), y(!1), M(!0));
293
+ };
294
+ return /* @__PURE__ */ i("div", { className: "flex gap-3 items-start", children: [
295
+ /* @__PURE__ */ i(U, { className: "h-8 w-8 mt-1 border", children: [
296
+ /* @__PURE__ */ e(B, { src: t.avatar }),
297
+ /* @__PURE__ */ e(D, { children: t.name.substring(0, 2).toUpperCase() })
298
+ ] }),
299
+ /* @__PURE__ */ i("div", { className: o(
300
+ "flex-1 rounded-xl border bg-background shadow-sm overflow-hidden transition-colors",
301
+ x && "border-destructive/40 ring-1 ring-destructive/20"
302
+ ), children: [
303
+ /* @__PURE__ */ e(Pe, { editor: d, visible: N, features: s }),
304
+ s.dragHandle && /* @__PURE__ */ e(Ee, { editor: d, children: /* @__PURE__ */ e(Z, { className: "text-muted-foreground h-4 w-4 cursor-grab" }) }),
305
+ /* @__PURE__ */ e(fe, { editor: d }),
306
+ f.length > 0 && /* @__PURE__ */ e("div", { className: "px-3 pb-2 flex flex-wrap gap-2", children: f.map((r) => /* @__PURE__ */ i("div", { className: "relative group", children: [
307
+ r.type === "image" ? /* @__PURE__ */ e("div", { className: "h-16 w-16 rounded-md border overflow-hidden relative", children: /* @__PURE__ */ e("img", { src: r.url, alt: r.name, className: "h-full w-full object-cover" }) }) : /* @__PURE__ */ e("div", { className: "h-16 w-16 rounded-md border bg-muted flex items-center justify-center", children: /* @__PURE__ */ e(j, { className: "h-6 w-6 text-muted-foreground" }) }),
308
+ /* @__PURE__ */ e(
309
+ "button",
310
+ {
311
+ onClick: () => W(r.id),
312
+ className: "absolute -top-1.5 -right-1.5 border bg-background text-destructive-emphasis hover:bg-destructive/10 rounded-full p-0.5 opacity-100 md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100 transition-opacity shadow-sm",
313
+ children: /* @__PURE__ */ e(ee, { className: "h-3 w-3" })
314
+ }
315
+ )
316
+ ] }, r.id)) }),
317
+ /* @__PURE__ */ i("div", { className: "flex items-center justify-between p-2 bg-muted/10 border-t", children: [
318
+ /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
319
+ /* @__PURE__ */ i(L, { children: [
320
+ /* @__PURE__ */ e(R, { asChild: !0, children: /* @__PURE__ */ e(
321
+ l,
322
+ {
323
+ variant: "ghost",
324
+ size: "icon",
325
+ className: o(
326
+ "h-8 w-8 transition-colors",
327
+ N ? "bg-muted text-foreground" : "text-muted-foreground hover:text-foreground"
328
+ ),
329
+ onClick: () => k(!N),
330
+ "aria-label": "Opções de formatação",
331
+ children: /* @__PURE__ */ e(te, { className: "h-4 w-4" })
332
+ }
333
+ ) }),
334
+ /* @__PURE__ */ e(T, { children: "Opções de formatação" })
335
+ ] }),
336
+ /* @__PURE__ */ e("div", { className: "w-px h-4 bg-border mx-1" }),
337
+ /* @__PURE__ */ i(S, { children: [
338
+ /* @__PURE__ */ e(E, { asChild: !0, children: /* @__PURE__ */ e(
339
+ l,
340
+ {
341
+ variant: "ghost",
342
+ size: "icon",
343
+ className: "h-8 w-8 text-muted-foreground hover:text-foreground",
344
+ "aria-label": "Inserir emoji",
345
+ children: /* @__PURE__ */ e(q, { className: "h-4 w-4" })
346
+ }
347
+ ) }),
348
+ /* @__PURE__ */ e(I, { className: "w-auto p-0 border-none", align: "start", side: "top", children: /* @__PURE__ */ e(
349
+ z,
350
+ {
351
+ onEmojiClick: (r) => d == null ? void 0 : d.chain().focus().insertContent(r.emoji).run(),
352
+ width: 300,
353
+ height: 350
354
+ }
355
+ ) })
356
+ ] }),
357
+ /* @__PURE__ */ e(
358
+ "input",
359
+ {
360
+ type: "file",
361
+ className: "hidden",
362
+ ref: H,
363
+ onChange: F,
364
+ accept: "image/*,.pdf,.doc,.docx"
365
+ }
366
+ ),
367
+ /* @__PURE__ */ i(L, { children: [
368
+ /* @__PURE__ */ e(R, { asChild: !0, children: /* @__PURE__ */ e(
369
+ l,
370
+ {
371
+ variant: "ghost",
372
+ size: "icon",
373
+ className: "h-8 w-8 text-muted-foreground hover:text-foreground",
374
+ onClick: () => {
375
+ var r;
376
+ return (r = H.current) == null ? void 0 : r.click();
377
+ },
378
+ "aria-label": "Anexar arquivo",
379
+ children: /* @__PURE__ */ e(j, { className: "h-4 w-4" })
380
+ }
381
+ ) }),
382
+ /* @__PURE__ */ e(T, { children: "Anexar arquivo" })
383
+ ] }),
384
+ /* @__PURE__ */ i(L, { children: [
385
+ /* @__PURE__ */ e(R, { asChild: !0, children: /* @__PURE__ */ i(
386
+ l,
387
+ {
388
+ variant: "ghost",
389
+ size: "sm",
390
+ className: o(
391
+ "h-8 gap-2 px-2 transition-colors",
392
+ x ? "bg-destructive/10 text-destructive-emphasis hover:bg-destructive/20" : "text-muted-foreground hover:text-foreground"
393
+ ),
394
+ onClick: () => y(!x),
395
+ children: [
396
+ /* @__PURE__ */ e(_, { className: "h-4 w-4" }),
397
+ /* @__PURE__ */ e("span", { className: "text-xs font-medium", children: "Solicitar Refação" })
398
+ ]
399
+ }
400
+ ) }),
401
+ /* @__PURE__ */ e(T, { children: "Marca este comentário como um pedido de alteração" })
402
+ ] })
403
+ ] }),
404
+ /* @__PURE__ */ i("div", { className: "flex items-center gap-3", children: [
405
+ n && d && /* @__PURE__ */ i(
406
+ "span",
407
+ {
408
+ className: o(
409
+ "text-xs tabular-nums",
410
+ d.storage.characterCount.characters() >= n ? "text-destructive" : "text-muted-foreground"
411
+ ),
412
+ "aria-live": "polite",
413
+ children: [
414
+ d.storage.characterCount.characters(),
415
+ "/",
416
+ n
417
+ ]
418
+ }
419
+ ),
420
+ /* @__PURE__ */ i(
421
+ l,
422
+ {
423
+ size: "sm",
424
+ onClick: G,
425
+ disabled: K && f.length === 0,
426
+ children: [
427
+ "Enviar ",
428
+ /* @__PURE__ */ e(re, { className: "h-3.5 w-3.5 ml-2" })
429
+ ]
430
+ }
431
+ )
432
+ ] })
433
+ ] })
434
+ ] })
435
+ ] });
436
+ }, Be = ({
437
+ comment: t,
438
+ currentUserId: h,
439
+ onDelete: m,
440
+ onReact: n
441
+ }) => {
442
+ var b;
443
+ const u = t.isRevisionRequest;
444
+ return /* @__PURE__ */ i("div", { className: o(
445
+ "group flex gap-3 p-4 rounded-lg transition-colors",
446
+ u ? "bg-destructive/5 border border-destructive/20" : "hover:bg-muted/20"
447
+ ), children: [
448
+ /* @__PURE__ */ i(U, { className: "h-8 w-8 mt-0.5 border", children: [
449
+ /* @__PURE__ */ e(B, { src: t.user.avatar }),
450
+ /* @__PURE__ */ e(D, { children: t.user.name.substring(0, 2).toUpperCase() })
451
+ ] }),
452
+ /* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
453
+ /* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-1.5", children: [
454
+ /* @__PURE__ */ i("div", { className: "flex items-center gap-2 flex-wrap", children: [
455
+ /* @__PURE__ */ e("span", { className: "font-semibold text-sm text-foreground", children: t.user.name }),
456
+ /* @__PURE__ */ e(He, { role: t.user.role }),
457
+ /* @__PURE__ */ e("span", { className: "text-xs text-foreground/65", children: V(t.createdAt, "dd MMM 'às' HH:mm", { locale: X }) })
458
+ ] }),
459
+ /* @__PURE__ */ i("div", { className: "flex items-center gap-2 opacity-100 md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100 transition-opacity has-[[data-state=open]]:opacity-100", children: [
460
+ /* @__PURE__ */ i(S, { children: [
461
+ /* @__PURE__ */ e(E, { asChild: !0, children: /* @__PURE__ */ e(
462
+ l,
463
+ {
464
+ variant: "ghost",
465
+ size: "icon",
466
+ className: "h-6 w-6 relative before:absolute before:-inset-1 before:content-[''] text-muted-foreground hover:text-foreground",
467
+ "aria-label": "Reagir com emoji",
468
+ children: /* @__PURE__ */ e(q, { className: "h-3.5 w-3.5", "aria-hidden": "true" })
469
+ }
470
+ ) }),
471
+ /* @__PURE__ */ e(I, { className: "w-auto p-0 border-none", align: "end", children: /* @__PURE__ */ e(
472
+ z,
473
+ {
474
+ onEmojiClick: (s) => n == null ? void 0 : n(t.id, s.emoji),
475
+ width: 300,
476
+ height: 350
477
+ }
478
+ ) })
479
+ ] }),
480
+ m && /* @__PURE__ */ e(
481
+ l,
482
+ {
483
+ variant: "ghost",
484
+ size: "icon",
485
+ className: "h-6 w-6 relative before:absolute before:-inset-1 before:content-[''] text-muted-foreground hover:text-destructive-emphasis",
486
+ onClick: () => m(t.id),
487
+ "aria-label": "Excluir comentário",
488
+ children: /* @__PURE__ */ e(Q, { className: "h-3.5 w-3.5", "aria-hidden": "true" })
489
+ }
490
+ )
491
+ ] })
492
+ ] }),
493
+ u && /* @__PURE__ */ i("div", { className: "inline-flex items-center gap-1.5 px-2 py-1 rounded-md bg-destructive/10 text-destructive-emphasis text-xs font-medium mb-2", children: [
494
+ /* @__PURE__ */ e(_, { className: "h-3.5 w-3.5" }),
495
+ "Solicitação de Refação"
496
+ ] }),
497
+ /* @__PURE__ */ e(
498
+ "div",
499
+ {
500
+ className: "prose prose-sm dark:prose-invert max-w-none text-sm text-foreground/90 leading-relaxed break-words [&_p]:mb-2 [&_p:last-child]:mb-0",
501
+ dangerouslySetInnerHTML: { __html: t.content }
502
+ }
503
+ ),
504
+ t.attachments && t.attachments.length > 0 && /* @__PURE__ */ e("div", { className: "mt-3 flex flex-wrap gap-2", children: t.attachments.map((s) => /* @__PURE__ */ e(
505
+ "div",
506
+ {
507
+ className: "group/att relative rounded-lg border overflow-hidden bg-background hover:shadow-sm transition-all cursor-pointer",
508
+ onClick: () => window.open(s.url, "_blank"),
509
+ children: s.type === "image" ? /* @__PURE__ */ i("div", { className: "h-32 aspect-[4/3]", children: [
510
+ /* @__PURE__ */ e("img", { src: s.url, alt: s.name, className: "h-full w-full object-cover" }),
511
+ /* @__PURE__ */ e("div", { className: "absolute inset-0 bg-foreground/0 group-hover/att:bg-foreground/10 transition-colors" })
512
+ ] }) : /* @__PURE__ */ i("div", { className: "h-12 px-3 flex items-center gap-2 bg-muted/30", children: [
513
+ /* @__PURE__ */ e(j, { className: "h-4 w-4 text-muted-foreground" }),
514
+ /* @__PURE__ */ e("span", { className: "text-xs font-medium truncate max-w-[150px]", children: s.name })
515
+ ] })
516
+ },
517
+ s.id
518
+ )) }),
519
+ /* @__PURE__ */ i("div", { className: "mt-3 flex flex-wrap gap-2 items-center", children: [
520
+ (b = t.reactions) == null ? void 0 : b.map((s) => /* @__PURE__ */ i(
521
+ "button",
522
+ {
523
+ onClick: () => n == null ? void 0 : n(t.id, s.emoji),
524
+ className: o(
525
+ "inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium border transition-colors",
526
+ s.users.includes(h) ? "bg-secondary border-secondary text-secondary-foreground" : "bg-muted/30 border-transparent hover:bg-muted/50 text-muted-foreground"
527
+ ),
528
+ children: [
529
+ /* @__PURE__ */ e("span", { children: s.emoji }),
530
+ /* @__PURE__ */ e("span", { children: s.users.length })
531
+ ]
532
+ },
533
+ s.emoji
534
+ )),
535
+ n && /* @__PURE__ */ i(S, { children: [
536
+ /* @__PURE__ */ e(E, { asChild: !0, children: /* @__PURE__ */ e(
537
+ l,
538
+ {
539
+ variant: "ghost",
540
+ size: "icon",
541
+ className: "h-6 w-6 rounded-full text-muted-foreground hover:text-foreground hover:bg-muted/50",
542
+ "aria-label": "Adicionar reação",
543
+ children: /* @__PURE__ */ e(Y, { className: "h-3.5 w-3.5" })
544
+ }
545
+ ) }),
546
+ /* @__PURE__ */ e(I, { className: "w-auto p-0 border-none", align: "start", children: /* @__PURE__ */ e(
547
+ z,
548
+ {
549
+ onEmojiClick: (s) => n(t.id, s.emoji),
550
+ width: 300,
551
+ height: 350
552
+ }
553
+ ) })
554
+ ] })
555
+ ] })
556
+ ] })
557
+ ] });
558
+ }, gt = ({
559
+ comments: t,
560
+ currentUser: h,
561
+ users: m = [],
562
+ onAddComment: n,
563
+ onDeleteComment: u,
564
+ onReact: b,
565
+ maxLength: s,
566
+ placeholder: w,
567
+ onImageUpload: x,
568
+ features: y,
569
+ extensions: N,
570
+ className: k
571
+ }) => {
572
+ const f = (g) => {
573
+ n({
574
+ content: g.content,
575
+ user: h,
576
+ isRevisionRequest: g.isRevisionRequest,
577
+ attachments: g.attachments
578
+ });
579
+ };
580
+ return /* @__PURE__ */ i("div", { className: o("flex flex-col h-full", k), children: [
581
+ /* @__PURE__ */ i("div", { className: "px-4 py-3 border-b flex items-center justify-between bg-card", children: [
582
+ /* @__PURE__ */ e("h3", { className: "font-semibold text-base", children: "Comentários da Atividade" }),
583
+ /* @__PURE__ */ e(O, { variant: "secondary", className: "bg-muted text-muted-foreground hover:bg-muted", children: t.length })
584
+ ] }),
585
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4 space-y-2 bg-muted/5", children: t.length === 0 ? /* @__PURE__ */ i("div", { className: "h-full flex flex-col items-center justify-center text-muted-foreground min-h-[200px]", children: [
586
+ /* @__PURE__ */ e("div", { className: "bg-muted rounded-full p-3 mb-3", children: /* @__PURE__ */ e(J, { className: "h-6 w-6", "aria-hidden": "true" }) }),
587
+ /* @__PURE__ */ e("p", { className: "text-sm font-medium text-foreground/70", children: "Nenhum comentário ainda" }),
588
+ /* @__PURE__ */ e("p", { className: "text-xs", children: "Inicie a conversa sobre esta tarefa" })
589
+ ] }) : t.map((g) => /* @__PURE__ */ e(
590
+ Be,
591
+ {
592
+ comment: g,
593
+ currentUserId: h.id,
594
+ onDelete: u,
595
+ onReact: b
596
+ },
597
+ g.id
598
+ )) }),
599
+ /* @__PURE__ */ e("div", { className: "p-4 border-t bg-card", children: /* @__PURE__ */ e(
600
+ Ue,
601
+ {
602
+ currentUser: h,
603
+ onSubmit: f,
604
+ users: m,
605
+ maxLength: s,
606
+ placeholder: w,
607
+ onImageUpload: x,
608
+ features: y,
609
+ extensions: N
610
+ }
611
+ ) })
612
+ ] });
613
+ };
614
+ export {
615
+ gt as CommentThread
616
+ };
617
+ //# sourceMappingURL=comment-thread.js.map