@jcdecor/vue 0.1.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 (107) hide show
  1. package/README.md +68 -0
  2. package/dist/brand/Brand.d.ts +83 -0
  3. package/dist/brand/index.d.ts +2 -0
  4. package/dist/brand/paths.d.ts +43 -0
  5. package/dist/brand-CeSffe5P.js +320 -0
  6. package/dist/brand-CeSffe5P.js.map +1 -0
  7. package/dist/brand.d.ts +1 -0
  8. package/dist/brand.js +2 -0
  9. package/dist/charts/ChartCard.d.ts +32 -0
  10. package/dist/charts/charts.d.ts +124 -0
  11. package/dist/charts/echartsTheme.d.ts +19 -0
  12. package/dist/charts/index.d.ts +8 -0
  13. package/dist/charts/palette.d.ts +59 -0
  14. package/dist/charts.d.ts +1 -0
  15. package/dist/charts.js +473 -0
  16. package/dist/charts.js.map +1 -0
  17. package/dist/chat/ChatComposer.d.ts +34 -0
  18. package/dist/chat/ChatLayout.d.ts +53 -0
  19. package/dist/chat/ChatMessage.d.ts +26 -0
  20. package/dist/chat/ChatThread.d.ts +36 -0
  21. package/dist/chat/ConversationList.d.ts +22 -0
  22. package/dist/chat/TypingIndicator.d.ts +8 -0
  23. package/dist/chat/index.d.ts +9 -0
  24. package/dist/chat/node.d.ts +12 -0
  25. package/dist/chat/types.d.ts +38 -0
  26. package/dist/chat/utils.d.ts +25 -0
  27. package/dist/chat.d.ts +1 -0
  28. package/dist/chat.js +661 -0
  29. package/dist/chat.js.map +1 -0
  30. package/dist/colors-DUSEhAuo.js +32 -0
  31. package/dist/colors-DUSEhAuo.js.map +1 -0
  32. package/dist/components/ContentCard/ContentCard.d.ts +8 -0
  33. package/dist/components/ContentCard/ContentCard.types.d.ts +34 -0
  34. package/dist/components/ContentCard/ContentCard.vue.d.ts +35 -0
  35. package/dist/components/ContentCard/index.d.ts +1 -0
  36. package/dist/components/CouponCode/CouponCode.d.ts +20 -0
  37. package/dist/components/CouponCode/index.d.ts +1 -0
  38. package/dist/components/DataTable/DataTable.d.ts +95 -0
  39. package/dist/components/DataTable/index.d.ts +1 -0
  40. package/dist/components/KpiCard/KpiCard.d.ts +12 -0
  41. package/dist/components/KpiCard/KpiCard.types.d.ts +44 -0
  42. package/dist/components/KpiCard/KpiCard.vars.d.ts +3 -0
  43. package/dist/components/KpiCard/KpiCard.vue.d.ts +42 -0
  44. package/dist/components/KpiCard/KpiGroup.d.ts +10 -0
  45. package/dist/components/KpiCard/index.d.ts +1 -0
  46. package/dist/components/PageHeader/PageHeader.d.ts +29 -0
  47. package/dist/components/PageHeader/index.d.ts +1 -0
  48. package/dist/components/PriceTag/PriceTag.d.ts +21 -0
  49. package/dist/components/PriceTag/index.d.ts +1 -0
  50. package/dist/components/ProductCard/ProductCard.d.ts +12 -0
  51. package/dist/components/ProductCard/ProductCard.types.d.ts +53 -0
  52. package/dist/components/ProductCard/ProductCard.vue.d.ts +45 -0
  53. package/dist/components/ProductCard/index.d.ts +1 -0
  54. package/dist/components/PromoBanner/PromoBanner.d.ts +12 -0
  55. package/dist/components/PromoBanner/PromoBanner.types.d.ts +50 -0
  56. package/dist/components/PromoBanner/PromoBanner.vars.d.ts +2 -0
  57. package/dist/components/PromoBanner/PromoBanner.vue.d.ts +41 -0
  58. package/dist/components/PromoBanner/index.d.ts +1 -0
  59. package/dist/components/Tag/Tag.d.ts +18 -0
  60. package/dist/components/Tag/index.d.ts +1 -0
  61. package/dist/components/ThemeToggle/ThemeToggle.d.ts +10 -0
  62. package/dist/components/ThemeToggle/index.d.ts +1 -0
  63. package/dist/components/TokenSwatch/TokenSwatch.d.ts +21 -0
  64. package/dist/components/TokenSwatch/index.d.ts +1 -0
  65. package/dist/components/TopNav/TopNav.d.ts +9 -0
  66. package/dist/components/TopNav/TopNav.types.d.ts +50 -0
  67. package/dist/components/TopNav/TopNav.vue.d.ts +33 -0
  68. package/dist/components/TopNav/index.d.ts +1 -0
  69. package/dist/components/Typography/Typography.d.ts +41 -0
  70. package/dist/components/Typography/index.d.ts +1 -0
  71. package/dist/components/index.d.ts +13 -0
  72. package/dist/format-D40SMATK.js +108 -0
  73. package/dist/format-D40SMATK.js.map +1 -0
  74. package/dist/index.d.ts +15 -0
  75. package/dist/index.js +2239 -0
  76. package/dist/index.js.map +1 -0
  77. package/dist/provider/JcProvider.d.ts +285 -0
  78. package/dist/styles.css +2 -0
  79. package/dist/theme/colors.d.ts +26 -0
  80. package/dist/theme/components/buttons.d.ts +2 -0
  81. package/dist/theme/components/combobox.d.ts +2 -0
  82. package/dist/theme/components/dataDisplay.d.ts +2 -0
  83. package/dist/theme/components/feedback.d.ts +2 -0
  84. package/dist/theme/components/index.d.ts +3 -0
  85. package/dist/theme/components/inputs.d.ts +2 -0
  86. package/dist/theme/components/layout.d.ts +2 -0
  87. package/dist/theme/components/misc.d.ts +2 -0
  88. package/dist/theme/components/navigation.d.ts +2 -0
  89. package/dist/theme/components/overlays.d.ts +2 -0
  90. package/dist/theme/components/types.d.ts +11 -0
  91. package/dist/theme/components/typography.d.ts +2 -0
  92. package/dist/theme/controls.d.ts +44 -0
  93. package/dist/theme/cssVariablesResolver.d.ts +2 -0
  94. package/dist/theme/theme.d.ts +3 -0
  95. package/dist/theme/themeDefaults.d.ts +18 -0
  96. package/dist/theme/tokens.d.ts +457 -0
  97. package/dist/theme/variantColorResolver.d.ts +9 -0
  98. package/dist/themeDefaults-Ckd05FUY.js +29 -0
  99. package/dist/themeDefaults-Ckd05FUY.js.map +1 -0
  100. package/dist/tokens-CDSk_JkY.js +315 -0
  101. package/dist/tokens-CDSk_JkY.js.map +1 -0
  102. package/dist/tokens.d.ts +2 -0
  103. package/dist/tokens.js +3 -0
  104. package/dist/utils/format.d.ts +14 -0
  105. package/dist/utils/styles-api.d.ts +15 -0
  106. package/dist/utils/vue.d.ts +27 -0
  107. package/package.json +109 -0
