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