@epam/ai-dial-attachment-input 1.2.0-dev.319 → 1.2.0-dev.323

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":"AttachmentCard.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentCard/AttachmentCard.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,EAAW,MAAM,OAAO,CAAC;AACzC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAKxE,8GAA8G;AAC9G,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAyElD,CAAC"}
1
+ {"version":3,"file":"AttachmentCard.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentCard/AttachmentCard.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,EAAW,MAAM,OAAO,CAAC;AACzC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAKxE,8GAA8G;AAC9G,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAwElD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"File.d.ts","sourceRoot":"","sources":["../../../../src/components/AttachmentCard/Attachments/File.tsx"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,EAAE,EAMR,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAoB/E,2HAA2H;AAC3H,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CA4QlD,CAAC"}
1
+ {"version":3,"file":"File.d.ts","sourceRoot":"","sources":["../../../../src/components/AttachmentCard/Attachments/File.tsx"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,EAAE,EAMR,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAoB/E,2HAA2H;AAC3H,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAyQlD,CAAC"}
@@ -4,7 +4,7 @@ import { ClipboardEventHandler } from 'react';
4
4
  export interface UseClipboardPasteLabels {
5
5
  /** Name template a pasted image is derived from, with the paste timestamp inserted before the extension. Defaults to `'Screenshot.png'`. */
6
6
  screenshotName?: string;
7
- /** Default file name given to pasted plain text when it has no usable preview. Defaults to `'Pasted text'`. */
7
+ /** Name prefix of a pasted plain-text file, which gets the paste timestamp and a `.txt` extension appended. Defaults to `'Pasted text'`. */
8
8
  pastedTextName?: string;
9
9
  }
10
10
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"useClipboardPaste.d.ts","sourceRoot":"","sources":["../../src/hooks/useClipboardPaste.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D,OAAO,EAAE,qBAAqB,EAAe,MAAM,OAAO,CAAC;AAG3D,mFAAmF;AACnF,MAAM,WAAW,uBAAuB;IACtC,4IAA4I;IAC5I,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,+GAA+G;IAC/G,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AA6BD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,GAC5B,eAAe,CAAC,WAAW,EAAE,UAAU,EAAE,KAAK,IAAI,EAClD,WAAW,MAAM,EACjB,SAAQ,uBAA4B,KACnC;IAAE,WAAW,EAAE,qBAAqB,CAAC,mBAAmB,CAAC,CAAA;CAwE3D,CAAC"}
1
+ {"version":3,"file":"useClipboardPaste.d.ts","sourceRoot":"","sources":["../../src/hooks/useClipboardPaste.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D,OAAO,EAAE,qBAAqB,EAAe,MAAM,OAAO,CAAC;AAG3D,mFAAmF;AACnF,MAAM,WAAW,uBAAuB;IACtC,4IAA4I;IAC5I,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,4IAA4I;IAC5I,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AA6BD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,GAC5B,eAAe,CAAC,WAAW,EAAE,UAAU,EAAE,KAAK,IAAI,EAClD,WAAW,MAAM,EACjB,SAAQ,uBAA4B,KACnC;IAAE,WAAW,EAAE,qBAAqB,CAAC,mBAAmB,CAAC,CAAA;CAuE3D,CAAC"}
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { AttachmentErrorReason as e, AttachmentType as t, MIME_TYPE_EXT_MAP as n, RequestStatus as r, buildCssVars as i, getBaseMimeType as a, mergeClasses as o, normalizeMimeType as s } from "@epam/ai-dial-chat-shared";
2
2
  import { useCallback as c, useEffect as l, useId as u, useMemo as d, useRef as f, useState as p } from "react";
3
- import { 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 ee, IconFileTypeZip as te, IconFileX as ne, IconMusic as re, IconPaperclip as ie, IconPhoto as B, IconReload as V, IconTerminal2 as ae, IconVideo as H, IconX as oe } from "@tabler/icons-react";
4
- import { DIAL_ICON_SIZE as U, DIAL_KIT_ICON_STROKE as W, ElementSize as G, GhostIconButton as se, Highlight as ce, Skeleton as le, SkeletonVariant as ue, Spinner as de, StaticIconButton as fe } from "@epam/ai-dial-ui-kit";
3
+ import { 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 U } from "@tabler/icons-react";
4
+ import { DIAL_ICON_SIZE as W, DIAL_KIT_ICON_STROKE as G, ElementSize as oe, GhostIconButton as se, Highlight as ce, Skeleton as le, SkeletonVariant as ue, Spinner as de, StaticIconButton as fe } from "@epam/ai-dial-ui-kit";
5
5
  import { Fragment as pe, jsx as K, jsxs as q } from "react/jsx-runtime";
6
6
  //#region src/utils/attachment.ts
7
7
  var me = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, he = (e) => {
@@ -46,10 +46,10 @@ var me = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, he = (e)
46
46
  case "image/png": return A;
47
47
  case "image/svg+xml": return P;
48
48
  case "image/bmp": return y;
49
- default: return B;
49
+ default: return H;
50
50
  }
51
- if (t.startsWith("video/")) return H;
52
- if (t.startsWith("audio/")) return re;
51
+ if (t.startsWith("video/")) return ae;
52
+ if (t.startsWith("audio/")) return te;
53
53
  switch (t) {
54
54
  case "application/pdf": return O;
55
55
  case "application/msword": return S;
@@ -62,12 +62,12 @@ var me = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, he = (e)
62
62
  case "application/vnd.rar":
63
63
  case "application/x-7z-compressed":
64
64
  case "application/gzip":
65
- case "application/x-tar": return te;
65
+ case "application/x-tar": return V;
66
66
  case "text/csv": return x;
67
67
  case "text/plain": return L;
68
68
  case "text/html":
69
69
  case "application/xhtml+xml": return w;
70
- case "application/xml": return ee;
70
+ case "application/xml": return B;
71
71
  case "application/sql": return N;
72
72
  case "text/javascript": return E;
73
73
  case "text/jsx": return D;
@@ -81,7 +81,7 @@ var me = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, he = (e)
81
81
  }
82
82
  }, xe = (e) => {
83
83
  let { type: n, contentType: r } = e;
84
- return n === t.Prompt ? ae : n === t.Pasted ? m : n === t.Image ? B : be(r ?? "");
84
+ return n === t.Prompt ? ie : n === t.Pasted ? m : n === t.Image ? H : be(r ?? "");
85
85
  }, Se = (e) => {
86
86
  let t = s(e), r = n[t];
87
87
  if (r) return r;
@@ -130,7 +130,7 @@ var me = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, he = (e)
130
130
  imageActionButton: "_imageActionButton_1tdbq_60"
131
131
  }, Z = ({ ariaLabel: e, errorTitle: t, errorDescId: n, onClick: r, id: i, icon: a, className: s }) => /* @__PURE__ */ K(fe, {
132
132
  icon: a,
133
- size: G.Small,
133
+ size: oe.Small,
134
134
  className: o("opacity-0 focus-visible:opacity-100 group-focus-within/attachment-tile:opacity-100 group-hover/attachment-tile:opacity-100", X.actionButton, s, Y.tileAction),
135
135
  "aria-label": e,
136
136
  "aria-describedby": t ? n : void 0,
@@ -138,127 +138,127 @@ var me = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, he = (e)
138
138
  e.stopPropagation(), r(i);
139
139
  }
140
140
  }), Ee = ({ ...e }) => /* @__PURE__ */ K(Z, {
141
- icon: /* @__PURE__ */ K(V, {
142
- size: U.SM,
141
+ icon: /* @__PURE__ */ K(re, {
142
+ size: W.SM,
143
143
  "aria-hidden": !0,
144
- stroke: W
144
+ stroke: G
145
145
  }),
146
146
  className: X.retryIcon,
147
147
  ...e
148
148
  }), De = ({ ...e }) => /* @__PURE__ */ K(Z, {
149
149
  icon: /* @__PURE__ */ K(h, {
150
- size: U.SM,
150
+ size: W.SM,
151
151
  "aria-hidden": !0,
152
- stroke: W
152
+ stroke: G
153
153
  }),
154
154
  ...e
155
155
  }), Oe = ({ ...e }) => /* @__PURE__ */ K(Z, {
156
156
  icon: /* @__PURE__ */ K(g, {
157
- size: U.SM,
157
+ size: W.SM,
158
158
  "aria-hidden": !0,
159
- stroke: W
159
+ stroke: G
160
160
  }),
161
161
  ...e
162
162
  }), ke = ({ ...e }) => /* @__PURE__ */ K(Z, {
163
- icon: /* @__PURE__ */ K(oe, {
164
- size: U.SM,
163
+ icon: /* @__PURE__ */ K(U, {
164
+ size: W.SM,
165
165
  "aria-hidden": !0,
166
- stroke: W
166
+ stroke: G
167
167
  }),
168
168
  ...e
169
169
  }), Ae = {
170
170
  [e.Network]: "Upload failed · network error",
171
171
  [e.UnsupportedType]: "Upload failed · unsupported file type",
172
172
  [e.FileTooLarge]: "Upload failed · file too large"
173
- }, je = ({ attachment: t, searchQuery: n = "", onClick: i, onRetry: a, labels: s, styles: l, onDownload: f, isPasted: p, isLink: m, cssVars: h, onExpand: g, isExpandable: _, onRemove: v, isSelected: y }) => {
174
- let { clickLabel: b = "Download attachment", expandLabel: x = "Expand pasted text", downloadLabel: S = "Download attachment", retryLabel: C = "Retry upload", removeLabel: w = "Remove attachment", openInNewTabLabel: T = "Open in new tab", sizeLabel: E, uploadingLabel: D = "Uploading", errorReasonLabels: O, genericErrorLabel: k = "Upload failed" } = s ?? {}, { typography: A, className: j } = l ?? {}, { id: M, name: N, status: P, errorReason: F } = t, I = P === r.Loading, L = P === r.Error, R = u(), z = L ? F && (O?.[F] ?? Ae[F]) || k : "", { BottomIcon: ee, typeLabel: te } = J(t), ne = !L && !I && f && !m, re = L && !!a && F !== e.UnsupportedType && F !== e.FileTooLarge, ie = Number(!!ne) + Number(!!re) + Number(!!m) + Number(!!v), B = ie > 1 ? "pe-11" : ie === 1 ? "pe-5" : void 0, V = !!_ && g !== void 0, ae = V || i !== void 0, H = () => {
175
- V ? g(M) : i?.(M);
176
- }, oe = (e) => {
177
- e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), H());
178
- }, U = d(() => p ? N : he(N), [p, N]), W = c(() => {
173
+ }, je = ({ attachment: t, searchQuery: n = "", onClick: i, onRetry: a, labels: s, styles: l, onDownload: f, isLink: p, cssVars: m, onExpand: h, isExpandable: g, onRemove: _, isSelected: v }) => {
174
+ let { clickLabel: y = "Download attachment", expandLabel: b = "Expand pasted text", downloadLabel: x = "Download attachment", retryLabel: S = "Retry upload", removeLabel: C = "Remove attachment", openInNewTabLabel: w = "Open in new tab", sizeLabel: T, uploadingLabel: E = "Uploading", errorReasonLabels: D, genericErrorLabel: O = "Upload failed" } = s ?? {}, { typography: k, className: A } = l ?? {}, { id: j, name: M, status: N, errorReason: P } = t, F = N === r.Loading, I = N === r.Error, L = u(), R = I ? P && (D?.[P] ?? Ae[P]) || O : "", { BottomIcon: z, typeLabel: B } = J(t), V = !I && !F && f && !p, ee = I && !!a && P !== e.UnsupportedType && P !== e.FileTooLarge, te = Number(!!V) + Number(!!ee) + Number(!!p) + Number(!!_), ne = te > 1 ? "pe-11" : te === 1 ? "pe-5" : void 0, H = !!g && h !== void 0, re = H || i !== void 0, ie = () => {
175
+ H ? h(j) : i?.(j);
176
+ }, ae = (e) => {
177
+ e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), ie());
178
+ }, U = d(() => he(M), [M]), W = c(() => {
179
179
  window.open(t.referenceUrl, "_blank", "noopener,noreferrer");
180
- }, [t]), G = o(Te, "group/attachment-tile relative flex-col justify-between items-start gap-1 overflow-hidden p-1.5", X.tile, !L && X.hovered, y && X.selected, L && X.tileError, Y.tile, y && Y.tileSelected), se = /* @__PURE__ */ K("div", {
180
+ }, [t]), G = o(Te, "group/attachment-tile relative flex-col justify-between items-start gap-1 overflow-hidden p-1.5", X.tile, !I && X.hovered, v && X.selected, I && X.tileError, Y.tile, v && Y.tileSelected), oe = /* @__PURE__ */ K("div", {
181
181
  title: U,
182
- className: o(A?.nameClassName ?? "dial-caption-text", "line-clamp-2 w-full min-w-0 break-words", X.nameText, !L && B, Y.tileName),
182
+ className: o(k?.nameClassName ?? "dial-caption-text", "line-clamp-2 w-full min-w-0 break-words", X.nameText, !I && ne, Y.tileName),
183
183
  children: n ? /* @__PURE__ */ K(ce, {
184
184
  text: U,
185
185
  query: n,
186
186
  maxLines: 2
187
187
  }) : U
188
- }), le = ee && /* @__PURE__ */ q("div", {
189
- className: o("flex w-full items-center gap-1", L && B, Y.tileType),
190
- children: [/* @__PURE__ */ K(ee, {
188
+ }), se = z && /* @__PURE__ */ q("div", {
189
+ className: o("flex w-full items-center gap-1", I && ne, Y.tileType),
190
+ children: [/* @__PURE__ */ K(z, {
191
191
  size: 16,
192
192
  className: X.typeText,
193
193
  "aria-hidden": !0
194
194
  }), /* @__PURE__ */ K("span", {
195
- className: o(A?.metaClassName ?? "dial-caption-text", "min-w-0 flex-1 truncate", X.typeText),
196
- children: E ? `${te} · ${E}` : te
195
+ className: o(k?.metaClassName ?? "dial-caption-text", "min-w-0 flex-1 truncate", X.typeText),
196
+ children: T ? `${B} · ${T}` : B
197
197
  })]
198
- }), ue = ae ? {
198
+ }), le = re ? {
199
199
  role: "button",
200
200
  tabIndex: 0,
201
- "aria-label": V ? x : b,
202
- onClick: H,
203
- onKeyDown: oe
204
- } : {}, fe = /* @__PURE__ */ q(pe, { children: [
201
+ "aria-label": H ? b : y,
202
+ onClick: ie,
203
+ onKeyDown: ae
204
+ } : {}, ue = /* @__PURE__ */ q(pe, { children: [
205
+ oe,
205
206
  se,
206
- le,
207
- I && /* @__PURE__ */ K("div", {
207
+ F && /* @__PURE__ */ K("div", {
208
208
  role: "progressbar",
209
- "aria-label": D,
209
+ "aria-label": E,
210
210
  className: o("absolute start-[-1px] top-[-1px] flex size-full items-center justify-center rounded", X.track),
211
211
  children: /* @__PURE__ */ K(de, { size: 32 })
212
212
  }),
213
213
  /* @__PURE__ */ q("div", {
214
214
  className: "absolute end-1 top-1 flex gap-1",
215
215
  children: [
216
- ne && /* @__PURE__ */ K(De, {
217
- ariaLabel: S,
218
- errorTitle: z,
219
- errorDescId: R,
216
+ V && /* @__PURE__ */ K(De, {
217
+ ariaLabel: x,
218
+ errorTitle: R,
219
+ errorDescId: L,
220
220
  onClick: f,
221
- id: M
221
+ id: j
222
222
  }),
223
- re && /* @__PURE__ */ K(Ee, {
224
- ariaLabel: C,
225
- errorTitle: z,
226
- errorDescId: R,
223
+ ee && /* @__PURE__ */ K(Ee, {
224
+ ariaLabel: S,
225
+ errorTitle: R,
226
+ errorDescId: L,
227
227
  onClick: a,
228
- id: M
228
+ id: j
229
229
  }),
230
- m && /* @__PURE__ */ K(Oe, {
231
- ariaLabel: T,
232
- errorTitle: z,
233
- errorDescId: R,
230
+ p && /* @__PURE__ */ K(Oe, {
231
+ ariaLabel: w,
232
+ errorTitle: R,
233
+ errorDescId: L,
234
234
  onClick: W
235
235
  }),
236
- v && /* @__PURE__ */ K(ke, {
237
- ariaLabel: w,
238
- errorTitle: z,
239
- errorDescId: R,
240
- onClick: v,
241
- id: M
236
+ _ && /* @__PURE__ */ K(ke, {
237
+ ariaLabel: C,
238
+ errorTitle: R,
239
+ errorDescId: L,
240
+ onClick: _,
241
+ id: j
242
242
  })
243
243
  ]
244
244
  }),
245
- L && /* @__PURE__ */ K("span", {
246
- id: R,
245
+ I && /* @__PURE__ */ K("span", {
246
+ id: L,
247
247
  role: "status",
248
248
  "aria-live": "polite",
249
249
  className: "sr-only",
250
- children: z
250
+ children: R
251
251
  })
252
252
  ] });
253
253
  return /* @__PURE__ */ K("div", {
254
- style: h,
255
- className: o("inline-flex", j),
254
+ style: m,
255
+ className: o("inline-flex", A),
256
256
  children: /* @__PURE__ */ K("div", {
257
- ...ue,
258
- "aria-busy": I,
259
- style: h,
260
- className: o(G, ae && "cursor-pointer", "focus-within:outline focus-within:outline-1 focus-within:outline-offset-1"),
261
- children: fe
257
+ ...le,
258
+ "aria-busy": F,
259
+ style: m,
260
+ className: o(G, re && "cursor-pointer", "focus-within:outline focus-within:outline-1 focus-within:outline-offset-1"),
261
+ children: ue
262
262
  })
263
263
  });
264
264
  }, Q = /* @__PURE__ */ function(e) {
@@ -319,11 +319,11 @@ var me = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, he = (e)
319
319
  width: "100%",
320
320
  height: "100%",
321
321
  active: D === Q.Loading,
322
- overlay: /* @__PURE__ */ K(B, {
323
- size: U.LG,
322
+ overlay: /* @__PURE__ */ K(H, {
323
+ size: W.LG,
324
324
  className: X.typeText,
325
325
  "aria-hidden": !0,
326
- stroke: W
326
+ stroke: G
327
327
  }),
328
328
  className: "absolute inset-0 rounded-xl"
329
329
  }),
@@ -339,7 +339,7 @@ var me = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, he = (e)
339
339
  })
340
340
  });
341
341
  }, Pe = ({ attachment: e, searchQuery: n = "", onRemove: r, onRetry: a, onExpand: o, onClick: s, onDownload: c, labels: l, styles: u, isSelected: f }) => {
342
- let { colors: p } = u ?? {}, m = e.type === t.Pasted, h = m && o !== void 0, g = i({
342
+ let { colors: p } = u ?? {}, m = e.type === t.Pasted && o !== void 0, h = i({
343
343
  "--ai-tile-bg": p?.background,
344
344
  "--ai-tile-border": p?.border,
345
345
  "--ai-tile-bg-hover": p?.backgroundHover,
@@ -355,15 +355,15 @@ var me = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, he = (e)
355
355
  "--ai-tile-hover-icon-bg": p?.hoverIconBackground,
356
356
  "--ai-tile-hover-icon-color": p?.hoverIconColor,
357
357
  "--ai-tile-progress-track": p?.trackBackground
358
- }), { isImage: _, isLink: v } = d(() => J(e), [e]);
359
- return _ ? /* @__PURE__ */ K(Ne, {
358
+ }), { isImage: g, isLink: _ } = d(() => J(e), [e]);
359
+ return g ? /* @__PURE__ */ K(Ne, {
360
360
  attachment: e,
361
361
  labels: l,
362
362
  onClick: s,
363
363
  onExpand: o,
364
364
  styles: u,
365
365
  onRemove: r,
366
- cssVars: g,
366
+ cssVars: h,
367
367
  onDownload: c,
368
368
  isSelected: f
369
369
  }) : /* @__PURE__ */ K(je, {
@@ -373,13 +373,12 @@ var me = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, he = (e)
373
373
  onRetry: a,
374
374
  onRemove: r,
375
375
  onDownload: c,
376
- isLink: v,
377
- isPasted: m,
376
+ isLink: _,
378
377
  styles: u,
379
378
  labels: l,
380
379
  onExpand: o,
381
- cssVars: g,
382
- isExpandable: h,
380
+ cssVars: h,
381
+ isExpandable: m,
383
382
  isSelected: f
384
383
  });
385
384
  }, Fe = ({ attachments: e, onRemove: t, onRetry: n, onExpand: r, onAttachmentClick: i, labels: a, styles: s }) => {
@@ -414,7 +413,7 @@ var me = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, he = (e)
414
413
  }, Le = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, Re = ({ attachments: e, onAttachmentClick: n, onDownloadAll: a, onRetry: s, labels: c, styles: l, selectedAttachmentId: u }) => {
415
414
  let { ariaLabel: d = "Attachments", clickLabel: f = "Download attachment", downloadLabel: p = "Download attachment", retryLabel: m = "Retry upload", downloadAllLabel: g = "Download all", openInNewTabLabel: v, getHeaderLabel: y = (e) => Le(e, "attachment"), promptLabel: b, pastedLabel: x, imageLabel: S } = c ?? {}, { typography: C, colors: w, className: T } = l ?? {}, E = i({ "--ai-group-text": w?.text });
416
415
  if (e.length === 0) return null;
417
- let D = e.some((e) => e.type === t.Image), O = e.some((e) => e.type !== t.Image), k = D && O, A = e.length >= 5, j = k ? ie : D ? B : _, M = y(e.length), N = () => {
416
+ let D = e.some((e) => e.type === t.Image), O = e.some((e) => e.type !== t.Image), k = D && O, A = e.length >= 5, j = k ? ne : D ? H : _, M = y(e.length), N = () => {
418
417
  let t = e.filter((e) => e.status === r.Idle);
419
418
  a ? a(t) : t.forEach((e) => n?.(e.id));
420
419
  }, P = (t) => {
@@ -431,7 +430,7 @@ var me = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, he = (e)
431
430
  children: [/* @__PURE__ */ q("div", {
432
431
  className: "flex items-center gap-1",
433
432
  children: [/* @__PURE__ */ K(j, {
434
- size: U.SM,
433
+ size: W.SM,
435
434
  className: o("shrink-0", Ie.headerIcon),
436
435
  "aria-hidden": !0
437
436
  }), /* @__PURE__ */ K("span", {
@@ -440,11 +439,11 @@ var me = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, he = (e)
440
439
  })]
441
440
  }), e.length >= 2 && (a || n) && /* @__PURE__ */ K(se, {
442
441
  icon: /* @__PURE__ */ K(h, {
443
- size: U.SM,
442
+ size: W.SM,
444
443
  "aria-hidden": !0,
445
- stroke: W
444
+ stroke: G
446
445
  }),
447
- size: G.Small,
446
+ size: oe.Small,
448
447
  "aria-label": g,
449
448
  onClick: N
450
449
  })]
@@ -486,7 +485,7 @@ var me = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, he = (e)
486
485
  "--ai-fd-denied-icon": c?.deniedIcon
487
486
  }), d = a ?? (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 ? ze.icon : ze.deniedIcon, m = (e) => {
488
487
  e.preventDefault();
489
- }, h = t ? v : ne;
488
+ }, h = t ? v : ee;
490
489
  return /* @__PURE__ */ K("div", {
491
490
  role: "status",
492
491
  "aria-live": "polite",
@@ -543,15 +542,15 @@ var me = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, he = (e)
543
542
  }
544
543
  let l = i.clipboardData.getData("text/plain");
545
544
  if (l.length > n) {
546
- let n = l.trim(), a = (n.length > 80 ? `${n.slice(0, 80).trimEnd()}…` : n) || o, s = new File([l], a, { type: "text/plain" }), c = {
545
+ let n = `${o} ${Ve(/* @__PURE__ */ new Date())}.txt`, a = new File([l], n, { type: "text/plain" }), s = {
547
546
  id: me(),
548
- name: a,
547
+ name: n,
549
548
  contentType: "text/plain",
550
- file: s,
549
+ file: a,
551
550
  type: t.Pasted,
552
551
  status: r.Idle
553
552
  };
554
- i.preventDefault(), e([c]);
553
+ i.preventDefault(), e([s]);
555
554
  }
556
555
  }, [
557
556
  e,
@@ -58,8 +58,6 @@ export interface FileAttachmentProps {
58
58
  labels?: FileAttachmentLabels;
59
59
  /** Style overrides for the row. */
60
60
  styles?: FileAttachmentStyles;
61
- /** Whether the attachment is pasted (vs. prompt). Defaults to `false`. */
62
- isPasted?: boolean;
63
61
  /** Whether the attachment is a link (vs. a file). Defaults to `false`. */
64
62
  isLink?: boolean;
65
63
  /** CSS custom properties applied to the root element. */
@@ -1 +1 @@
1
- {"version":3,"file":"attachment-file-row.d.ts","sourceRoot":"","sources":["../../src/models/attachment-file-row.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE9D,2DAA2D;AAC3D,MAAM,WAAW,oBAAqB,SAAQ,oBAAoB;IAChE,6GAA6G;IAC7G,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oNAAoN;IACpN,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,uHAAuH;IACvH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2EAA2E;IAC3E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iFAAiF;IACjF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4GAA4G;IAC5G,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,2KAA2K;IAC3K,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2FAA2F;IAC3F,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gJAAgJ;IAChJ,iBAAiB,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC,CAAC;IACnE,oIAAoI;IACpI,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,+DAA+D;AAC/D,MAAM,WAAW,wBAAwB;IACvC,yFAAyF;IACzF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iHAAiH;IACjH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,0DAA0D;AAC1D,MAAM,WAAW,oBAAoB;IACnC,kEAAkE;IAClE,UAAU,CAAC,EAAE,wBAAwB,CAAC;IACtC,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wDAAwD;AACxD,MAAM,WAAW,mBAAmB;IAClC,0DAA0D;IAC1D,UAAU,EAAE,iBAAiB,CAAC;IAC9B,mGAAmG;IACnG,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kEAAkE;IAClE,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,oDAAoD;IACpD,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,wDAAwD;IACxD,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,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,qIAAqI;IACrI,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,mCAAmC;IACnC,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,0EAA0E;IAC1E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,yDAAyD;IACzD,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,iFAAiF;IACjF,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,uHAAuH;IACvH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB"}
1
+ {"version":3,"file":"attachment-file-row.d.ts","sourceRoot":"","sources":["../../src/models/attachment-file-row.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE9D,2DAA2D;AAC3D,MAAM,WAAW,oBAAqB,SAAQ,oBAAoB;IAChE,6GAA6G;IAC7G,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oNAAoN;IACpN,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,uHAAuH;IACvH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2EAA2E;IAC3E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iFAAiF;IACjF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4GAA4G;IAC5G,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,2KAA2K;IAC3K,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2FAA2F;IAC3F,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gJAAgJ;IAChJ,iBAAiB,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC,CAAC;IACnE,oIAAoI;IACpI,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,+DAA+D;AAC/D,MAAM,WAAW,wBAAwB;IACvC,yFAAyF;IACzF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iHAAiH;IACjH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,0DAA0D;AAC1D,MAAM,WAAW,oBAAoB;IACnC,kEAAkE;IAClE,UAAU,CAAC,EAAE,wBAAwB,CAAC;IACtC,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wDAAwD;AACxD,MAAM,WAAW,mBAAmB;IAClC,0DAA0D;IAC1D,UAAU,EAAE,iBAAiB,CAAC;IAC9B,mGAAmG;IACnG,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kEAAkE;IAClE,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,oDAAoD;IACpD,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,wDAAwD;IACxD,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,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,qIAAqI;IACrI,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,mCAAmC;IACnC,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,0EAA0E;IAC1E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,yDAAyD;IACzD,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,iFAAiF;IACjF,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,uHAAuH;IACvH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB"}
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.2.0-dev.319",
4
+ "version": "1.2.0-dev.323",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./index.js",
@@ -20,9 +20,9 @@
20
20
  "@tabler/icons-react": "^3.44.0"
21
21
  },
22
22
  "peerDependencies": {
23
- "@epam/ai-dial-chat-shared": "1.2.0-dev.319",
23
+ "@epam/ai-dial-chat-shared": "1.2.0-dev.323",
24
24
  "react": "^19.2.8",
25
- "@epam/ai-dial-ui-kit": "^0.15.0-dev.39"
25
+ "@epam/ai-dial-ui-kit": "^0.15.0-dev.51"
26
26
  },
27
27
  "repository": {
28
28
  "type": "git",