@epam/ai-dial-attachment-input 1.1.0-dev.44 → 1.1.0-dev.441
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.
- package/components/AttachmentCard/AttachmentCard.d.ts.map +1 -1
- package/components/AttachmentCard/Attachments/Actions.d.ts +3 -5
- package/components/AttachmentCard/Attachments/Actions.d.ts.map +1 -1
- package/components/AttachmentCard/Attachments/File.d.ts +1 -8
- package/components/AttachmentCard/Attachments/File.d.ts.map +1 -1
- package/components/AttachmentCard/Attachments/Image.d.ts +2 -0
- package/components/AttachmentCard/Attachments/Image.d.ts.map +1 -1
- package/components/AttachmentGroup/AttachmentGroup.d.ts +1 -8
- package/components/AttachmentGroup/AttachmentGroup.d.ts.map +1 -1
- package/components/AttachmentTray/AttachmentTray.d.ts.map +1 -1
- package/constants/attachment-group.d.ts +1 -3
- package/constants/attachment-group.d.ts.map +1 -1
- package/index.css +1 -1
- package/index.d.ts +4 -5
- package/index.d.ts.map +1 -1
- package/index.js +329 -412
- package/models/attachment-card.d.ts +11 -9
- package/models/attachment-card.d.ts.map +1 -1
- package/models/attachment-file-row.d.ts +8 -0
- package/models/attachment-file-row.d.ts.map +1 -1
- package/models/attachment-group.d.ts +2 -24
- package/models/attachment-group.d.ts.map +1 -1
- package/models/attachment-tray.d.ts +2 -0
- package/models/attachment-tray.d.ts.map +1 -1
- package/package.json +3 -3
- package/utils/attachment.d.ts +4 -27
- package/utils/attachment.d.ts.map +1 -1
- package/components/AttachmentCard/Attachments/Audio.d.ts +0 -20
- package/components/AttachmentCard/Attachments/Audio.d.ts.map +0 -1
- package/components/AttachmentMoreTile/AttachmentMoreTile.d.ts +0 -9
- package/components/AttachmentMoreTile/AttachmentMoreTile.d.ts.map +0 -1
- package/models/attachment-more-tile.d.ts +0 -54
- package/models/attachment-more-tile.d.ts.map +0 -1
package/index.js
CHANGED
|
@@ -1,139 +1,132 @@
|
|
|
1
|
-
import { AttachmentErrorReason as e, AttachmentType as t,
|
|
2
|
-
import { useCallback as
|
|
3
|
-
import {
|
|
4
|
-
import { DIAL_ICON_SIZE as W,
|
|
5
|
-
import { Fragment as
|
|
6
|
-
//#region src/
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
}({}), pe = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, me = (e) => {
|
|
1
|
+
import { AttachmentErrorReason as e, AttachmentType as t, MIME_TYPE_EXT_MAP as n, RequestStatus as r, buildCssVars as i, mergeClasses as a } from "@epam/ai-dial-chat-shared";
|
|
2
|
+
import { useCallback as o, useEffect as s, useId as c, useMemo as l, useRef as u, useState as d } from "react";
|
|
3
|
+
import { IconClipboard as f, IconDownload as p, IconExternalLink as m, IconFile as h, IconFileDescription as g, IconFileTypeBmp as _, IconFileTypeCss as v, IconFileTypeCsv as y, IconFileTypeDoc as b, IconFileTypeDocx as x, IconFileTypeHtml as S, IconFileTypeJpg as C, IconFileTypeJs as w, IconFileTypeJsx as T, IconFileTypePdf as E, IconFileTypePhp as D, IconFileTypePng as O, IconFileTypePpt as k, IconFileTypeRs as A, IconFileTypeSql as j, IconFileTypeSvg as M, IconFileTypeTs as N, IconFileTypeTsx as P, IconFileTypeTxt as F, IconFileTypeVue as I, IconFileTypeXls as L, IconFileTypeXml as R, IconFileTypeZip as z, IconFileX as ee, IconMusic as te, IconPaperclip as B, IconPhoto as V, IconReload as ne, IconTerminal2 as H, IconVideo as re, IconX as ie } from "@tabler/icons-react";
|
|
4
|
+
import { DIAL_ICON_SIZE as U, DIAL_KIT_ICON_STROKE as W, ElementSize as G, GhostIconButton as ae, Highlight as oe, Skeleton as se, SkeletonVariant as ce, Spinner as le, StaticIconButton as ue } from "@epam/ai-dial-ui-kit";
|
|
5
|
+
import { Fragment as de, jsx as K, jsxs as q } from "react/jsx-runtime";
|
|
6
|
+
//#region src/utils/attachment.ts
|
|
7
|
+
var J = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, fe = (e) => {
|
|
8
|
+
if (e == null) return "";
|
|
10
9
|
let t = e.lastIndexOf(".");
|
|
11
10
|
return t > 0 ? e.slice(0, t) : e;
|
|
12
|
-
},
|
|
11
|
+
}, pe = {
|
|
13
12
|
image: "Image files",
|
|
14
13
|
audio: "Audio files",
|
|
15
14
|
video: "Video files",
|
|
16
|
-
text: "Text files"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
text: "Text files",
|
|
16
|
+
"*": "All files"
|
|
17
|
+
}, me = { "image/jpeg": "JPEG" }, he = (e, t = pe) => e.map((e) => {
|
|
18
|
+
let r = e.toLowerCase().split(";")[0].trim();
|
|
19
|
+
if (r.endsWith("/*")) {
|
|
20
|
+
let e = r.slice(0, -2);
|
|
21
|
+
return t[e] ?? `${e} files`;
|
|
21
22
|
}
|
|
22
|
-
let
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
let i = me[r];
|
|
24
|
+
if (i) return i;
|
|
25
|
+
let a = n[r];
|
|
26
|
+
if (a) return a.toUpperCase();
|
|
27
|
+
let o = r.split("/")[1];
|
|
28
|
+
return o == null ? e.toUpperCase() : o.toUpperCase();
|
|
29
|
+
}).join(", "), ge = (e, t) => t.length === 0 ? !1 : t.some((t) => {
|
|
25
30
|
if (t === "*" || t === "*/*") return !0;
|
|
26
31
|
if (t.endsWith("/*")) {
|
|
27
32
|
let n = t.slice(0, -2);
|
|
28
33
|
return e.startsWith(`${n}/`);
|
|
29
34
|
}
|
|
30
35
|
return e === t;
|
|
31
|
-
}),
|
|
32
|
-
if (!e) return
|
|
36
|
+
}), _e = (e) => {
|
|
37
|
+
if (!e) return h;
|
|
33
38
|
if (e.startsWith("image/")) switch (e) {
|
|
34
39
|
case "image/jpeg":
|
|
35
|
-
case "image/jpg": return
|
|
36
|
-
case "image/png": return
|
|
37
|
-
case "image/svg+xml": return
|
|
38
|
-
case "image/bmp": return
|
|
39
|
-
default: return
|
|
40
|
+
case "image/jpg": return C;
|
|
41
|
+
case "image/png": return O;
|
|
42
|
+
case "image/svg+xml": return M;
|
|
43
|
+
case "image/bmp": return _;
|
|
44
|
+
default: return V;
|
|
40
45
|
}
|
|
41
|
-
if (e.startsWith("video/")) return
|
|
46
|
+
if (e.startsWith("video/")) return re;
|
|
42
47
|
if (e.startsWith("audio/")) return te;
|
|
43
48
|
switch (e) {
|
|
44
|
-
case "application/pdf": return
|
|
49
|
+
case "application/pdf": return E;
|
|
45
50
|
case "application/msword":
|
|
46
|
-
case "application/vnd.ms-word": return
|
|
47
|
-
case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": return
|
|
48
|
-
case "application/vnd.ms-powerpoint": return
|
|
49
|
-
case "application/vnd.openxmlformats-officedocument.presentationml.presentation": return
|
|
50
|
-
case "application/vnd.ms-excel": return
|
|
51
|
-
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": return
|
|
51
|
+
case "application/vnd.ms-word": return b;
|
|
52
|
+
case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": return x;
|
|
53
|
+
case "application/vnd.ms-powerpoint": return k;
|
|
54
|
+
case "application/vnd.openxmlformats-officedocument.presentationml.presentation": return k;
|
|
55
|
+
case "application/vnd.ms-excel": return L;
|
|
56
|
+
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": return L;
|
|
52
57
|
case "application/zip":
|
|
53
58
|
case "application/x-zip-compressed":
|
|
54
59
|
case "application/x-rar-compressed":
|
|
55
60
|
case "application/x-7z-compressed":
|
|
56
61
|
case "application/gzip":
|
|
57
|
-
case "application/x-tar": return
|
|
58
|
-
case "text/csv": return
|
|
59
|
-
case "text/plain": return
|
|
62
|
+
case "application/x-tar": return z;
|
|
63
|
+
case "text/csv": return y;
|
|
64
|
+
case "text/plain": return F;
|
|
60
65
|
case "text/html":
|
|
61
|
-
case "application/xhtml+xml": return
|
|
66
|
+
case "application/xhtml+xml": return S;
|
|
62
67
|
case "text/xml":
|
|
63
|
-
case "application/xml": return
|
|
68
|
+
case "application/xml": return R;
|
|
64
69
|
case "application/sql":
|
|
65
|
-
case "text/x-sql": return
|
|
70
|
+
case "text/x-sql": return j;
|
|
66
71
|
case "text/javascript":
|
|
67
|
-
case "application/javascript": return
|
|
68
|
-
case "text/jsx": return
|
|
72
|
+
case "application/javascript": return w;
|
|
73
|
+
case "text/jsx": return T;
|
|
69
74
|
case "application/typescript":
|
|
70
|
-
case "text/typescript": return
|
|
71
|
-
case "text/tsx": return
|
|
72
|
-
case "text/css": return
|
|
75
|
+
case "text/typescript": return N;
|
|
76
|
+
case "text/tsx": return P;
|
|
77
|
+
case "text/css": return v;
|
|
73
78
|
case "text/x-php":
|
|
74
|
-
case "application/x-php": return
|
|
79
|
+
case "application/x-php": return D;
|
|
75
80
|
case "text/x-rustsrc":
|
|
76
|
-
case "application/x-rust": return
|
|
77
|
-
case "text/x-vue": return
|
|
78
|
-
default: return
|
|
81
|
+
case "application/x-rust": return A;
|
|
82
|
+
case "text/x-vue": return I;
|
|
83
|
+
default: return h;
|
|
79
84
|
}
|
|
80
|
-
},
|
|
85
|
+
}, ve = (e) => {
|
|
81
86
|
let { type: n, contentType: r } = e;
|
|
82
|
-
return n === t.Prompt ?
|
|
83
|
-
},
|
|
84
|
-
let t = e.toLowerCase().split(";")[0].trim(),
|
|
85
|
-
if (
|
|
87
|
+
return n === t.Prompt ? H : n === t.Pasted ? f : n === t.Image ? V : _e(r ?? "");
|
|
88
|
+
}, ye = (e) => {
|
|
89
|
+
let t = e.toLowerCase().split(";")[0].trim(), r = n[t];
|
|
90
|
+
if (r) return r;
|
|
86
91
|
let i = t.split("/")[1];
|
|
87
92
|
if (i && !i.startsWith("vnd.") && !i.includes("+")) return i;
|
|
88
|
-
},
|
|
93
|
+
}, be = (e, n) => {
|
|
89
94
|
let { type: r, name: i, contentType: a } = e;
|
|
90
95
|
if (r === t.Prompt) return n.promptLabel ?? "Prompt";
|
|
91
96
|
if (r === t.Pasted) return n.pastedLabel ?? "Pasted";
|
|
92
97
|
if (r === t.Image) return n.imageLabel ?? "Image";
|
|
93
98
|
if (a) {
|
|
94
|
-
let e =
|
|
99
|
+
let e = ye(a);
|
|
95
100
|
if (e) return `.${e}`;
|
|
96
101
|
}
|
|
102
|
+
if (i == null) return "";
|
|
97
103
|
let o = i.lastIndexOf(".");
|
|
98
104
|
return o > 0 && o < i.length - 1 ? `.${i.slice(o + 1).toLowerCase()}` : i;
|
|
99
105
|
}, Y = (e, n = {}) => {
|
|
100
|
-
let { type:
|
|
106
|
+
let { type: i, status: a, previewUrl: o, url: s } = e, c = a === r.Loading, l = a === r.Error, u = i === t.Image && !!(o ?? s) && !l, d = i === t.Link && !l;
|
|
101
107
|
return {
|
|
102
108
|
isLoading: c,
|
|
103
109
|
isError: l,
|
|
104
110
|
isImage: u,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
typeLabel: f ? null : xe(e, n)
|
|
111
|
+
isLink: d,
|
|
112
|
+
BottomIcon: d ? null : ve(e),
|
|
113
|
+
typeLabel: d ? null : be(e, n)
|
|
109
114
|
};
|
|
110
|
-
},
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
tileError: "_tileError_3x6ks_16",
|
|
126
|
-
nameText: "_nameText_3x6ks_23",
|
|
127
|
-
typeText: "_typeText_3x6ks_24",
|
|
128
|
-
retryIcon: "_retryIcon_3x6ks_36",
|
|
129
|
-
hoverIcon: "_hoverIcon_3x6ks_40",
|
|
130
|
-
track: "_track_3x6ks_48",
|
|
131
|
-
indeterminateFill: "_indeterminateFill_3x6ks_52",
|
|
132
|
-
"attachment-tile-indeterminate": "_attachment-tile-indeterminate_3x6ks_1"
|
|
133
|
-
}, Z = ({ ariaLabel: e, errorTitle: t, errorDescId: n, onClick: r, id: i, icon: a, className: s }) => /* @__PURE__ */ K(oe, {
|
|
134
|
-
icon: a,
|
|
135
|
-
size: le.Small,
|
|
136
|
-
className: o("absolute end-1 top-1 h-6 w-6 rounded-lg", s ?? X.hoverIcon),
|
|
115
|
+
}, xe = 5, Se = "flex size-[84px] items-center justify-center rounded-xl border", X = {
|
|
116
|
+
tile: "_tile_1whwz_1",
|
|
117
|
+
hovered: "_hovered_1whwz_5",
|
|
118
|
+
selected: "_selected_1whwz_15",
|
|
119
|
+
tileError: "_tileError_1whwz_20",
|
|
120
|
+
nameText: "_nameText_1whwz_25",
|
|
121
|
+
typeText: "_typeText_1whwz_29",
|
|
122
|
+
retryIcon: "_retryIcon_1whwz_33",
|
|
123
|
+
track: "_track_1whwz_37",
|
|
124
|
+
actionButton: "_actionButton_1whwz_43",
|
|
125
|
+
imageActionButton: "_imageActionButton_1whwz_47"
|
|
126
|
+
}, Z = ({ ariaLabel: e, errorTitle: t, errorDescId: n, onClick: r, id: i, icon: o, className: s }) => /* @__PURE__ */ K(ue, {
|
|
127
|
+
icon: o,
|
|
128
|
+
size: G.Small,
|
|
129
|
+
className: a("opacity-0 focus-visible:opacity-100 group-focus-within/attachment-tile:opacity-100 group-hover/attachment-tile:opacity-100", X.actionButton, s),
|
|
137
130
|
"aria-label": e,
|
|
138
131
|
"aria-describedby": t ? n : void 0,
|
|
139
132
|
onClick: (e) => {
|
|
@@ -141,164 +134,132 @@ var ue = 5, de = 4, fe = "flex size-[84px] items-center justify-center rounded-x
|
|
|
141
134
|
}
|
|
142
135
|
}), Ce = ({ ...e }) => /* @__PURE__ */ K(Z, {
|
|
143
136
|
icon: /* @__PURE__ */ K(ne, {
|
|
144
|
-
size:
|
|
145
|
-
"aria-hidden": !0
|
|
137
|
+
size: U.SM,
|
|
138
|
+
"aria-hidden": !0,
|
|
139
|
+
stroke: W
|
|
146
140
|
}),
|
|
147
141
|
className: X.retryIcon,
|
|
148
142
|
...e
|
|
149
143
|
}), we = ({ ...e }) => /* @__PURE__ */ K(Z, {
|
|
150
|
-
icon: /* @__PURE__ */ K(
|
|
151
|
-
size:
|
|
152
|
-
"aria-hidden": !0
|
|
144
|
+
icon: /* @__PURE__ */ K(p, {
|
|
145
|
+
size: U.SM,
|
|
146
|
+
"aria-hidden": !0,
|
|
147
|
+
stroke: W
|
|
153
148
|
}),
|
|
154
149
|
...e
|
|
155
150
|
}), Te = ({ ...e }) => /* @__PURE__ */ K(Z, {
|
|
156
|
-
icon: /* @__PURE__ */ K(
|
|
157
|
-
size:
|
|
158
|
-
"aria-hidden": !0
|
|
151
|
+
icon: /* @__PURE__ */ K(m, {
|
|
152
|
+
size: U.SM,
|
|
153
|
+
"aria-hidden": !0,
|
|
154
|
+
stroke: W
|
|
159
155
|
}),
|
|
160
156
|
...e
|
|
161
157
|
}), Ee = ({ ...e }) => /* @__PURE__ */ K(Z, {
|
|
162
|
-
icon: /* @__PURE__ */ K(
|
|
163
|
-
size:
|
|
164
|
-
"aria-hidden": !0
|
|
158
|
+
icon: /* @__PURE__ */ K(ie, {
|
|
159
|
+
size: U.SM,
|
|
160
|
+
"aria-hidden": !0,
|
|
161
|
+
stroke: W
|
|
165
162
|
}),
|
|
166
|
-
className: X.hoverIcon,
|
|
167
163
|
...e
|
|
168
|
-
}), De =
|
|
169
|
-
let { clickLabel: u = "Open attachment", downloadLabel: d = "Download attachment", removeLabel: f = "Remove attachment" } = s ?? {}, { typography: p, className: m } = c ?? {}, h = () => {
|
|
170
|
-
r?.(e.id);
|
|
171
|
-
};
|
|
172
|
-
return /* @__PURE__ */ q("div", {
|
|
173
|
-
style: l,
|
|
174
|
-
...r == null ? {} : {
|
|
175
|
-
role: "button",
|
|
176
|
-
tabIndex: 0,
|
|
177
|
-
"aria-label": u,
|
|
178
|
-
onClick: h,
|
|
179
|
-
onKeyDown: (e) => {
|
|
180
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), h());
|
|
181
|
-
}
|
|
182
|
-
},
|
|
183
|
-
className: o("group relative flex w-full min-w-[280px] max-w-[300px] flex-col gap-2 rounded-xl border p-3", r && "cursor-pointer", (i || a) && "pe-8", m),
|
|
184
|
-
children: [
|
|
185
|
-
/* @__PURE__ */ K("span", {
|
|
186
|
-
title: e.name,
|
|
187
|
-
className: o(p?.fontClassName ?? "dial-tiny-text", "min-w-0 truncate", X.nameText),
|
|
188
|
-
children: t ? /* @__PURE__ */ K(n, {
|
|
189
|
-
text: e.name,
|
|
190
|
-
query: t,
|
|
191
|
-
maxLines: 1
|
|
192
|
-
}) : e.name
|
|
193
|
-
}),
|
|
194
|
-
e.playUrl && /* @__PURE__ */ K("audio", {
|
|
195
|
-
controls: !0,
|
|
196
|
-
src: e.playUrl,
|
|
197
|
-
"aria-label": e.name,
|
|
198
|
-
className: "w-full",
|
|
199
|
-
preload: "metadata",
|
|
200
|
-
onClick: (e) => e.stopPropagation()
|
|
201
|
-
}),
|
|
202
|
-
i && /* @__PURE__ */ K(we, {
|
|
203
|
-
ariaLabel: d,
|
|
204
|
-
onClick: i,
|
|
205
|
-
id: e.id
|
|
206
|
-
}),
|
|
207
|
-
a && /* @__PURE__ */ K(Ee, {
|
|
208
|
-
ariaLabel: f,
|
|
209
|
-
onClick: a,
|
|
210
|
-
id: e.id
|
|
211
|
-
})
|
|
212
|
-
]
|
|
213
|
-
});
|
|
214
|
-
}, Oe = {
|
|
164
|
+
}), De = {
|
|
215
165
|
[e.Network]: "Upload failed · network error",
|
|
216
166
|
[e.UnsupportedType]: "Upload failed · unsupported file type"
|
|
217
|
-
},
|
|
218
|
-
let { clickLabel:
|
|
219
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
220
|
-
},
|
|
167
|
+
}, Oe = ({ attachment: t, searchQuery: n = "", onClick: i, onRetry: s, labels: u, styles: d, onDownload: f, isPasted: p, isLink: m, cssVars: h, onExpand: g, isExpandable: _, onRemove: v, isSelected: y }) => {
|
|
168
|
+
let { clickLabel: b = "Download attachment", retryLabel: x = "Retry upload", removeLabel: S = "Remove attachment", openInNewTabLabel: C = "Open in new tab", sizeLabel: w, uploadingLabel: T = "Uploading", errorReasonLabels: E, genericErrorLabel: D = "Upload failed" } = u ?? {}, { typography: O, className: k } = d ?? {}, { id: A, name: j, status: M, errorReason: N } = t, P = M === r.Loading, F = M === r.Error, I = c(), L = F ? N && (E?.[N] ?? De[N]) || D : "", { BottomIcon: R, typeLabel: z } = Y(t), ee = !F && !P && f && !m, te = F && !!s && N !== e.UnsupportedType, B = Number(!!ee) + Number(!!te) + Number(!!m) + Number(!!v), V = B > 1 ? "pe-11" : B === 1 ? "pe-5" : void 0, ne = (e) => {
|
|
169
|
+
e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), i?.(t.id));
|
|
170
|
+
}, H = l(() => p ? j : fe(j), [p, j]), re = o(() => {
|
|
221
171
|
window.open(t.referenceUrl, "_blank", "noopener,noreferrer");
|
|
222
|
-
}, [t]),
|
|
223
|
-
title:
|
|
224
|
-
className:
|
|
225
|
-
children:
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
172
|
+
}, [t]), ie = a(Se, "group/attachment-tile relative flex-col justify-between items-start gap-1 overflow-hidden p-1.5", X.tile, !F && X.hovered, y && X.selected, F && X.tileError), U = /* @__PURE__ */ K("div", {
|
|
173
|
+
title: H,
|
|
174
|
+
className: a(O?.nameClassName ?? "dial-caption-text", "line-clamp-2 w-full min-w-0 break-words", X.nameText, !F && V),
|
|
175
|
+
children: n ? /* @__PURE__ */ K(oe, {
|
|
176
|
+
text: H,
|
|
177
|
+
query: n,
|
|
178
|
+
maxLines: 2
|
|
179
|
+
}) : H
|
|
180
|
+
}), W = R && /* @__PURE__ */ q("div", {
|
|
181
|
+
className: a("flex w-full items-center gap-1", F && V),
|
|
182
|
+
children: [/* @__PURE__ */ K(R, {
|
|
229
183
|
size: 16,
|
|
230
184
|
className: X.typeText,
|
|
231
185
|
"aria-hidden": !0
|
|
232
186
|
}), /* @__PURE__ */ K("span", {
|
|
233
|
-
className:
|
|
234
|
-
children:
|
|
187
|
+
className: a(O?.metaClassName ?? "dial-caption-text", "min-w-0 flex-1 truncate", X.typeText),
|
|
188
|
+
children: w ? `${z} · ${w}` : z
|
|
235
189
|
})]
|
|
236
|
-
}),
|
|
237
|
-
|
|
238
|
-
},
|
|
239
|
-
|
|
240
|
-
|
|
190
|
+
}), G = () => {
|
|
191
|
+
_ && g ? g(A) : i && i(A);
|
|
192
|
+
}, ae = /* @__PURE__ */ q(de, { children: [
|
|
193
|
+
U,
|
|
194
|
+
W,
|
|
195
|
+
P && /* @__PURE__ */ K("div", {
|
|
241
196
|
role: "progressbar",
|
|
242
|
-
"aria-label":
|
|
243
|
-
className:
|
|
244
|
-
children: /* @__PURE__ */ K(
|
|
197
|
+
"aria-label": T,
|
|
198
|
+
className: a("absolute start-[-1px] top-[-1px] flex size-full items-center justify-center rounded", X.track),
|
|
199
|
+
children: /* @__PURE__ */ K(le, { size: 32 })
|
|
245
200
|
}),
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
201
|
+
/* @__PURE__ */ q("div", {
|
|
202
|
+
className: "absolute end-1 top-1 flex gap-1",
|
|
203
|
+
children: [
|
|
204
|
+
ee && /* @__PURE__ */ K(we, {
|
|
205
|
+
ariaLabel: b,
|
|
206
|
+
errorTitle: L,
|
|
207
|
+
errorDescId: I,
|
|
208
|
+
onClick: f,
|
|
209
|
+
id: A
|
|
210
|
+
}),
|
|
211
|
+
te && /* @__PURE__ */ K(Ce, {
|
|
212
|
+
ariaLabel: x,
|
|
213
|
+
errorTitle: L,
|
|
214
|
+
errorDescId: I,
|
|
215
|
+
onClick: s,
|
|
216
|
+
id: A
|
|
217
|
+
}),
|
|
218
|
+
m && /* @__PURE__ */ K(Te, {
|
|
219
|
+
ariaLabel: C,
|
|
220
|
+
errorTitle: L,
|
|
221
|
+
errorDescId: I,
|
|
222
|
+
onClick: re
|
|
223
|
+
}),
|
|
224
|
+
v && /* @__PURE__ */ K(Ee, {
|
|
225
|
+
ariaLabel: S,
|
|
226
|
+
errorTitle: L,
|
|
227
|
+
errorDescId: I,
|
|
228
|
+
onClick: v,
|
|
229
|
+
id: A
|
|
230
|
+
})
|
|
231
|
+
]
|
|
272
232
|
}),
|
|
273
|
-
|
|
274
|
-
id:
|
|
233
|
+
F && /* @__PURE__ */ K("span", {
|
|
234
|
+
id: I,
|
|
275
235
|
role: "status",
|
|
276
236
|
"aria-live": "polite",
|
|
277
237
|
className: "sr-only",
|
|
278
|
-
children:
|
|
238
|
+
children: L
|
|
279
239
|
})
|
|
280
240
|
] });
|
|
281
241
|
return /* @__PURE__ */ K("div", {
|
|
282
|
-
style:
|
|
283
|
-
className:
|
|
242
|
+
style: h,
|
|
243
|
+
className: a("inline-flex", k),
|
|
284
244
|
children: /* @__PURE__ */ K("div", {
|
|
285
245
|
role: "button",
|
|
286
246
|
tabIndex: 0,
|
|
287
|
-
"aria-label":
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
247
|
+
"aria-label": b,
|
|
248
|
+
"aria-busy": P,
|
|
249
|
+
onClick: G,
|
|
250
|
+
onKeyDown: ne,
|
|
251
|
+
style: h,
|
|
252
|
+
className: a(ie, "cursor-pointer focus-within:outline focus-within:outline-1 focus-within:outline-offset-1"),
|
|
253
|
+
children: ae
|
|
293
254
|
})
|
|
294
255
|
});
|
|
295
256
|
}, Q = /* @__PURE__ */ function(e) {
|
|
296
257
|
return e.Idle = "idle", e.Loading = "loading", e.Loaded = "loaded", e.Error = "error", e;
|
|
297
|
-
}({}),
|
|
298
|
-
let n =
|
|
299
|
-
return
|
|
258
|
+
}({}), ke = ({ enabled: e, src: t }) => {
|
|
259
|
+
let n = u(null), [r, i] = d("idle");
|
|
260
|
+
return s(() => {
|
|
300
261
|
i(e && t ? "loading" : "idle");
|
|
301
|
-
}, [e, t]),
|
|
262
|
+
}, [e, t]), s(() => {
|
|
302
263
|
let r = n.current;
|
|
303
264
|
if (!r || !e || !t) return;
|
|
304
265
|
let a = () => i("loaded"), o = () => i("error");
|
|
@@ -309,114 +270,117 @@ var ue = 5, de = 4, fe = "flex size-[84px] items-center justify-center rounded-x
|
|
|
309
270
|
imageRef: n,
|
|
310
271
|
imageLoadStatus: r
|
|
311
272
|
};
|
|
312
|
-
},
|
|
313
|
-
let { clickLabel:
|
|
314
|
-
enabled:
|
|
315
|
-
src:
|
|
316
|
-
}),
|
|
317
|
-
|
|
273
|
+
}, Ae = ({ attachment: e, onExpand: n, onClick: r, labels: i, onRemove: o, cssVars: s, onDownload: c, styles: u, isSelected: d }) => {
|
|
274
|
+
let { clickLabel: f = "Open attachment", expandLabel: p = "Expand pasted text", removeLabel: m = "Remove attachment", downloadLabel: h = "Download attachment" } = i ?? {}, { className: g } = u ?? {}, { id: _, name: v } = e, y = e.previewUrl ?? e.url, b = e.type === t.Pasted && n !== void 0, { isLoading: x, isError: S, isImage: C } = l(() => Y(e), [e]), w = r !== void 0 && !b && !x && !S, { imageRef: T, imageLoadStatus: E } = ke({
|
|
275
|
+
enabled: C,
|
|
276
|
+
src: y
|
|
277
|
+
}), D = () => {
|
|
278
|
+
b && n ? n(_) : w && r && r(_);
|
|
318
279
|
};
|
|
319
280
|
return /* @__PURE__ */ K("div", {
|
|
320
|
-
className:
|
|
321
|
-
onClick:
|
|
281
|
+
className: a(Se, "group/attachment-tile", w && "cursor-pointer", X.tile, d && X.selected, g),
|
|
282
|
+
onClick: D,
|
|
322
283
|
onKeyDown: (e) => {
|
|
323
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
284
|
+
e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), D());
|
|
324
285
|
},
|
|
325
286
|
tabIndex: 0,
|
|
326
287
|
role: "button",
|
|
327
288
|
style: s,
|
|
328
|
-
"aria-label":
|
|
289
|
+
"aria-label": w ? f : b ? p : void 0,
|
|
329
290
|
children: /* @__PURE__ */ q("div", {
|
|
330
291
|
className: "relative h-full w-full overflow-hidden",
|
|
331
292
|
children: [
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
293
|
+
/* @__PURE__ */ q("div", {
|
|
294
|
+
className: "absolute end-1 top-1 z-10 flex gap-1",
|
|
295
|
+
children: [o && /* @__PURE__ */ K(Ee, {
|
|
296
|
+
ariaLabel: m,
|
|
297
|
+
onClick: o,
|
|
298
|
+
id: _,
|
|
299
|
+
className: X.imageActionButton
|
|
300
|
+
}), c && /* @__PURE__ */ K(we, {
|
|
301
|
+
ariaLabel: h,
|
|
302
|
+
onClick: c,
|
|
303
|
+
id: _,
|
|
304
|
+
className: X.imageActionButton
|
|
305
|
+
})]
|
|
339
306
|
}),
|
|
340
|
-
|
|
307
|
+
E !== Q.Loaded && /* @__PURE__ */ K(se, {
|
|
341
308
|
variant: ce.Rectangular,
|
|
342
309
|
width: "100%",
|
|
343
310
|
height: "100%",
|
|
344
|
-
active:
|
|
345
|
-
overlay: /* @__PURE__ */ K(
|
|
346
|
-
size:
|
|
347
|
-
className:
|
|
348
|
-
"aria-hidden": !0
|
|
311
|
+
active: E === Q.Loading,
|
|
312
|
+
overlay: /* @__PURE__ */ K(V, {
|
|
313
|
+
size: U.LG,
|
|
314
|
+
className: X.typeText,
|
|
315
|
+
"aria-hidden": !0,
|
|
316
|
+
stroke: W
|
|
349
317
|
}),
|
|
350
318
|
className: "absolute inset-0 rounded-xl"
|
|
351
319
|
}),
|
|
352
320
|
/* @__PURE__ */ K("img", {
|
|
353
|
-
ref:
|
|
354
|
-
src:
|
|
355
|
-
alt:
|
|
321
|
+
ref: T,
|
|
322
|
+
src: y,
|
|
323
|
+
alt: v,
|
|
356
324
|
loading: "lazy",
|
|
357
325
|
decoding: "async",
|
|
358
|
-
className:
|
|
326
|
+
className: a("h-full w-full rounded-xl object-cover transition-opacity duration-200", E === Q.Loaded ? "opacity-100" : "opacity-0")
|
|
359
327
|
})
|
|
360
328
|
]
|
|
361
329
|
})
|
|
362
330
|
});
|
|
363
|
-
},
|
|
364
|
-
let { colors:
|
|
365
|
-
"--
|
|
366
|
-
"--
|
|
367
|
-
"--
|
|
368
|
-
"--
|
|
369
|
-
"--
|
|
370
|
-
"--
|
|
371
|
-
"--
|
|
372
|
-
"--
|
|
373
|
-
"--
|
|
374
|
-
"--
|
|
375
|
-
"--
|
|
376
|
-
"--
|
|
377
|
-
"--
|
|
378
|
-
|
|
379
|
-
|
|
331
|
+
}, $ = ({ attachment: e, searchQuery: n = "", onRemove: r, onRetry: a, onExpand: o, onClick: s, onDownload: c, labels: u, styles: d, isSelected: f }) => {
|
|
332
|
+
let { colors: p } = d ?? {}, m = e.type === t.Pasted, h = m && o !== void 0, g = i({
|
|
333
|
+
"--ai-tile-bg": p?.background,
|
|
334
|
+
"--ai-tile-border": p?.border,
|
|
335
|
+
"--ai-tile-bg-hover": p?.backgroundHover,
|
|
336
|
+
"--ai-tile-border-hover": p?.borderHover,
|
|
337
|
+
"--ai-tile-bg-selected": p?.backgroundSelected,
|
|
338
|
+
"--ai-tile-border-selected": p?.borderSelected,
|
|
339
|
+
"--ai-tile-focus-outline": p?.focusOutline,
|
|
340
|
+
"--ai-tile-bg-error": p?.backgroundError,
|
|
341
|
+
"--ai-tile-border-error": p?.borderError,
|
|
342
|
+
"--ai-tile-error-text": p?.errorText,
|
|
343
|
+
"--ai-tile-name-text": p?.nameText,
|
|
344
|
+
"--ai-tile-type-text": p?.typeText,
|
|
345
|
+
"--ai-tile-hover-icon-bg": p?.hoverIconBackground,
|
|
346
|
+
"--ai-tile-hover-icon-color": p?.hoverIconColor,
|
|
347
|
+
"--ai-tile-progress-track": p?.trackBackground
|
|
348
|
+
}), { isImage: _, isLink: v } = l(() => Y(e), [e]);
|
|
349
|
+
return _ ? /* @__PURE__ */ K(Ae, {
|
|
380
350
|
attachment: e,
|
|
381
|
-
labels:
|
|
382
|
-
onClick: s,
|
|
383
|
-
onDownload: c,
|
|
384
|
-
onRemove: r,
|
|
385
|
-
searchQuery: n,
|
|
386
|
-
styles: d,
|
|
387
|
-
cssVars: h
|
|
388
|
-
}) : g ? /* @__PURE__ */ K(je, {
|
|
389
|
-
attachment: e,
|
|
390
|
-
labels: l,
|
|
351
|
+
labels: u,
|
|
391
352
|
onClick: s,
|
|
392
353
|
onExpand: o,
|
|
393
354
|
styles: d,
|
|
394
355
|
onRemove: r,
|
|
395
|
-
cssVars:
|
|
396
|
-
onDownload: c
|
|
397
|
-
|
|
356
|
+
cssVars: g,
|
|
357
|
+
onDownload: c,
|
|
358
|
+
isSelected: f
|
|
359
|
+
}) : /* @__PURE__ */ K(Oe, {
|
|
398
360
|
attachment: e,
|
|
361
|
+
searchQuery: n,
|
|
399
362
|
onClick: s,
|
|
400
|
-
onRetry:
|
|
363
|
+
onRetry: a,
|
|
401
364
|
onRemove: r,
|
|
402
365
|
onDownload: c,
|
|
403
366
|
isLink: v,
|
|
404
|
-
isPasted:
|
|
367
|
+
isPasted: m,
|
|
405
368
|
styles: d,
|
|
406
|
-
labels:
|
|
369
|
+
labels: u,
|
|
407
370
|
onExpand: o,
|
|
408
|
-
cssVars:
|
|
409
|
-
isExpandable:
|
|
371
|
+
cssVars: g,
|
|
372
|
+
isExpandable: h,
|
|
373
|
+
isSelected: f
|
|
410
374
|
});
|
|
411
|
-
},
|
|
412
|
-
let { ariaLabel: c = "Attached files", removeLabel: l, retryLabel: u, clickLabel: d } =
|
|
375
|
+
}, je = ({ attachments: e, onRemove: t, onRetry: n, onExpand: r, onAttachmentClick: i, labels: o, styles: s }) => {
|
|
376
|
+
let { ariaLabel: c = "Attached files", removeLabel: l, retryLabel: u, clickLabel: d, uploadingLabel: f } = o ?? {}, { className: p } = s ?? {};
|
|
413
377
|
return e.length === 0 ? null : /* @__PURE__ */ K("div", {
|
|
414
378
|
role: "list",
|
|
415
379
|
"aria-label": c,
|
|
416
|
-
className:
|
|
380
|
+
className: a("flex w-full min-w-0 gap-2 overflow-x-auto", p),
|
|
417
381
|
children: e.map((e) => /* @__PURE__ */ K("div", {
|
|
418
382
|
role: "listitem",
|
|
419
|
-
children: /* @__PURE__ */ K(
|
|
383
|
+
children: /* @__PURE__ */ K($, {
|
|
420
384
|
attachment: e,
|
|
421
385
|
onRemove: t,
|
|
422
386
|
onRetry: n,
|
|
@@ -424,142 +388,95 @@ var ue = 5, de = 4, fe = "flex size-[84px] items-center justify-center rounded-x
|
|
|
424
388
|
labels: {
|
|
425
389
|
removeLabel: l,
|
|
426
390
|
retryLabel: u,
|
|
427
|
-
clickLabel: d
|
|
391
|
+
clickLabel: d,
|
|
392
|
+
uploadingLabel: f
|
|
428
393
|
},
|
|
429
394
|
onClick: i
|
|
430
395
|
})
|
|
431
396
|
}, e.id))
|
|
432
397
|
});
|
|
433
|
-
},
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
"--ci-more-tile-bg-hover": u?.backgroundHover,
|
|
439
|
-
"--ci-more-tile-color-hover": u?.colorHover,
|
|
440
|
-
"--ci-more-tile-border-hover": u?.borderHover,
|
|
441
|
-
"--ci-more-tile-focus-outline": u?.focusOutline
|
|
442
|
-
});
|
|
443
|
-
return /* @__PURE__ */ K("button", {
|
|
444
|
-
type: "button",
|
|
445
|
-
onClick: t,
|
|
446
|
-
"aria-label": s ?? `Show ${e} more attachments`,
|
|
447
|
-
style: d,
|
|
448
|
-
className: o(fe, c, Pe.tile, l),
|
|
449
|
-
children: r ?? /* @__PURE__ */ K("bdi", {
|
|
450
|
-
dir: "ltr",
|
|
451
|
-
children: `+${e}`
|
|
452
|
-
})
|
|
453
|
-
});
|
|
454
|
-
}, $ = {
|
|
455
|
-
container: "_container_7fktb_1",
|
|
456
|
-
headerIcon: "_headerIcon_7fktb_6",
|
|
457
|
-
headerLabel: "_headerLabel_7fktb_7",
|
|
458
|
-
downloadAllButton: "_downloadAllButton_7fktb_8",
|
|
459
|
-
imageTile: "_imageTile_7fktb_12"
|
|
460
|
-
}, Ie = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, Le = ({ attachments: e, onAttachmentClick: n, onDownloadAll: r, onRetry: s, labels: c, styles: l }) => {
|
|
461
|
-
let { ariaLabel: d = "Attachments", clickLabel: m = "Download attachment", retryLabel: g = "Retry upload", showLessLabel: v = "Show less", downloadAllLabel: y = "Download all", openInNewTabLabel: b, getHeaderLabel: x = (e) => Ie(e, "attachment"), promptLabel: S, pastedLabel: C, imageLabel: w } = c ?? {}, { typography: { headerLabelClassName: T = "dial-tiny-semi-text" } = {}, colors: E, className: D } = l ?? {}, O = a({
|
|
462
|
-
"--ci-group-bg": E?.background,
|
|
463
|
-
"--ci-group-border": E?.border,
|
|
464
|
-
"--ci-group-text": E?.text
|
|
465
|
-
}), [k, A] = f(!1), j = u(() => Se(e.length, k), [e.length, k]);
|
|
398
|
+
}, Me = {
|
|
399
|
+
headerIcon: "_headerIcon_1dmgi_1",
|
|
400
|
+
headerLabel: "_headerLabel_1dmgi_2"
|
|
401
|
+
}, Ne = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, Pe = ({ attachments: e, onAttachmentClick: n, onDownloadAll: o, onRetry: s, labels: c, styles: l, selectedAttachmentId: u }) => {
|
|
402
|
+
let { ariaLabel: d = "Attachments", clickLabel: f = "Download attachment", retryLabel: m = "Retry upload", downloadAllLabel: g = "Download all", openInNewTabLabel: _, getHeaderLabel: v = (e) => Ne(e, "attachment"), promptLabel: y, pastedLabel: b, imageLabel: x } = c ?? {}, { typography: S, colors: C, className: w } = l ?? {}, T = i({ "--ai-group-text": C?.text });
|
|
466
403
|
if (e.length === 0) return null;
|
|
467
|
-
let
|
|
468
|
-
let t = e.filter((e) => e.status ===
|
|
469
|
-
|
|
470
|
-
},
|
|
404
|
+
let E = e.some((e) => e.type === t.Image), D = e.some((e) => e.type !== t.Image), O = E && D, k = e.length >= 5, A = O ? B : E ? V : h, j = v(e.length), M = () => {
|
|
405
|
+
let t = e.filter((e) => e.status === r.Idle);
|
|
406
|
+
o ? o(t) : t.forEach((e) => n?.(e.id));
|
|
407
|
+
}, N = (t) => {
|
|
471
408
|
let n = e.find((e) => e.id === t);
|
|
472
|
-
n &&
|
|
409
|
+
n && o?.([n]);
|
|
473
410
|
};
|
|
474
411
|
return /* @__PURE__ */ q("div", {
|
|
475
412
|
role: "group",
|
|
476
413
|
"aria-label": d,
|
|
477
|
-
style:
|
|
478
|
-
className:
|
|
414
|
+
style: T,
|
|
415
|
+
className: a("flex flex-col gap-1", k ? "w-full min-w-0 max-w-[492px]" : "max-w-[420px]", Me.container, w),
|
|
479
416
|
children: [/* @__PURE__ */ q("div", {
|
|
480
|
-
className: "
|
|
481
|
-
children: [
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
417
|
+
className: "flex items-center justify-between",
|
|
418
|
+
children: [/* @__PURE__ */ q("div", {
|
|
419
|
+
className: "flex items-center gap-1",
|
|
420
|
+
children: [/* @__PURE__ */ K(A, {
|
|
421
|
+
size: U.SM,
|
|
422
|
+
className: a("shrink-0", Me.headerIcon),
|
|
485
423
|
"aria-hidden": !0
|
|
424
|
+
}), /* @__PURE__ */ K("span", {
|
|
425
|
+
className: a(S?.headerLabelClassName ?? "dial-tiny-semi-text", Me.headerLabel),
|
|
426
|
+
children: j
|
|
427
|
+
})]
|
|
428
|
+
}), e.length >= 2 && (o || n) && /* @__PURE__ */ K(ae, {
|
|
429
|
+
icon: /* @__PURE__ */ K(p, {
|
|
430
|
+
size: U.SM,
|
|
431
|
+
"aria-hidden": !0,
|
|
432
|
+
stroke: W
|
|
486
433
|
}),
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
icon: /* @__PURE__ */ K(h, {
|
|
493
|
-
size: W.SM,
|
|
494
|
-
"aria-hidden": !0
|
|
495
|
-
}),
|
|
496
|
-
className: o("ms-auto h-6 w-6 rounded-lg", $.downloadAllButton),
|
|
497
|
-
"aria-label": y,
|
|
498
|
-
onClick: z
|
|
499
|
-
})
|
|
500
|
-
]
|
|
501
|
-
}), /* @__PURE__ */ q("div", {
|
|
434
|
+
size: G.Small,
|
|
435
|
+
"aria-label": g,
|
|
436
|
+
onClick: M
|
|
437
|
+
})]
|
|
438
|
+
}), /* @__PURE__ */ K("div", {
|
|
502
439
|
role: "list",
|
|
503
|
-
"aria-label":
|
|
504
|
-
className:
|
|
505
|
-
children:
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
})
|
|
522
|
-
}, e.id)),
|
|
523
|
-
j.layout === J.Collapsed && /* @__PURE__ */ K("div", {
|
|
524
|
-
role: "listitem",
|
|
525
|
-
children: /* @__PURE__ */ K(Fe, {
|
|
526
|
-
count: j.hiddenCount,
|
|
527
|
-
onClick: () => A(!0)
|
|
528
|
-
})
|
|
529
|
-
}),
|
|
530
|
-
F && k && /* @__PURE__ */ K("div", {
|
|
531
|
-
role: "listitem",
|
|
532
|
-
children: /* @__PURE__ */ K(Fe, {
|
|
533
|
-
count: 0,
|
|
534
|
-
onClick: () => A(!1),
|
|
535
|
-
labels: { ariaLabel: v },
|
|
536
|
-
children: /* @__PURE__ */ K(p, {
|
|
537
|
-
size: W.MD,
|
|
538
|
-
"aria-hidden": !0
|
|
539
|
-
})
|
|
540
|
-
})
|
|
440
|
+
"aria-label": j,
|
|
441
|
+
className: a("gap-3", k ? "grid grid-cols-[repeat(5,83px)]" : "flex flex-wrap"),
|
|
442
|
+
children: e.map((e, t) => /* @__PURE__ */ K("div", {
|
|
443
|
+
role: "listitem",
|
|
444
|
+
children: /* @__PURE__ */ K($, {
|
|
445
|
+
attachment: e,
|
|
446
|
+
onClick: n,
|
|
447
|
+
onDownload: N,
|
|
448
|
+
onRetry: s,
|
|
449
|
+
labels: {
|
|
450
|
+
clickLabel: f,
|
|
451
|
+
retryLabel: m,
|
|
452
|
+
promptLabel: y,
|
|
453
|
+
pastedLabel: b,
|
|
454
|
+
imageLabel: x,
|
|
455
|
+
openInNewTabLabel: _
|
|
456
|
+
},
|
|
457
|
+
isSelected: e.id === u
|
|
541
458
|
})
|
|
542
|
-
|
|
459
|
+
}, `${e.id}-${t}`))
|
|
543
460
|
})]
|
|
544
461
|
});
|
|
545
|
-
},
|
|
546
|
-
overlay: "
|
|
547
|
-
icon: "
|
|
548
|
-
deniedIcon: "
|
|
549
|
-
},
|
|
550
|
-
let { title:
|
|
462
|
+
}, Fe = {
|
|
463
|
+
overlay: "_overlay_mzpdp_1",
|
|
464
|
+
icon: "_icon_mzpdp_5",
|
|
465
|
+
deniedIcon: "_deniedIcon_mzpdp_9"
|
|
466
|
+
}, Ie = ({ isVisible: e, isAttachmentsAllowed: t = !0, labels: n, styles: r }) => {
|
|
467
|
+
let { title: o, subtitle: s } = n ?? {}, { colors: c, typography: l } = r ?? {};
|
|
551
468
|
if (!e) return null;
|
|
552
|
-
let u =
|
|
553
|
-
"--fd-bg": c?.background,
|
|
554
|
-
"--fd-icon": c?.icon,
|
|
555
|
-
"--fd-denied-icon": c?.deniedIcon
|
|
556
|
-
}), d =
|
|
469
|
+
let u = i({
|
|
470
|
+
"--ai-fd-bg": c?.background,
|
|
471
|
+
"--ai-fd-icon": c?.icon,
|
|
472
|
+
"--ai-fd-denied-icon": c?.deniedIcon
|
|
473
|
+
}), d = o ?? (t ? "Attach files" : "No attachments allowed"), f = s ?? (t ? "Drop files here to attach them to message" : "Attachments can't be added to message"), p = t ? Fe.icon : Fe.deniedIcon, m = (e) => {
|
|
557
474
|
e.preventDefault();
|
|
558
|
-
}, h = t ?
|
|
475
|
+
}, h = t ? g : ee;
|
|
559
476
|
return /* @__PURE__ */ K("div", {
|
|
560
477
|
role: "status",
|
|
561
478
|
"aria-live": "polite",
|
|
562
|
-
className:
|
|
479
|
+
className: a("fixed inset-0 z-[9999] flex items-center justify-center backdrop-blur-sm", Fe.overlay, t ? "pointer-events-none" : "pointer-events-auto cursor-not-allowed"),
|
|
563
480
|
onDragOver: t ? void 0 : m,
|
|
564
481
|
onDrop: t ? void 0 : m,
|
|
565
482
|
style: u,
|
|
@@ -572,58 +489,58 @@ var ue = 5, de = 4, fe = "flex size-[84px] items-center justify-center rounded-x
|
|
|
572
489
|
"aria-hidden": !0
|
|
573
490
|
}),
|
|
574
491
|
/* @__PURE__ */ K("span", {
|
|
575
|
-
className:
|
|
492
|
+
className: a("mt-5", l?.titleClassName ?? "dial-h3-text"),
|
|
576
493
|
children: d
|
|
577
494
|
}),
|
|
578
495
|
/* @__PURE__ */ K("span", {
|
|
579
|
-
className:
|
|
496
|
+
className: a("mt-4", l?.subtitleClassName ?? "dial-small-text"),
|
|
580
497
|
children: f
|
|
581
498
|
})
|
|
582
499
|
]
|
|
583
500
|
})
|
|
584
501
|
});
|
|
585
|
-
},
|
|
586
|
-
let { screenshotName: a = "Screenshot.png", pastedTextName:
|
|
587
|
-
return { handlePaste:
|
|
588
|
-
if (!
|
|
589
|
-
let
|
|
590
|
-
if (
|
|
502
|
+
}, Le = (e, n, i = {}) => {
|
|
503
|
+
let { screenshotName: a = "Screenshot.png", pastedTextName: s = "Pasted text" } = i;
|
|
504
|
+
return { handlePaste: o((i) => {
|
|
505
|
+
if (!i.clipboardData) return;
|
|
506
|
+
let o = Array.from(i.clipboardData.items).filter((e) => e.kind === "file" && e.type.startsWith("image/")), c = i.clipboardData.getData("text/plain").length > 0;
|
|
507
|
+
if (o.length > 0 && !c) {
|
|
591
508
|
let n = [];
|
|
592
|
-
for (let e of
|
|
593
|
-
let
|
|
594
|
-
if (!
|
|
595
|
-
let o = new File([
|
|
596
|
-
id:
|
|
509
|
+
for (let e of o) {
|
|
510
|
+
let i = e.getAsFile();
|
|
511
|
+
if (!i) continue;
|
|
512
|
+
let o = new File([i], a, { type: i.type }), s = {
|
|
513
|
+
id: J(),
|
|
597
514
|
name: a,
|
|
598
|
-
contentType:
|
|
515
|
+
contentType: i.type,
|
|
599
516
|
file: o,
|
|
600
517
|
type: t.Image,
|
|
601
|
-
status:
|
|
518
|
+
status: r.Idle,
|
|
602
519
|
previewUrl: URL.createObjectURL(o)
|
|
603
520
|
};
|
|
604
521
|
n.push(s);
|
|
605
522
|
}
|
|
606
|
-
|
|
523
|
+
i.preventDefault(), e(n);
|
|
607
524
|
return;
|
|
608
525
|
}
|
|
609
|
-
let l =
|
|
526
|
+
let l = i.clipboardData.getData("text/plain");
|
|
610
527
|
if (l.length > n) {
|
|
611
|
-
let n = l.trim(), a = (n.length > 80 ? `${n.slice(0, 80).trimEnd()}…` : n) ||
|
|
612
|
-
id:
|
|
528
|
+
let n = l.trim(), a = (n.length > 80 ? `${n.slice(0, 80).trimEnd()}…` : n) || s, o = new File([l], a, { type: "text/plain" }), c = {
|
|
529
|
+
id: J(),
|
|
613
530
|
name: a,
|
|
614
531
|
contentType: "text/plain",
|
|
615
|
-
file:
|
|
532
|
+
file: o,
|
|
616
533
|
type: t.Pasted,
|
|
617
|
-
status:
|
|
534
|
+
status: r.Idle
|
|
618
535
|
};
|
|
619
|
-
|
|
536
|
+
i.preventDefault(), e([c]);
|
|
620
537
|
}
|
|
621
538
|
}, [
|
|
622
539
|
e,
|
|
623
540
|
n,
|
|
624
541
|
a,
|
|
625
|
-
|
|
542
|
+
s
|
|
626
543
|
]) };
|
|
627
|
-
},
|
|
544
|
+
}, Re = 100;
|
|
628
545
|
//#endregion
|
|
629
|
-
export {
|
|
546
|
+
export { xe as ATTACHMENT_COLLAPSE_THRESHOLD, $ as AttachmentCard, Pe as AttachmentGroup, je as AttachmentTray, Ie as FileDndOverlay, Q as LazyImageLoadStatus, Re as MAX_UPLOADS_PER_MINUTE, J as generateAttachmentId, Y as getAttachmentCardState, _e as getAttachmentIcon, ye as getExtFromContentType, fe as getNameWithoutExtension, ge as isMimeTypeAllowed, he as mimeTypesToExtensionLabels, Le as useClipboardPaste, ke as useLazyImageLoad };
|