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