@epam/ai-dial-attachment-input 1.1.0-dev.53 → 1.1.0-dev.56

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.
@@ -1 +1 @@
1
- {"version":3,"file":"Audio.d.ts","sourceRoot":"","sources":["../../../../src/components/AttachmentCard/Attachments/Audio.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAGlB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,EAAsB,MAAM,OAAO,CAAC;AACnE,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,iCAAiC,CAAC;AAIzC,UAAU,oBAAoB;IAC5B,UAAU,EAAE,iBAAiB,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+EAA+E;IAC/E,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,uDAAuD;IACvD,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,qDAAqD;IACrD,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED,8EAA8E;AAC9E,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CAuFpD,CAAC"}
1
+ {"version":3,"file":"Audio.d.ts","sourceRoot":"","sources":["../../../../src/components/AttachmentCard/Attachments/Audio.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAgB,MAAM,2BAA2B,CAAC;AAE5E,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,EAAsB,MAAM,OAAO,CAAC;AACnE,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,iCAAiC,CAAC;AAIzC,UAAU,oBAAoB;IAC5B,UAAU,EAAE,iBAAiB,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+EAA+E;IAC/E,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,uDAAuD;IACvD,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,qDAAqD;IACrD,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED,8EAA8E;AAC9E,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CAuFpD,CAAC"}
package/index.js CHANGED
@@ -1,7 +1,7 @@
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 H, IconPhoto as U, IconReload as ne, IconTerminal2 as re, IconVideo as ie, IconX as ae } from "@tabler/icons-react";
4
- import { DIAL_ICON_SIZE as W, DialGhostIconButton as oe, DialSkeleton as se, DialSkeletonVariant as ce, ElementSize as le } from "@epam/ai-dial-ui-kit";
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 { IconChevronUp as f, IconClipboard as p, IconDownload as m, IconExternalLink as h, IconFile as g, IconFileDescription as _, IconFileTypeBmp as v, IconFileTypeCss as y, IconFileTypeCsv as b, IconFileTypeDoc as x, IconFileTypeDocx as S, IconFileTypeHtml as C, IconFileTypeJpg as w, IconFileTypeJs as T, IconFileTypeJsx as E, IconFileTypePdf as D, IconFileTypePhp as O, IconFileTypePng as k, IconFileTypePpt as A, IconFileTypeRs as j, IconFileTypeSql as M, IconFileTypeSvg as N, IconFileTypeTs as P, IconFileTypeTsx as F, IconFileTypeTxt as I, IconFileTypeVue as L, IconFileTypeXls as R, IconFileTypeXml as z, IconFileTypeZip as B, IconFileX as V, IconMusic as ee, IconPaperclip as te, IconPhoto as H, IconReload as U, IconTerminal2 as ne, IconVideo as re, IconX as ie } from "@tabler/icons-react";
4
+ import { DIAL_ICON_SIZE as W, DialGhostIconButton as ae, DialSkeleton as oe, DialSkeletonVariant as se, ElementSize as ce, Highlight as le } from "@epam/ai-dial-ui-kit";
5
5
  import { Fragment as G, jsx as K, jsxs as q } from "react/jsx-runtime";
6
6
  //#region src/constants/attachment-group.ts
7
7
  var ue = 5, de = 4, fe = "flex size-[84px] items-center justify-center rounded-xl border", J = /* @__PURE__ */ function(e) {
@@ -29,60 +29,60 @@ var ue = 5, de = 4, fe = "flex size-[84px] items-center justify-center rounded-x
29
29
  }
30
30
  return e === t;
31
31
  }), ve = (e) => {
32
- if (!e) return _;
32
+ if (!e) return g;
33
33
  if (e.startsWith("image/")) switch (e) {
34
34
  case "image/jpeg":
35
- case "image/jpg": return T;
36
- case "image/png": return A;
37
- case "image/svg+xml": return P;
38
- case "image/bmp": return y;
39
- default: return U;
35
+ case "image/jpg": return w;
36
+ case "image/png": return k;
37
+ case "image/svg+xml": return N;
38
+ case "image/bmp": return v;
39
+ default: return H;
40
40
  }
41
- if (e.startsWith("video/")) return ie;
42
- if (e.startsWith("audio/")) return te;
41
+ if (e.startsWith("video/")) return re;
42
+ if (e.startsWith("audio/")) return ee;
43
43
  switch (e) {
44
- case "application/pdf": return O;
44
+ case "application/pdf": return D;
45
45
  case "application/msword":
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;
46
+ case "application/vnd.ms-word": return x;
47
+ case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": return S;
48
+ case "application/vnd.ms-powerpoint": return A;
49
+ case "application/vnd.openxmlformats-officedocument.presentationml.presentation": return A;
50
+ case "application/vnd.ms-excel": return R;
51
+ case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": return R;
52
52
  case "application/zip":
53
53
  case "application/x-zip-compressed":
54
54
  case "application/x-rar-compressed":
55
55
  case "application/x-7z-compressed":
56
56
  case "application/gzip":
57
- case "application/x-tar": return V;
58
- case "text/csv": return x;
59
- case "text/plain": return L;
57
+ case "application/x-tar": return B;
58
+ case "text/csv": return b;
59
+ case "text/plain": return I;
60
60
  case "text/html":
61
- case "application/xhtml+xml": return w;
61
+ case "application/xhtml+xml": return C;
62
62
  case "text/xml":
63
- case "application/xml": return B;
63
+ case "application/xml": return z;
64
64
  case "application/sql":
65
- case "text/x-sql": return N;
65
+ case "text/x-sql": return M;
66
66
  case "text/javascript":
67
- case "application/javascript": return E;
68
- case "text/jsx": return D;
67
+ case "application/javascript": return T;
68
+ case "text/jsx": return E;
69
69
  case "application/typescript":
70
- case "text/typescript": return F;
71
- case "text/tsx": return I;
72
- case "text/css": return b;
70
+ case "text/typescript": return P;
71
+ case "text/tsx": return F;
72
+ case "text/css": return y;
73
73
  case "text/x-php":
74
- case "application/x-php": return k;
74
+ case "application/x-php": return O;
75
75
  case "text/x-rustsrc":
76
- case "application/x-rust": return M;
77
- case "text/x-vue": return R;
78
- default: return _;
76
+ case "application/x-rust": return j;
77
+ case "text/x-vue": return L;
78
+ default: return g;
79
79
  }
80
80
  }, ye = (e) => {
81
81
  let { type: n, contentType: r } = e;
82
- return n === t.Prompt ? re : n === t.Pasted ? m : n === t.Image ? U : ve(r ?? "");
82
+ return n === t.Prompt ? ne : n === t.Pasted ? p : n === t.Image ? H : ve(r ?? "");
83
83
  }, be = (e) => {
84
- let t = e.toLowerCase().split(";")[0].trim(), n = r[t];
85
- if (n) return n;
84
+ let t = e.toLowerCase().split(";")[0].trim(), r = n[t];
85
+ if (r) return r;
86
86
  let i = t.split("/")[1];
87
87
  if (i && !i.startsWith("vnd.") && !i.includes("+")) return i;
88
88
  }, xe = (e, n) => {
@@ -97,7 +97,7 @@ var ue = 5, de = 4, fe = "flex size-[84px] items-center justify-center rounded-x
97
97
  let o = i.lastIndexOf(".");
98
98
  return o > 0 && o < i.length - 1 ? `.${i.slice(o + 1).toLowerCase()}` : i;
99
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;
100
+ 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.Audio && !l, f = i === t.Link && !l;
101
101
  return {
102
102
  isLoading: c,
103
103
  isError: l,
@@ -130,62 +130,62 @@ var ue = 5, de = 4, fe = "flex size-[84px] items-center justify-center rounded-x
130
130
  track: "_track_3x6ks_48",
131
131
  indeterminateFill: "_indeterminateFill_3x6ks_52",
132
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),
133
+ }, Z = ({ ariaLabel: e, errorTitle: t, errorDescId: n, onClick: r, id: i, icon: o, className: s }) => /* @__PURE__ */ K(ae, {
134
+ icon: o,
135
+ size: ce.Small,
136
+ className: a("absolute end-1 top-1 h-6 w-6 rounded-lg", s ?? X.hoverIcon),
137
137
  "aria-label": e,
138
138
  "aria-describedby": t ? n : void 0,
139
139
  onClick: (e) => {
140
140
  e.stopPropagation(), r(i);
141
141
  }
142
142
  }), Ce = ({ ...e }) => /* @__PURE__ */ K(Z, {
143
- icon: /* @__PURE__ */ K(ne, {
143
+ icon: /* @__PURE__ */ K(U, {
144
144
  size: W.SM,
145
145
  "aria-hidden": !0
146
146
  }),
147
147
  className: X.retryIcon,
148
148
  ...e
149
149
  }), we = ({ ...e }) => /* @__PURE__ */ K(Z, {
150
- icon: /* @__PURE__ */ K(h, {
150
+ icon: /* @__PURE__ */ K(m, {
151
151
  size: W.SM,
152
152
  "aria-hidden": !0
153
153
  }),
154
154
  ...e
155
155
  }), Te = ({ ...e }) => /* @__PURE__ */ K(Z, {
156
- icon: /* @__PURE__ */ K(g, {
156
+ icon: /* @__PURE__ */ K(h, {
157
157
  size: W.SM,
158
158
  "aria-hidden": !0
159
159
  }),
160
160
  ...e
161
161
  }), Ee = ({ ...e }) => /* @__PURE__ */ K(Z, {
162
- icon: /* @__PURE__ */ K(ae, {
162
+ icon: /* @__PURE__ */ K(ie, {
163
163
  size: W.SM,
164
164
  "aria-hidden": !0
165
165
  }),
166
166
  className: X.hoverIcon,
167
167
  ...e
168
- }), De = ({ attachment: e, searchQuery: t = "", onClick: r, onDownload: i, onRemove: a, labels: s, styles: c, cssVars: l }) => {
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);
168
+ }), De = ({ attachment: e, searchQuery: t = "", onClick: n, onDownload: r, onRemove: i, labels: o, styles: s, cssVars: c }) => {
169
+ let { clickLabel: l = "Open attachment", downloadLabel: u = "Download attachment", removeLabel: d = "Remove attachment" } = o ?? {}, { typography: f, className: p } = s ?? {}, m = () => {
170
+ n?.(e.id);
171
171
  };
172
172
  return /* @__PURE__ */ q("div", {
173
- style: l,
174
- ...r == null ? {} : {
173
+ style: c,
174
+ ...n == null ? {} : {
175
175
  role: "button",
176
176
  tabIndex: 0,
177
- "aria-label": u,
178
- onClick: h,
177
+ "aria-label": l,
178
+ onClick: m,
179
179
  onKeyDown: (e) => {
180
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), h());
180
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), m());
181
181
  }
182
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),
183
+ className: a("group relative flex w-full min-w-[280px] max-w-[300px] flex-col gap-2 rounded-xl border p-3", n && "cursor-pointer", (r || i) && "pe-8", p),
184
184
  children: [
185
185
  /* @__PURE__ */ K("span", {
186
186
  title: e.name,
187
- className: o(p?.fontClassName ?? "dial-tiny-text", "min-w-0 truncate", X.nameText),
188
- children: t ? /* @__PURE__ */ K(n, {
187
+ className: a(f?.fontClassName ?? "dial-tiny-text", "min-w-0 truncate", X.nameText),
188
+ children: t ? /* @__PURE__ */ K(le, {
189
189
  text: e.name,
190
190
  query: t,
191
191
  maxLines: 1
@@ -199,14 +199,14 @@ var ue = 5, de = 4, fe = "flex size-[84px] items-center justify-center rounded-x
199
199
  preload: "metadata",
200
200
  onClick: (e) => e.stopPropagation()
201
201
  }),
202
- i && /* @__PURE__ */ K(we, {
203
- ariaLabel: d,
204
- onClick: i,
202
+ r && /* @__PURE__ */ K(we, {
203
+ ariaLabel: u,
204
+ onClick: r,
205
205
  id: e.id
206
206
  }),
207
- a && /* @__PURE__ */ K(Ee, {
208
- ariaLabel: f,
209
- onClick: a,
207
+ i && /* @__PURE__ */ K(Ee, {
208
+ ariaLabel: d,
209
+ onClick: i,
210
210
  id: e.id
211
211
  })
212
212
  ]
@@ -214,23 +214,23 @@ var ue = 5, de = 4, fe = "flex size-[84px] items-center justify-center rounded-x
214
214
  }, Oe = {
215
215
  [e.Network]: "Upload failed · network error",
216
216
  [e.UnsupportedType]: "Upload failed · unsupported file type"
217
- }, ke = ({ attachment: t, onClick: n, onRetry: r, labels: a, styles: c, onDownload: d, isPasted: f, isLink: p, cssVars: m, onExpand: h, isExpandable: g, onRemove: _ }) => {
218
- 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) => {
217
+ }, ke = ({ attachment: t, onClick: n, onRetry: i, labels: s, styles: u, onDownload: d, isPasted: f, isLink: p, cssVars: m, onExpand: h, isExpandable: g, onRemove: _ }) => {
218
+ let { clickLabel: v = "Download attachment", retryLabel: y = "Retry upload", sizeLabel: b, uploadingLabel: x = "Uploading", errorReasonLabels: S, genericErrorLabel: C = "Upload failed" } = s ?? {}, { typography: { nameClassName: w = "dial-caption-text", metaClassName: T = "dial-caption-text" } = {}, className: E } = u ?? {}, { id: D, name: O, status: k, errorReason: A } = t, j = k === r.Loading, M = k === r.Error, N = c(), P = M ? A && (S?.[A] ?? Oe[A]) || C : "", { BottomIcon: F, typeLabel: I } = Y(t), L = !M && !j && d && !p, R = M && !!i && A !== e.UnsupportedType, z = L || R ? "pe-5" : void 0, B = (e) => {
219
219
  (e.key === "Enter" || e.key === " ") && (e.preventDefault(), n?.(t.id));
220
- }, V = u(() => f ? O : me(O), [f, O]), ee = s(() => {
220
+ }, V = l(() => f ? O : me(O), [f, O]), ee = o(() => {
221
221
  window.open(t.referenceUrl, "_blank", "noopener,noreferrer");
222
- }, [t]), te = o(fe, "group relative flex-col justify-between items-start gap-1 overflow-hidden p-1.5", X.tile, !M && X.tileLight, M && X.tileError), H = /* @__PURE__ */ K("div", {
222
+ }, [t]), te = a(fe, "group relative flex-col justify-between items-start gap-1 overflow-hidden p-1.5", X.tile, !M && X.tileLight, M && X.tileError), H = /* @__PURE__ */ K("div", {
223
223
  title: V,
224
- className: o(w, "line-clamp-2 min-w-0 break-all", X.nameText, !M && z),
224
+ className: a(w, "line-clamp-2 min-w-0 break-all", X.nameText, !M && z),
225
225
  children: V
226
226
  }), U = F && /* @__PURE__ */ q("div", {
227
- className: o("flex w-full items-center gap-1", M && z),
227
+ className: a("flex w-full items-center gap-1", M && z),
228
228
  children: [/* @__PURE__ */ K(F, {
229
229
  size: 16,
230
230
  className: X.typeText,
231
231
  "aria-hidden": !0
232
232
  }), /* @__PURE__ */ K("span", {
233
- className: o(T, "min-w-0 flex-1 truncate", X.typeText),
233
+ className: a(T, "min-w-0 flex-1 truncate", X.typeText),
234
234
  children: b ? `${I} · ${b}` : I
235
235
  })]
236
236
  }), ne = () => {
@@ -240,8 +240,8 @@ var ue = 5, de = 4, fe = "flex size-[84px] items-center justify-center rounded-x
240
240
  j && /* @__PURE__ */ K("div", {
241
241
  role: "progressbar",
242
242
  "aria-label": x,
243
- className: o("absolute inset-x-2 bottom-2 h-[3px] overflow-hidden rounded-full", X.track),
244
- children: /* @__PURE__ */ K("div", { className: o("h-full w-1/3 rounded-full", X.indeterminateFill) })
243
+ className: a("absolute inset-x-2 bottom-2 h-[3px] overflow-hidden rounded-full", X.track),
244
+ children: /* @__PURE__ */ K("div", { className: a("h-full w-1/3 rounded-full", X.indeterminateFill) })
245
245
  }),
246
246
  L && /* @__PURE__ */ K(we, {
247
247
  ariaLabel: v,
@@ -254,7 +254,7 @@ var ue = 5, de = 4, fe = "flex size-[84px] items-center justify-center rounded-x
254
254
  ariaLabel: y,
255
255
  errorTitle: P,
256
256
  errorDescId: N,
257
- onClick: r,
257
+ onClick: i,
258
258
  id: D
259
259
  }),
260
260
  p && /* @__PURE__ */ K(Te, {
@@ -280,7 +280,7 @@ var ue = 5, de = 4, fe = "flex size-[84px] items-center justify-center rounded-x
280
280
  ] });
281
281
  return /* @__PURE__ */ K("div", {
282
282
  style: m,
283
- className: o("inline-flex", E),
283
+ className: a("inline-flex", E),
284
284
  children: /* @__PURE__ */ K("div", {
285
285
  role: "button",
286
286
  tabIndex: 0,
@@ -288,17 +288,17 @@ var ue = 5, de = 4, fe = "flex size-[84px] items-center justify-center rounded-x
288
288
  onClick: ne,
289
289
  onKeyDown: B,
290
290
  style: m,
291
- className: o(te, "cursor-pointer focus-within:outline focus-within:outline-1 focus-within:outline-offset-1"),
291
+ className: a(te, "cursor-pointer focus-within:outline focus-within:outline-1 focus-within:outline-offset-1"),
292
292
  children: re
293
293
  })
294
294
  });
295
295
  }, Q = /* @__PURE__ */ function(e) {
296
296
  return e.Idle = "idle", e.Loading = "loading", e.Loaded = "loaded", e.Error = "error", e;
297
297
  }({}), Ae = ({ enabled: e, src: t }) => {
298
- let n = d(null), [r, i] = f("idle");
299
- return c(() => {
298
+ let n = u(null), [r, i] = d("idle");
299
+ return s(() => {
300
300
  i(e && t ? "loading" : "idle");
301
- }, [e, t]), c(() => {
301
+ }, [e, t]), s(() => {
302
302
  let r = n.current;
303
303
  if (!r || !e || !t) return;
304
304
  let a = () => i("loaded"), o = () => i("error");
@@ -309,15 +309,15 @@ var ue = 5, de = 4, fe = "flex size-[84px] items-center justify-center rounded-x
309
309
  imageRef: n,
310
310
  imageLoadStatus: r
311
311
  };
312
- }, je = ({ attachment: e, onExpand: n, onClick: r, labels: i, onRemove: a, cssVars: s, onDownload: c, styles: l }) => {
313
- 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({
312
+ }, je = ({ attachment: e, onExpand: n, onClick: r, labels: i, onRemove: o, cssVars: s, onDownload: c, styles: u }) => {
313
+ let { clickLabel: d = "Open attachment", expandLabel: f = "Expand pasted text" } = i ?? {}, { typography: p, className: m } = u ?? {}, { id: h, name: g } = e, _ = e.previewUrl ?? e.url, v = e.type === t.Pasted && n !== void 0, { isLoading: y, isError: b, isImage: x } = l(() => Y(e), [e]), S = r !== void 0 && !v && !y && !b, { imageRef: C, imageLoadStatus: w } = Ae({
314
314
  enabled: x,
315
315
  src: _
316
316
  }), T = () => {
317
317
  v && n ? n(h) : S && r && r(h);
318
318
  };
319
319
  return /* @__PURE__ */ K("div", {
320
- className: o(fe, S && "cursor-pointer", X.tile, m),
320
+ className: a(fe, S && "cursor-pointer", X.tile, m),
321
321
  onClick: T,
322
322
  onKeyDown: (e) => {
323
323
  (e.key === "Enter" || e.key === " ") && (e.preventDefault(), T());
@@ -329,20 +329,20 @@ var ue = 5, de = 4, fe = "flex size-[84px] items-center justify-center rounded-x
329
329
  children: /* @__PURE__ */ q("div", {
330
330
  className: "relative h-full w-full overflow-hidden",
331
331
  children: [
332
- a && /* @__PURE__ */ K(Ee, {
333
- onClick: a,
332
+ o && /* @__PURE__ */ K(Ee, {
333
+ onClick: o,
334
334
  id: h
335
335
  }),
336
336
  c && /* @__PURE__ */ K(we, {
337
337
  onClick: c,
338
338
  id: h
339
339
  }),
340
- w !== Q.Loaded && /* @__PURE__ */ K(se, {
341
- variant: ce.Rectangular,
340
+ w !== Q.Loaded && /* @__PURE__ */ K(oe, {
341
+ variant: se.Rectangular,
342
342
  width: "100%",
343
343
  height: "100%",
344
344
  active: w === Q.Loading,
345
- overlay: /* @__PURE__ */ K(U, {
345
+ overlay: /* @__PURE__ */ K(H, {
346
346
  size: W.LG,
347
347
  className: p?.placeholderIconClassName ?? "text-secondary",
348
348
  "aria-hidden": !0
@@ -355,13 +355,13 @@ var ue = 5, de = 4, fe = "flex size-[84px] items-center justify-center rounded-x
355
355
  alt: g,
356
356
  loading: "lazy",
357
357
  decoding: "async",
358
- className: o("h-full w-full rounded-xl object-cover transition-opacity duration-200", w === Q.Loaded ? "opacity-100" : "opacity-0")
358
+ className: a("h-full w-full rounded-xl object-cover transition-opacity duration-200", w === Q.Loaded ? "opacity-100" : "opacity-0")
359
359
  })
360
360
  ]
361
361
  })
362
362
  });
363
- }, Me = ({ attachment: e, searchQuery: n = "", onRemove: r, onRetry: i, onExpand: o, onClick: s, onDownload: c, labels: l, styles: d }) => {
364
- let { colors: f } = d ?? {}, p = e.type === t.Pasted, m = p && o !== void 0, h = a({
363
+ }, Me = ({ attachment: e, searchQuery: n = "", onRemove: r, onRetry: a, onExpand: o, onClick: s, onDownload: c, labels: u, styles: d }) => {
364
+ let { colors: f } = d ?? {}, p = e.type === t.Pasted, m = p && o !== void 0, h = i({
365
365
  "--ci-tile-bg": f?.background,
366
366
  "--ci-tile-border": f?.border,
367
367
  "--ci-tile-border-hover": f?.borderHover,
@@ -375,10 +375,10 @@ var ue = 5, de = 4, fe = "flex size-[84px] items-center justify-center rounded-x
375
375
  "--ci-tile-hover-icon-color": f?.hoverIconColor,
376
376
  "--ci-tile-track-bg": f?.trackBackground,
377
377
  "--ci-tile-fill-bg": f?.fillBackground
378
- }), { isImage: g, isAudio: _, isLink: v } = u(() => Y(e), [e]);
378
+ }), { isImage: g, isAudio: _, isLink: v } = l(() => Y(e), [e]);
379
379
  return _ ? /* @__PURE__ */ K(De, {
380
380
  attachment: e,
381
- labels: l,
381
+ labels: u,
382
382
  onClick: s,
383
383
  onDownload: c,
384
384
  onRemove: r,
@@ -387,7 +387,7 @@ var ue = 5, de = 4, fe = "flex size-[84px] items-center justify-center rounded-x
387
387
  cssVars: h
388
388
  }) : g ? /* @__PURE__ */ K(je, {
389
389
  attachment: e,
390
- labels: l,
390
+ labels: u,
391
391
  onClick: s,
392
392
  onExpand: o,
393
393
  styles: d,
@@ -397,23 +397,23 @@ var ue = 5, de = 4, fe = "flex size-[84px] items-center justify-center rounded-x
397
397
  }) : /* @__PURE__ */ K(ke, {
398
398
  attachment: e,
399
399
  onClick: s,
400
- onRetry: i,
400
+ onRetry: a,
401
401
  onRemove: r,
402
402
  onDownload: c,
403
403
  isLink: v,
404
404
  isPasted: p,
405
405
  styles: d,
406
- labels: l,
406
+ labels: u,
407
407
  onExpand: o,
408
408
  cssVars: h,
409
409
  isExpandable: m
410
410
  });
411
- }, Ne = ({ attachments: e, onRemove: t, onRetry: n, onExpand: r, onAttachmentClick: i, labels: a, styles: s }) => {
412
- let { ariaLabel: c = "Attached files", removeLabel: l, retryLabel: u, clickLabel: d } = a ?? {}, { className: f } = s ?? {};
411
+ }, Ne = ({ attachments: e, onRemove: t, onRetry: n, onExpand: r, onAttachmentClick: i, labels: o, styles: s }) => {
412
+ let { ariaLabel: c = "Attached files", removeLabel: l, retryLabel: u, clickLabel: d } = o ?? {}, { className: f } = s ?? {};
413
413
  return e.length === 0 ? null : /* @__PURE__ */ K("div", {
414
414
  role: "list",
415
415
  "aria-label": c,
416
- className: o("flex w-full min-w-0 gap-2 overflow-x-auto", f),
416
+ className: a("flex w-full min-w-0 gap-2 overflow-x-auto", f),
417
417
  children: e.map((e) => /* @__PURE__ */ K("div", {
418
418
  role: "listitem",
419
419
  children: /* @__PURE__ */ K(Me, {
@@ -430,8 +430,8 @@ var ue = 5, de = 4, fe = "flex size-[84px] items-center justify-center rounded-x
430
430
  })
431
431
  }, e.id))
432
432
  });
433
- }, Pe = { tile: "_tile_nzsrz_1" }, Fe = ({ count: e, onClick: t, labels: n, children: r, styles: i }) => {
434
- let { ariaLabel: s } = n ?? {}, { typography: { fontClassName: c = "dial-small-semi-text" } = {}, className: l, colors: u } = i ?? {}, d = a({
433
+ }, Pe = { tile: "_tile_nzsrz_1" }, Fe = ({ count: e, onClick: t, labels: n, children: r, styles: o }) => {
434
+ let { ariaLabel: s } = n ?? {}, { typography: { fontClassName: c = "dial-small-semi-text" } = {}, className: l, colors: u } = o ?? {}, d = i({
435
435
  "--ci-more-tile-bg": u?.background,
436
436
  "--ci-more-tile-border": u?.border,
437
437
  "--ci-more-tile-color": u?.color,
@@ -445,7 +445,7 @@ var ue = 5, de = 4, fe = "flex size-[84px] items-center justify-center rounded-x
445
445
  onClick: t,
446
446
  "aria-label": s ?? `Show ${e} more attachments`,
447
447
  style: d,
448
- className: o(fe, c, Pe.tile, l),
448
+ className: a(fe, c, Pe.tile, l),
449
449
  children: r ?? /* @__PURE__ */ K("bdi", {
450
450
  dir: "ltr",
451
451
  children: `+${e}`
@@ -457,43 +457,43 @@ var ue = 5, de = 4, fe = "flex size-[84px] items-center justify-center rounded-x
457
457
  headerLabel: "_headerLabel_7fktb_7",
458
458
  downloadAllButton: "_downloadAllButton_7fktb_8",
459
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({
460
+ }, Ie = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, Le = ({ attachments: e, onAttachmentClick: n, onDownloadAll: o, onRetry: s, labels: c, styles: u }) => {
461
+ let { ariaLabel: p = "Attachments", clickLabel: h = "Download attachment", retryLabel: _ = "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 } = u ?? {}, O = i({
462
462
  "--ci-group-bg": E?.background,
463
463
  "--ci-group-border": E?.border,
464
464
  "--ci-group-text": E?.text
465
- }), [k, A] = f(!1), j = u(() => Se(e.length, k), [e.length, k]);
465
+ }), [k, A] = d(!1), j = l(() => Se(e.length, k), [e.length, k]);
466
466
  if (e.length === 0) return null;
467
- 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 ? H : M ? U : _, L = x(e.length), R = e.slice(0, j.visibleCount), z = () => {
468
- let t = e.filter((e) => e.status === i.Idle);
469
- r ? r(t) : t.forEach((e) => n?.(e.id));
467
+ 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 ? te : M ? H : g, L = x(e.length), R = e.slice(0, j.visibleCount), z = () => {
468
+ let t = e.filter((e) => e.status === r.Idle);
469
+ o ? o(t) : t.forEach((e) => n?.(e.id));
470
470
  }, B = (t) => {
471
471
  let n = e.find((e) => e.id === t);
472
- n && r?.([n]);
472
+ n && o?.([n]);
473
473
  };
474
474
  return /* @__PURE__ */ q("div", {
475
475
  role: "group",
476
- "aria-label": d,
476
+ "aria-label": p,
477
477
  style: O,
478
- className: o("rounded-2xl border p-3", F ? "w-full min-w-0 max-w-[492px]" : "max-w-[420px]", $.container, D),
478
+ className: a("rounded-2xl border p-3", F ? "w-full min-w-0 max-w-[492px]" : "max-w-[420px]", $.container, D),
479
479
  children: [/* @__PURE__ */ q("div", {
480
480
  className: "mb-3 flex min-h-6 items-center gap-2",
481
481
  children: [
482
482
  /* @__PURE__ */ K(I, {
483
483
  size: W.SM,
484
- className: o("shrink-0", $.headerIcon),
484
+ className: a("shrink-0", $.headerIcon),
485
485
  "aria-hidden": !0
486
486
  }),
487
487
  /* @__PURE__ */ K("span", {
488
- className: o(T, $.headerLabel),
488
+ className: a(T, $.headerLabel),
489
489
  children: L
490
490
  }),
491
- e.length >= 2 && (r || n) && /* @__PURE__ */ K(oe, {
492
- icon: /* @__PURE__ */ K(h, {
491
+ e.length >= 2 && (o || n) && /* @__PURE__ */ K(ae, {
492
+ icon: /* @__PURE__ */ K(m, {
493
493
  size: W.SM,
494
494
  "aria-hidden": !0
495
495
  }),
496
- className: o("ms-auto h-6 w-6 rounded-lg", $.downloadAllButton),
496
+ className: a("ms-auto h-6 w-6 rounded-lg", $.downloadAllButton),
497
497
  "aria-label": y,
498
498
  onClick: z
499
499
  })
@@ -501,7 +501,7 @@ var ue = 5, de = 4, fe = "flex size-[84px] items-center justify-center rounded-x
501
501
  }), /* @__PURE__ */ q("div", {
502
502
  role: "list",
503
503
  "aria-label": L,
504
- className: o("gap-3", F ? "grid grid-cols-[repeat(5,83px)] overflow-x-auto" : "flex flex-wrap"),
504
+ className: a("gap-3", F ? "grid grid-cols-[repeat(5,83px)] overflow-x-auto" : "flex flex-wrap"),
505
505
  children: [
506
506
  R.map((e) => /* @__PURE__ */ K("div", {
507
507
  role: "listitem",
@@ -511,8 +511,8 @@ var ue = 5, de = 4, fe = "flex size-[84px] items-center justify-center rounded-x
511
511
  onDownload: B,
512
512
  onRetry: s,
513
513
  labels: {
514
- clickLabel: m,
515
- retryLabel: g,
514
+ clickLabel: h,
515
+ retryLabel: _,
516
516
  promptLabel: S,
517
517
  pastedLabel: C,
518
518
  imageLabel: w,
@@ -533,7 +533,7 @@ var ue = 5, de = 4, fe = "flex size-[84px] items-center justify-center rounded-x
533
533
  count: 0,
534
534
  onClick: () => A(!1),
535
535
  labels: { ariaLabel: v },
536
- children: /* @__PURE__ */ K(p, {
536
+ children: /* @__PURE__ */ K(f, {
537
537
  size: W.MD,
538
538
  "aria-hidden": !0
539
539
  })
@@ -547,19 +547,19 @@ var ue = 5, de = 4, fe = "flex size-[84px] items-center justify-center rounded-x
547
547
  icon: "_icon_1f3nw_5",
548
548
  deniedIcon: "_deniedIcon_1f3nw_9"
549
549
  }, ze = ({ isVisible: e, isAttachmentsAllowed: t = !0, labels: n, styles: r }) => {
550
- let { title: i, subtitle: s } = n ?? {}, { colors: c, typography: l } = r ?? {};
550
+ let { title: o, subtitle: s } = n ?? {}, { colors: c, typography: l } = r ?? {};
551
551
  if (!e) return null;
552
- let u = a({
552
+ let u = i({
553
553
  "--fd-bg": c?.background,
554
554
  "--fd-icon": c?.icon,
555
555
  "--fd-denied-icon": c?.deniedIcon
556
- }), d = i ?? (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 ? Re.icon : Re.deniedIcon, m = (e) => {
556
+ }), 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 ? Re.icon : Re.deniedIcon, m = (e) => {
557
557
  e.preventDefault();
558
- }, h = t ? v : ee;
558
+ }, h = t ? _ : V;
559
559
  return /* @__PURE__ */ K("div", {
560
560
  role: "status",
561
561
  "aria-live": "polite",
562
- 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"),
562
+ className: a("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"),
563
563
  onDragOver: t ? void 0 : m,
564
564
  onDrop: t ? void 0 : m,
565
565
  style: u,
@@ -572,57 +572,57 @@ var ue = 5, de = 4, fe = "flex size-[84px] items-center justify-center rounded-x
572
572
  "aria-hidden": !0
573
573
  }),
574
574
  /* @__PURE__ */ K("span", {
575
- className: o("mt-5", l?.titleClassName ?? "dial-h3-text"),
575
+ className: a("mt-5", l?.titleClassName ?? "dial-h3-text"),
576
576
  children: d
577
577
  }),
578
578
  /* @__PURE__ */ K("span", {
579
- className: o("mt-4", l?.subtitleClassName ?? "dial-small-text"),
579
+ className: a("mt-4", l?.subtitleClassName ?? "dial-small-text"),
580
580
  children: f
581
581
  })
582
582
  ]
583
583
  })
584
584
  });
585
- }, Be = (e, n, r = {}) => {
586
- let { screenshotName: a = "Screenshot.png", pastedTextName: o = "Pasted text" } = r;
587
- return { handlePaste: s((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) {
585
+ }, Be = (e, n, i = {}) => {
586
+ let { screenshotName: a = "Screenshot.png", pastedTextName: s = "Pasted text" } = i;
587
+ return { handlePaste: o((i) => {
588
+ if (!i.clipboardData) return;
589
+ let o = Array.from(i.clipboardData.items).filter((e) => e.kind === "file" && e.type.startsWith("image/")), c = i.clipboardData.getData("text/plain").length > 0;
590
+ if (o.length > 0 && !c) {
591
591
  let n = [];
592
- for (let e of s) {
593
- let r = e.getAsFile();
594
- if (!r) continue;
595
- let o = new File([r], a, { type: r.type }), s = {
592
+ for (let e of o) {
593
+ let i = e.getAsFile();
594
+ if (!i) continue;
595
+ let o = new File([i], a, { type: i.type }), s = {
596
596
  id: pe(),
597
597
  name: a,
598
- contentType: r.type,
598
+ contentType: i.type,
599
599
  file: o,
600
600
  type: t.Image,
601
- status: i.Idle,
601
+ status: r.Idle,
602
602
  previewUrl: URL.createObjectURL(o)
603
603
  };
604
604
  n.push(s);
605
605
  }
606
- r.preventDefault(), e(n);
606
+ i.preventDefault(), e(n);
607
607
  return;
608
608
  }
609
- let l = r.clipboardData.getData("text/plain");
609
+ let l = i.clipboardData.getData("text/plain");
610
610
  if (l.length > n) {
611
- let n = l.trim(), a = (n.length > 80 ? `${n.slice(0, 80).trimEnd()}…` : n) || o, s = new File([l], a, { type: "text/plain" }), c = {
611
+ let n = l.trim(), a = (n.length > 80 ? `${n.slice(0, 80).trimEnd()}…` : n) || s, o = new File([l], a, { type: "text/plain" }), c = {
612
612
  id: pe(),
613
613
  name: a,
614
614
  contentType: "text/plain",
615
- file: s,
615
+ file: o,
616
616
  type: t.Pasted,
617
- status: i.Idle
617
+ status: r.Idle
618
618
  };
619
- r.preventDefault(), e([c]);
619
+ i.preventDefault(), e([c]);
620
620
  }
621
621
  }, [
622
622
  e,
623
623
  n,
624
624
  a,
625
- o
625
+ s
626
626
  ]) };
627
627
  }, Ve = 100;
628
628
  //#endregion
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@epam/ai-dial-attachment-input",
3
3
  "description": "File attachment input components with upload validation, drag-and-drop, and progress tracking",
4
- "version": "1.1.0-dev.53",
4
+ "version": "1.1.0-dev.56",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./index.js",
@@ -17,10 +17,10 @@
17
17
  }
18
18
  },
19
19
  "peerDependencies": {
20
- "@epam/ai-dial-chat-shared": "1.1.0-dev.53",
20
+ "@epam/ai-dial-chat-shared": "1.1.0-dev.56",
21
21
  "@tabler/icons-react": "^3.44.0",
22
22
  "react": "^19.0.0",
23
- "@epam/ai-dial-ui-kit": "^0.13.0-dev.12"
23
+ "@epam/ai-dial-ui-kit": "^0.13.0-dev.17"
24
24
  },
25
25
  "repository": {
26
26
  "type": "git",