package/dist/chat.js ADDED
@@ -0,0 +1,661 @@
1
+ import { d as e } from "./themeDefaults-Ckd05FUY.js";
2
+ import { ActionIcon as t, Avatar as n, Badge as r, Box as i, FileButton as a, Indicator as o, Loader as s, Pill as c, ScrollArea as l, TextInput as u, Textarea as d, resolveNode as f } from "@mantine-vue/core";
3
+ import { Comment as p, Fragment as m, Text as h, computed as g, defineComponent as _, h as v, isVNode as y, onBeforeUnmount as b, onMounted as x, ref as S, watch as C } from "vue";
4
+ import { IconAlertCircle as w, IconArrowLeft as T, IconCheck as E, IconChecks as D, IconFile as O, IconPaperclip as k, IconSearch as A, IconSend2 as j } from "@tabler/icons-vue";
5
+ import { useUncontrolled as M } from "@mantine-vue/hooks";
6
+ //#region src/chat/utils.ts
7
+ var N = 864e5;
8
+ function P(e) {
9
+ return e instanceof Date ? e : new Date(e);
10
+ }
11
+ function F(e) {
12
+ return new Date(e.getFullYear(), e.getMonth(), e.getDate()).getTime();
13
+ }
14
+ function I(e, t = /* @__PURE__ */ new Date()) {
15
+ let n = P(e), r = Math.round((F(t) - F(n)) / N);
16
+ return r === 0 ? "Hoje" : r === 1 ? "Ontem" : r > 1 && r < 7 ? new Intl.DateTimeFormat("pt-BR", { weekday: "long" }).format(n) : new Intl.DateTimeFormat("pt-BR", {
17
+ day: "numeric",
18
+ month: "short",
19
+ year: "numeric"
20
+ }).format(n);
21
+ }
22
+ function L(e, t = /* @__PURE__ */ new Date()) {
23
+ let n = P(e), r = Math.round((F(t) - F(n)) / N);
24
+ return r === 0 ? new Intl.DateTimeFormat("pt-BR", {
25
+ hour: "2-digit",
26
+ minute: "2-digit"
27
+ }).format(n) : r === 1 ? "Ontem" : new Intl.DateTimeFormat("pt-BR", {
28
+ day: "2-digit",
29
+ month: "2-digit"
30
+ }).format(n);
31
+ }
32
+ function R(e, t = 3e5, n = /* @__PURE__ */ new Date()) {
33
+ let r = [], i = null;
34
+ return e.forEach((a, o) => {
35
+ let s = P(a.createdAt), c = F(s);
36
+ c !== i && (r.push({
37
+ type: "separator",
38
+ key: `sep-${c}`,
39
+ label: I(s, n)
40
+ }), i = c);
41
+ let l = e[o - 1], u = e[o + 1], d = !!l && !l.system && !a.system && l.authorId === a.authorId && F(P(l.createdAt)) === c && s.getTime() - P(l.createdAt).getTime() <= t, f = !!u && !u.system && !a.system && u.authorId === a.authorId && F(P(u.createdAt)) === c && P(u.createdAt).getTime() - s.getTime() <= t, p = d && f ? "middle" : d ? "last" : f ? "first" : "single";
42
+ r.push({
43
+ type: "message",
44
+ key: a.id,
45
+ message: a,
46
+ position: p
47
+ });
48
+ }), r;
49
+ }
50
+ function z(e) {
51
+ return e.replace(/[^\p{L}\s]/gu, " ").replace(/\s+/g, " ").trim() || e;
52
+ }
53
+ function B(e) {
54
+ return e < 1024 ? `${e} B` : e < 1048576 ? `${(e / 1024).toLocaleString("pt-BR", { maximumFractionDigits: 1 })} KB` : `${(e / 1024 / 1024).toLocaleString("pt-BR", { maximumFractionDigits: 1 })} MB`;
55
+ }
56
+ //#endregion
57
+ //#region src/chat/node.ts
58
+ var V = {
59
+ type: null,
60
+ default: void 0
61
+ };
62
+ function H(e) {
63
+ if (e == null || e === !1 || e === !0 || e === "") return !1;
64
+ if (Array.isArray(e)) return e.some((e) => H(e));
65
+ if (y(e)) {
66
+ if (e.type === p) return !1;
67
+ if (e.type === h) return e.children !== "" && e.children != null;
68
+ if (e.type === m) return H(e.children);
69
+ }
70
+ return !0;
71
+ }
72
+ var U = {
73
+ message: "jc-Chat-message-i3s00",
74
+ avatarSlot: "jc-Chat-avatarSlot-1bua4",
75
+ bubbleColumn: "jc-Chat-bubbleColumn-1sfy5",
76
+ author: "jc-Chat-author-1wgw6",
77
+ bubble: "jc-Chat-bubble-1wxm6",
78
+ meta: "jc-Chat-meta-1ec66",
79
+ status: "jc-Chat-status-5xpn1",
80
+ attachments: "jc-Chat-attachments-17uow",
81
+ imageAttachment: "jc-Chat-imageAttachment-dknbo",
82
+ fileAttachment: "jc-Chat-fileAttachment-1o6f0",
83
+ fileName: "jc-Chat-fileName-1niet",
84
+ fileSize: "jc-Chat-fileSize-1nii6",
85
+ system: "jc-Chat-system-60s3e",
86
+ thread: "jc-Chat-thread-68g9h",
87
+ separator: "jc-Chat-separator-1cqvs",
88
+ typing: "jc-Chat-typing-6hrkv",
89
+ dots: "jc-Chat-dots-1ec0n",
90
+ dot: "jc-Chat-dot-1ts3o",
91
+ "jc-typing": "jc-Chat-jc-typing-1v69c",
92
+ composer: "jc-Chat-composer-1prlw",
93
+ composerInput: "jc-Chat-composerInput-6e0s5",
94
+ composerFiles: "jc-Chat-composerFiles-6ca43",
95
+ conversations: "jc-Chat-conversations-1y7fv",
96
+ conversationSearch: "jc-Chat-conversationSearch-1etgc",
97
+ conversation: "jc-Chat-conversation-19ssj",
98
+ conversationBody: "jc-Chat-conversationBody-mt5sx",
99
+ conversationTop: "jc-Chat-conversationTop-1ob6a",
100
+ conversationName: "jc-Chat-conversationName-mtd6l",
101
+ conversationTime: "jc-Chat-conversationTime-mth6g",
102
+ conversationBottom: "jc-Chat-conversationBottom-16xiv",
103
+ conversationPreview: "jc-Chat-conversationPreview-19wdb",
104
+ header: "jc-Chat-header-hyjkd",
105
+ headerBody: "jc-Chat-headerBody-g69o0",
106
+ headerTitle: "jc-Chat-headerTitle-4gc2x",
107
+ headerSubtitle: "jc-Chat-headerSubtitle-1saun",
108
+ layoutContainer: "jc-Chat-layoutContainer-180vn",
109
+ layout: "jc-Chat-layout-2cdez",
110
+ layoutSidebar: "jc-Chat-layoutSidebar-d9247",
111
+ layoutMain: "jc-Chat-layoutMain-1o5ly",
112
+ layoutMessages: "jc-Chat-layoutMessages-18emg",
113
+ backButton: "jc-Chat-backButton-f08wz"
114
+ }, W = {
115
+ sending: "Enviando…",
116
+ sent: "Enviada",
117
+ delivered: "Entregue",
118
+ read: "Lida",
119
+ error: "Falha no envio"
120
+ };
121
+ function G(e) {
122
+ return e === "sending" ? v(s, {
123
+ size: 10,
124
+ color: "gray"
125
+ }) : e === "sent" ? v(E, { size: 14 }) : e === "error" ? v(w, {
126
+ size: 14,
127
+ color: "var(--ds-error)"
128
+ }) : v(D, { size: 14 });
129
+ }
130
+ var K = new Intl.DateTimeFormat("pt-BR", {
131
+ hour: "2-digit",
132
+ minute: "2-digit"
133
+ }), q = _({
134
+ name: "ChatMessage",
135
+ props: {
136
+ own: {
137
+ type: Boolean,
138
+ default: !1
139
+ },
140
+ author: {
141
+ type: Object,
142
+ default: void 0
143
+ },
144
+ showAuthor: {
145
+ type: Boolean,
146
+ default: !1
147
+ },
148
+ showAvatar: {
149
+ type: Boolean,
150
+ default: !0
151
+ },
152
+ createdAt: {
153
+ type: [
154
+ Date,
155
+ String,
156
+ Number
157
+ ],
158
+ default: void 0
159
+ },
160
+ status: {
161
+ type: String,
162
+ default: void 0
163
+ },
164
+ attachments: {
165
+ type: Array,
166
+ default: void 0
167
+ },
168
+ position: {
169
+ type: String,
170
+ default: "single"
171
+ },
172
+ system: {
173
+ type: Boolean,
174
+ default: !1
175
+ }
176
+ },
177
+ setup(t, { slots: r }) {
178
+ return () => {
179
+ let a = r.default?.();
180
+ if (t.system) return v(i, {
181
+ class: U.system,
182
+ role: "status"
183
+ }, () => a);
184
+ let { own: o, author: s, status: c, position: l, createdAt: u, attachments: d } = t, f = l === "single" || l === "last", p = l === "single" || l === "first", m = u ? K.format(P(u)) : null, h = o ? null : v("div", { class: U.avatarSlot }, t.showAvatar && f && s ? [v(n, {
185
+ src: s.avatar,
186
+ name: z(s.name),
187
+ color: s.color ?? "initials",
188
+ size: 32,
189
+ alt: s.name
190
+ })] : void 0), g = d && d.length > 0 ? v("div", { class: U.attachments }, d.map((e, t) => e.type === "image" && e.url ? v("a", {
191
+ key: t,
192
+ href: e.url,
193
+ target: "_blank",
194
+ rel: "noreferrer"
195
+ }, [v("img", {
196
+ class: U.imageAttachment,
197
+ src: e.url,
198
+ alt: e.name
199
+ })]) : v("a", {
200
+ key: t,
201
+ class: U.fileAttachment,
202
+ href: e.url,
203
+ target: "_blank",
204
+ rel: "noreferrer",
205
+ download: e.name
206
+ }, [
207
+ v(O, { size: 18 }),
208
+ v("span", { class: U.fileName }, e.name),
209
+ e.size === void 0 ? null : v("span", { class: U.fileSize }, B(e.size))
210
+ ]))) : null, _ = f && (m || o && c) ? v("div", {
211
+ class: U.meta,
212
+ "data-read": c === "read" || void 0
213
+ }, [m && u ? v("time", { datetime: P(u).toISOString() }, m) : null, o && c ? v(e, {
214
+ label: W[c],
215
+ withArrow: !0
216
+ }, () => v("span", {
217
+ class: U.status,
218
+ "aria-label": W[c],
219
+ style: { display: "inline-flex" }
220
+ }, [G(c)])) : null]) : null;
221
+ return v(i, {
222
+ class: U.message,
223
+ mod: {
224
+ own: o,
225
+ position: l,
226
+ status: c
227
+ }
228
+ }, () => [h, v("div", { class: U.bubbleColumn }, [
229
+ t.showAuthor && p && s && !o ? v("div", { class: U.author }, s.name) : null,
230
+ g,
231
+ H(a) ? v("div", { class: U.bubble }, a) : null,
232
+ _
233
+ ])]);
234
+ };
235
+ }
236
+ });
237
+ //#endregion
238
+ //#region src/chat/TypingIndicator.ts
239
+ function J(e) {
240
+ return e.length === 0 ? "" : e.length === 1 ? `${e[0]} está digitando…` : e.length === 2 ? `${e[0]} e ${e[1]} estão digitando…` : `${e[0]} e mais ${e.length - 1} estão digitando…`;
241
+ }
242
+ var Y = _({
243
+ name: "TypingIndicator",
244
+ props: { names: {
245
+ type: Array,
246
+ default: () => []
247
+ } },
248
+ setup(e) {
249
+ return () => {
250
+ let t = J(e.names);
251
+ return v(i, {
252
+ class: U.typing,
253
+ role: "status",
254
+ "aria-live": "polite",
255
+ "aria-label": t || "Digitando"
256
+ }, () => [v("span", {
257
+ class: U.dots,
258
+ "aria-hidden": "true"
259
+ }, [
260
+ v("span", { class: U.dot }),
261
+ v("span", { class: U.dot }),
262
+ v("span", { class: U.dot })
263
+ ]), t ? v("span", t) : null]);
264
+ };
265
+ }
266
+ }), X = 80, Z = _({
267
+ name: "ChatThread",
268
+ props: {
269
+ messages: {
270
+ type: Array,
271
+ required: !0
272
+ },
273
+ currentUserId: {
274
+ type: String,
275
+ required: !0
276
+ },
277
+ users: {
278
+ type: [Array, Object],
279
+ default: () => []
280
+ },
281
+ typing: {
282
+ type: Array,
283
+ default: void 0
284
+ },
285
+ showAuthors: {
286
+ type: Boolean,
287
+ default: !1
288
+ },
289
+ autoScroll: {
290
+ type: Boolean,
291
+ default: !0
292
+ },
293
+ groupWindow: {
294
+ type: Number,
295
+ default: void 0
296
+ },
297
+ empty: V,
298
+ renderContent: {
299
+ type: Function,
300
+ default: void 0
301
+ },
302
+ h: {
303
+ type: [String, Number],
304
+ default: "100%"
305
+ }
306
+ },
307
+ setup(e, { slots: t }) {
308
+ let n = null, r = null, a = !0, o = !1, s = null, c = g(() => Array.isArray(e.users) ? Object.fromEntries(e.users.map((e) => [e.id, e])) : e.users), u = g(() => R(e.messages, e.groupWindow));
309
+ function d() {
310
+ let t = n;
311
+ if (!t || !e.autoScroll) return;
312
+ let r = e.messages[e.messages.length - 1];
313
+ (a || r?.authorId === e.currentUserId) && t.scrollTo({
314
+ top: t.scrollHeight,
315
+ behavior: o ? "smooth" : "auto"
316
+ }), o = !0;
317
+ }
318
+ function f() {
319
+ s?.disconnect(), s = null;
320
+ let t = n;
321
+ t && r && e.autoScroll && typeof ResizeObserver < "u" && (s = new ResizeObserver(() => {
322
+ a && t.scrollTo({ top: t.scrollHeight });
323
+ }), s.observe(r));
324
+ }
325
+ x(() => {
326
+ d(), f();
327
+ }), C(() => [
328
+ e.messages.length,
329
+ e.messages[e.messages.length - 1]?.id,
330
+ e.typing?.length,
331
+ e.autoScroll,
332
+ e.currentUserId
333
+ ], d, { flush: "post" }), C(() => e.autoScroll, f, { flush: "post" }), b(() => s?.disconnect());
334
+ let p = { rootRef: (e) => {
335
+ n = e;
336
+ } }, m = (e) => {
337
+ r = e;
338
+ }, h = ({ y: e }) => {
339
+ let t = n;
340
+ t && (a = t.scrollHeight - t.clientHeight - e < X);
341
+ };
342
+ return () => {
343
+ let n = (n) => t.content ? t.content({ message: n }) : e.renderContent ? e.renderContent(n) : n.text, r = e.messages.length === 0 ? t.empty ? t.empty() : typeof e.empty == "function" ? e.empty() : e.empty : null, a = u.value.map((t) => {
344
+ if (t.type === "separator") return v("div", {
345
+ key: t.key,
346
+ class: U.separator,
347
+ role: "separator"
348
+ }, t.label);
349
+ let { message: r, position: i } = t, a = r.authorId === e.currentUserId, o = n(r);
350
+ return v(q, {
351
+ key: t.key,
352
+ own: a,
353
+ system: r.system,
354
+ author: c.value[r.authorId],
355
+ showAuthor: e.showAuthors,
356
+ createdAt: r.createdAt,
357
+ status: a ? r.status : void 0,
358
+ attachments: r.attachments,
359
+ position: i,
360
+ "data-group-start": i === "single" || i === "first" || void 0
361
+ }, { default: () => o });
362
+ });
363
+ return v(l, {
364
+ h: e.h,
365
+ viewportProps: p,
366
+ onScrollPositionChange: h
367
+ }, () => v(i, {
368
+ rootRef: m,
369
+ class: U.thread,
370
+ role: "log",
371
+ "aria-live": "polite",
372
+ "aria-relevant": "additions"
373
+ }, () => [
374
+ r,
375
+ ...a,
376
+ e.typing && e.typing.length > 0 ? v(Y, {
377
+ names: e.typing,
378
+ mt: "sm",
379
+ ml: 40
380
+ }) : null
381
+ ]));
382
+ };
383
+ }
384
+ }), Q = _({
385
+ name: "ChatComposer",
386
+ props: {
387
+ modelValue: {
388
+ type: String,
389
+ default: void 0
390
+ },
391
+ defaultValue: {
392
+ type: String,
393
+ default: void 0
394
+ },
395
+ placeholder: {
396
+ type: String,
397
+ default: "Digite uma mensagem…"
398
+ },
399
+ disabled: {
400
+ type: Boolean,
401
+ default: !1
402
+ },
403
+ allowAttachments: {
404
+ type: Boolean,
405
+ default: !1
406
+ },
407
+ accept: {
408
+ type: String,
409
+ default: void 0
410
+ },
411
+ maxRows: {
412
+ type: Number,
413
+ default: 5
414
+ },
415
+ leftSection: V,
416
+ sendLabel: {
417
+ type: String,
418
+ default: "Enviar"
419
+ }
420
+ },
421
+ emits: {
422
+ send: (e) => !0,
423
+ "update:modelValue": (e) => !0
424
+ },
425
+ setup(n, { emit: r, slots: o }) {
426
+ let [s, l] = M({
427
+ value: () => n.modelValue,
428
+ defaultValue: n.defaultValue,
429
+ finalValue: "",
430
+ onChange: (e) => r("update:modelValue", e)
431
+ }), u = S([]), p = g(() => !n.disabled && (s.value.trim().length > 0 || u.value.length > 0)), m = () => {
432
+ p.value && (r("send", {
433
+ text: s.value.trim(),
434
+ files: u.value
435
+ }), l(""), u.value = []);
436
+ }, h = (e) => {
437
+ e.key === "Enter" && !e.shiftKey && !e.isComposing && (e.preventDefault(), m());
438
+ }, _ = (e) => {
439
+ u.value = u.value.filter((t, n) => n !== e);
440
+ }, y = (e) => {
441
+ u.value = [...u.value, ...Array.isArray(e) ? e : e ? [e] : []];
442
+ };
443
+ return () => v(i, null, () => [u.value.length > 0 ? v("div", { class: U.composerFiles }, u.value.map((e, t) => v(c, {
444
+ key: `${e.name}-${t}`,
445
+ withRemoveButton: !0,
446
+ onRemove: () => _(t)
447
+ }, () => e.name))) : null, v("div", { class: U.composer }, [
448
+ f(n.leftSection, o.leftSection),
449
+ n.allowAttachments ? v(a, {
450
+ multiple: !0,
451
+ accept: n.accept,
452
+ disabled: n.disabled,
453
+ onChange: y
454
+ }, { default: (n) => v(e, { label: "Anexar arquivo" }, () => v(t, {
455
+ ...n,
456
+ size: "lg",
457
+ variant: "subtle",
458
+ "aria-label": "Anexar arquivo"
459
+ }, () => v(k, { size: 20 }))) }) : null,
460
+ v(d, {
461
+ class: U.composerInput,
462
+ modelValue: s.value,
463
+ "onUpdate:modelValue": (e) => l(e),
464
+ onKeydown: h,
465
+ placeholder: n.placeholder,
466
+ disabled: n.disabled,
467
+ autosize: !0,
468
+ minRows: 1,
469
+ maxRows: n.maxRows,
470
+ radius: "lg",
471
+ "aria-label": n.placeholder
472
+ }),
473
+ v(t, {
474
+ size: 44,
475
+ radius: "xl",
476
+ variant: "filled",
477
+ onClick: m,
478
+ disabled: !p.value,
479
+ "aria-label": n.sendLabel
480
+ }, () => v(j, { size: 20 }))
481
+ ])]);
482
+ }
483
+ }), ee = _({
484
+ name: "ConversationList",
485
+ props: {
486
+ conversations: {
487
+ type: Array,
488
+ required: !0
489
+ },
490
+ activeId: {
491
+ type: String,
492
+ default: void 0
493
+ },
494
+ searchable: {
495
+ type: Boolean,
496
+ default: !0
497
+ },
498
+ searchPlaceholder: {
499
+ type: String,
500
+ default: "Buscar conversas"
501
+ },
502
+ empty: V
503
+ },
504
+ emits: { select: (e) => !0 },
505
+ setup(e, { emit: t, slots: a }) {
506
+ let s = S(""), c = g(() => {
507
+ let t = s.value.trim().toLocaleLowerCase("pt-BR");
508
+ return t ? e.conversations.filter((e) => e.name.toLocaleLowerCase("pt-BR").includes(t) || e.lastMessage?.toLocaleLowerCase("pt-BR").includes(t)) : e.conversations;
509
+ }), d = (i) => {
510
+ let a = i.unread ?? 0, s = i.id === e.activeId;
511
+ return v("button", {
512
+ key: i.id,
513
+ type: "button",
514
+ role: "listitem",
515
+ class: U.conversation,
516
+ "data-active": s || void 0,
517
+ "data-unread": a > 0 || void 0,
518
+ "aria-current": s ? "true" : void 0,
519
+ onClick: () => t("select", i)
520
+ }, [v(o, {
521
+ color: "evergreen",
522
+ position: "bottom-end",
523
+ offset: 5,
524
+ size: 10,
525
+ withBorder: !0,
526
+ disabled: !i.online
527
+ }, () => v(n, {
528
+ src: i.avatar,
529
+ name: z(i.name),
530
+ color: i.color ?? "initials",
531
+ size: 40
532
+ })), v("div", { class: U.conversationBody }, [
533
+ v("div", { class: U.conversationTop }, [v("span", { class: U.conversationName }, i.name), i.lastMessageAt === void 0 ? null : v("span", { class: U.conversationTime }, L(i.lastMessageAt))]),
534
+ v("div", { class: U.conversationBottom }, [v("span", { class: U.conversationPreview }, i.lastMessage), a > 0 ? v(r, {
535
+ size: "sm",
536
+ variant: "filled",
537
+ circle: a < 10,
538
+ "aria-label": `${i.unread} não lidas`
539
+ }, () => a > 99 ? "99+" : String(a)) : null]),
540
+ i.tag ? v(r, {
541
+ size: "xs",
542
+ color: "obsidian",
543
+ mt: 6
544
+ }, () => i.tag) : null
545
+ ])]);
546
+ };
547
+ return () => v(i, { class: U.conversations }, () => [e.searchable ? v("div", { class: U.conversationSearch }, [v(u, {
548
+ size: "sm",
549
+ placeholder: e.searchPlaceholder,
550
+ modelValue: s.value,
551
+ "onUpdate:modelValue": (e) => s.value = e,
552
+ "aria-label": e.searchPlaceholder
553
+ }, { leftSection: () => v(A, { size: 16 }) })]) : null, v(l, {
554
+ style: { flex: 1 },
555
+ type: "auto"
556
+ }, () => v("div", { role: "list" }, [c.value.length === 0 ? v(i, {
557
+ p: "lg",
558
+ ta: "center",
559
+ c: "var(--ds-text-3)",
560
+ fz: "sm"
561
+ }, () => a.empty || e.empty != null ? f(e.empty, a.empty) : "Nenhuma conversa encontrada") : null, ...c.value.map(d)]))]);
562
+ }
563
+ }), te = _({
564
+ name: "ChatHeader",
565
+ props: {
566
+ title: V,
567
+ subtitle: V,
568
+ avatar: {
569
+ type: String,
570
+ default: void 0
571
+ },
572
+ avatarName: {
573
+ type: String,
574
+ default: void 0
575
+ },
576
+ online: {
577
+ type: Boolean,
578
+ default: !1
579
+ },
580
+ actions: V,
581
+ onBack: {
582
+ type: [Function, Array],
583
+ default: void 0
584
+ }
585
+ },
586
+ setup(e, { slots: r }) {
587
+ let a = () => {
588
+ let t = e.onBack;
589
+ Array.isArray(t) ? t.forEach((e) => e()) : t?.();
590
+ };
591
+ return () => {
592
+ let s = f(e.subtitle, r.subtitle);
593
+ return v(i, { class: U.header }, () => [
594
+ e.onBack ? v(t, {
595
+ class: U.backButton,
596
+ variant: "subtle",
597
+ onClick: a,
598
+ "aria-label": "Voltar"
599
+ }, () => v(T, { size: 20 })) : null,
600
+ e.avatar || e.avatarName ? v(o, {
601
+ color: "evergreen",
602
+ position: "bottom-end",
603
+ offset: 5,
604
+ size: 10,
605
+ withBorder: !0,
606
+ disabled: !e.online
607
+ }, () => v(n, {
608
+ src: e.avatar,
609
+ name: e.avatarName ? z(e.avatarName) : void 0,
610
+ color: "initials",
611
+ size: 40
612
+ })) : null,
613
+ v("div", { class: U.headerBody }, [v("div", { class: U.headerTitle }, [f(e.title, r.title)]), H(s) ? v("div", { class: U.headerSubtitle }, [s]) : null]),
614
+ f(e.actions, r.actions)
615
+ ]);
616
+ };
617
+ }
618
+ }), $ = (e) => typeof e == "number" ? `${e}px` : e, ne = _({
619
+ name: "ChatLayout",
620
+ props: {
621
+ sidebar: V,
622
+ header: V,
623
+ composer: V,
624
+ height: {
625
+ type: [Number, String],
626
+ default: 600
627
+ },
628
+ sidebarWidth: {
629
+ type: [Number, String],
630
+ default: 320
631
+ },
632
+ mobileView: {
633
+ type: String,
634
+ default: "thread"
635
+ }
636
+ },
637
+ setup(e, { slots: t }) {
638
+ return () => {
639
+ let n = f(e.sidebar, t.sidebar), r = H(n);
640
+ return v(i, {
641
+ class: U.layoutContainer,
642
+ style: {
643
+ "--chat-height": $(e.height),
644
+ "--chat-sidebar-width": $(e.sidebarWidth)
645
+ }
646
+ }, () => v("div", {
647
+ class: U.layout,
648
+ "data-mobile-view": r ? e.mobileView : void 0,
649
+ "data-single": !r || void 0
650
+ }, [r ? v("aside", { class: U.layoutSidebar }, [n]) : null, v("section", { class: U.layoutMain }, [
651
+ f(e.header, t.header),
652
+ v("div", { class: U.layoutMessages }, t.default?.()),
653
+ f(e.composer, t.composer)
654
+ ])]));
655
+ };
656
+ }
657
+ });
658
+ //#endregion
659
+ export { Q as ChatComposer, te as ChatHeader, ne as ChatLayout, q as ChatMessage, Z as ChatThread, ee as ConversationList, Y as TypingIndicator, R as buildThread, I as dayLabel, B as formatBytes, z as initialsName, L as shortTimeLabel };
660
+
661
+ //# sourceMappingURL=chat.js.map