@epam/ai-dial-attachment-input 1.2.0-dev.48 → 1.2.0-dev.50
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/Attachments/Actions.d.ts.map +1 -1
- package/components/AttachmentCard/Attachments/File.d.ts.map +1 -1
- package/components/AttachmentCard/Attachments/Image.d.ts.map +1 -1
- package/components/AttachmentTray/AttachmentTray.d.ts.map +1 -1
- package/constants/public-class-names.d.ts +17 -0
- package/constants/public-class-names.d.ts.map +1 -0
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +58 -49
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Actions.d.ts","sourceRoot":"","sources":["../../../../src/components/AttachmentCard/Attachments/Actions.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,EAAmB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Actions.d.ts","sourceRoot":"","sources":["../../../../src/components/AttachmentCard/Attachments/Actions.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,EAAmB,MAAM,OAAO,CAAC;AAI5D,UAAU,WAAW;IACnB,wCAAwC;IACxC,IAAI,EAAE,SAAS,CAAC;IAChB,qDAAqD;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8CAA8C;IAC9C,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9B,kDAAkD;IAClD,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAgCD,uCAAuC;AACvC,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CActD,CAAC;AAEF,6CAA6C;AAC7C,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAaxD,CAAC;AAEF,mDAAmD;AACnD,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAaxD,CAAC;AAEF,qCAAqC;AACrC,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAatD,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,EAKR,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"File.d.ts","sourceRoot":"","sources":["../../../../src/components/AttachmentCard/Attachments/File.tsx"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,EAAE,EAKR,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAmB/E,2HAA2H;AAC3H,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAsPlD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../../../src/components/AttachmentCard/Attachments/Image.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAElB,MAAM,2BAA2B,CAAC;AAQnC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,EAA+B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../../../src/components/AttachmentCard/Attachments/Image.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAElB,MAAM,2BAA2B,CAAC;AAQnC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,EAA+B,MAAM,OAAO,CAAC;AAO5E,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,iCAAiC,CAAC;AAKzC,UAAU,oBAAoB;IAC5B,UAAU,EAAE,iBAAiB,CAAC;IAC9B,QAAQ,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,OAAO,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,uHAAuH;IACvH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,0EAA0E;AAC1E,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CAoIpD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttachmentTray.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentTray/AttachmentTray.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"AttachmentTray.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentTray/AttachmentTray.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAGxE,gHAAgH;AAChH,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAgDlD,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const ATTACHMENT_INPUT_CLASS: {
|
|
2
|
+
/** The tray's `role="list"` root. */
|
|
3
|
+
readonly tray: "dial-ai-attachment-tray";
|
|
4
|
+
/** Each `role="listitem"` wrapper inside the tray. */
|
|
5
|
+
readonly trayItem: "dial-ai-attachment-tray-item";
|
|
6
|
+
/** The square tile element, for both image and non-previewable attachments. */
|
|
7
|
+
readonly tile: "dial-ai-attachment-tile";
|
|
8
|
+
/** The tile when selected, additive to `tile`. */
|
|
9
|
+
readonly tileSelected: "dial-ai-attachment-tile-selected";
|
|
10
|
+
/** The tile's filename element. */
|
|
11
|
+
readonly tileName: "dial-ai-attachment-tile-name";
|
|
12
|
+
/** The tile's type and size row. */
|
|
13
|
+
readonly tileType: "dial-ai-attachment-tile-type";
|
|
14
|
+
/** Every corner action button: download, retry, open-link, remove. */
|
|
15
|
+
readonly tileAction: "dial-ai-attachment-tile-action";
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=public-class-names.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-class-names.d.ts","sourceRoot":"","sources":["../../src/constants/public-class-names.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,sBAAsB;IACjC,qCAAqC;;IAErC,sDAAsD;;IAEtD,+EAA+E;;IAE/E,kDAAkD;;IAElD,mCAAmC;;IAEnC,oCAAoC;;IAEpC,sEAAsE;;CAE9D,CAAC"}
|
package/index.d.ts
CHANGED
|
@@ -11,5 +11,6 @@ export { useClipboardPaste, type UseClipboardPasteLabels, } from './hooks/useCli
|
|
|
11
11
|
export { useLazyImageLoad, LazyImageLoadStatus, } from './hooks/useLazyImageLoad';
|
|
12
12
|
export { generateAttachmentId, getAttachmentCardState, getExtFromContentType, getAttachmentIcon, getNameWithoutExtension, mimeTypesToExtensionLabels, isMimeTypeAllowed, } from './utils/attachment';
|
|
13
13
|
export { ATTACHMENT_COLLAPSE_THRESHOLD } from './constants/attachment-group';
|
|
14
|
+
export { ATTACHMENT_INPUT_CLASS } from './constants/public-class-names';
|
|
14
15
|
export { MAX_UPLOADS_PER_MINUTE } from './constants/upload';
|
|
15
16
|
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAE5E,YAAY,EACV,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACV,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,GAC3B,MAAM,2BAA2B,CAAC;AACnC,YAAY,EACV,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,2BAA2B,CAAC;AACnC,YAAY,EACV,oBAAoB,EACpB,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,iBAAiB,EACjB,KAAK,uBAAuB,GAC7B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,iBAAiB,EACjB,uBAAuB,EACvB,0BAA0B,EAC1B,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAE5E,YAAY,EACV,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACV,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,GAC3B,MAAM,2BAA2B,CAAC;AACnC,YAAY,EACV,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,2BAA2B,CAAC;AACnC,YAAY,EACV,oBAAoB,EACpB,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,iBAAiB,EACjB,KAAK,uBAAuB,GAC7B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,iBAAiB,EACjB,uBAAuB,EACvB,0BAA0B,EAC1B,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
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
2
|
import { useCallback as o, useEffect as s, useId as c, useMemo as l, useRef as u, useState as d } from "react";
|
|
3
|
-
import { IconClipboard as f, IconDownload as p, IconExternalLink as m, IconFile as h, IconFileDescription as g, IconFileTypeBmp as _, IconFileTypeCss as v, IconFileTypeCsv as y, IconFileTypeDoc as b, IconFileTypeDocx as x, IconFileTypeHtml as S, IconFileTypeJpg as C, IconFileTypeJs as w, IconFileTypeJsx as T, IconFileTypePdf as E, IconFileTypePhp as D, IconFileTypePng as O, IconFileTypePpt as k, IconFileTypeRs as A, IconFileTypeSql as j, IconFileTypeSvg as M, IconFileTypeTs as N, IconFileTypeTsx as P, IconFileTypeTxt as F, IconFileTypeVue as I, IconFileTypeXls as L, IconFileTypeXml as
|
|
3
|
+
import { IconClipboard as f, IconDownload as p, IconExternalLink as m, IconFile as h, IconFileDescription as g, IconFileTypeBmp as _, IconFileTypeCss as v, IconFileTypeCsv as y, IconFileTypeDoc as b, IconFileTypeDocx as x, IconFileTypeHtml as S, IconFileTypeJpg as C, IconFileTypeJs as w, IconFileTypeJsx as T, IconFileTypePdf as E, IconFileTypePhp as D, IconFileTypePng as O, IconFileTypePpt as k, IconFileTypeRs as A, IconFileTypeSql as j, IconFileTypeSvg as M, IconFileTypeTs as N, IconFileTypeTsx as P, IconFileTypeTxt as F, IconFileTypeVue as I, IconFileTypeXls as L, IconFileTypeXml as ee, IconFileTypeZip as R, IconFileX as te, IconMusic as z, IconPaperclip as B, IconPhoto as V, IconReload as ne, IconTerminal2 as H, IconVideo as re, IconX as ie } from "@tabler/icons-react";
|
|
4
4
|
import { DIAL_ICON_SIZE as U, DIAL_KIT_ICON_STROKE as W, ElementSize as ae, GhostIconButton as oe, Highlight as se, Skeleton as ce, SkeletonVariant as le, Spinner as ue, StaticIconButton as de } from "@epam/ai-dial-ui-kit";
|
|
5
5
|
import { Fragment as fe, jsx as G, jsxs as K } from "react/jsx-runtime";
|
|
6
6
|
//#region src/utils/attachment.ts
|
|
@@ -59,13 +59,13 @@ var q = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, pe = (e) =
|
|
|
59
59
|
case "application/x-rar-compressed":
|
|
60
60
|
case "application/x-7z-compressed":
|
|
61
61
|
case "application/gzip":
|
|
62
|
-
case "application/x-tar": return
|
|
62
|
+
case "application/x-tar": return R;
|
|
63
63
|
case "text/csv": return y;
|
|
64
64
|
case "text/plain": return F;
|
|
65
65
|
case "text/html":
|
|
66
66
|
case "application/xhtml+xml": return S;
|
|
67
67
|
case "text/xml":
|
|
68
|
-
case "application/xml": return
|
|
68
|
+
case "application/xml": return ee;
|
|
69
69
|
case "application/sql":
|
|
70
70
|
case "text/x-sql": return j;
|
|
71
71
|
case "text/javascript":
|
|
@@ -113,6 +113,14 @@ var q = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, pe = (e) =
|
|
|
113
113
|
typeLabel: d ? null : xe(e, n)
|
|
114
114
|
};
|
|
115
115
|
}, Se = 5, Ce = "flex size-[84px] items-center justify-center rounded-xl border", Y = {
|
|
116
|
+
tray: "dial-ai-attachment-tray",
|
|
117
|
+
trayItem: "dial-ai-attachment-tray-item",
|
|
118
|
+
tile: "dial-ai-attachment-tile",
|
|
119
|
+
tileSelected: "dial-ai-attachment-tile-selected",
|
|
120
|
+
tileName: "dial-ai-attachment-tile-name",
|
|
121
|
+
tileType: "dial-ai-attachment-tile-type",
|
|
122
|
+
tileAction: "dial-ai-attachment-tile-action"
|
|
123
|
+
}, X = {
|
|
116
124
|
tile: "_tile_1whwz_1",
|
|
117
125
|
hovered: "_hovered_1whwz_5",
|
|
118
126
|
selected: "_selected_1whwz_15",
|
|
@@ -123,38 +131,38 @@ var q = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, pe = (e) =
|
|
|
123
131
|
track: "_track_1whwz_37",
|
|
124
132
|
actionButton: "_actionButton_1whwz_43",
|
|
125
133
|
imageActionButton: "_imageActionButton_1whwz_47"
|
|
126
|
-
},
|
|
134
|
+
}, Z = ({ ariaLabel: e, errorTitle: t, errorDescId: n, onClick: r, id: i, icon: o, className: s }) => /* @__PURE__ */ G(de, {
|
|
127
135
|
icon: o,
|
|
128
136
|
size: ae.Small,
|
|
129
|
-
className: a("opacity-0 focus-visible:opacity-100 group-focus-within/attachment-tile:opacity-100 group-hover/attachment-tile:opacity-100",
|
|
137
|
+
className: a("opacity-0 focus-visible:opacity-100 group-focus-within/attachment-tile:opacity-100 group-hover/attachment-tile:opacity-100", X.actionButton, s, Y.tileAction),
|
|
130
138
|
"aria-label": e,
|
|
131
139
|
"aria-describedby": t ? n : void 0,
|
|
132
140
|
onClick: (e) => {
|
|
133
141
|
e.stopPropagation(), r(i);
|
|
134
142
|
}
|
|
135
|
-
}), we = ({ ...e }) => /* @__PURE__ */ G(
|
|
143
|
+
}), we = ({ ...e }) => /* @__PURE__ */ G(Z, {
|
|
136
144
|
icon: /* @__PURE__ */ G(ne, {
|
|
137
145
|
size: U.SM,
|
|
138
146
|
"aria-hidden": !0,
|
|
139
147
|
stroke: W
|
|
140
148
|
}),
|
|
141
|
-
className:
|
|
149
|
+
className: X.retryIcon,
|
|
142
150
|
...e
|
|
143
|
-
}), Te = ({ ...e }) => /* @__PURE__ */ G(
|
|
151
|
+
}), Te = ({ ...e }) => /* @__PURE__ */ G(Z, {
|
|
144
152
|
icon: /* @__PURE__ */ G(p, {
|
|
145
153
|
size: U.SM,
|
|
146
154
|
"aria-hidden": !0,
|
|
147
155
|
stroke: W
|
|
148
156
|
}),
|
|
149
157
|
...e
|
|
150
|
-
}), Ee = ({ ...e }) => /* @__PURE__ */ G(
|
|
158
|
+
}), Ee = ({ ...e }) => /* @__PURE__ */ G(Z, {
|
|
151
159
|
icon: /* @__PURE__ */ G(m, {
|
|
152
160
|
size: U.SM,
|
|
153
161
|
"aria-hidden": !0,
|
|
154
162
|
stroke: W
|
|
155
163
|
}),
|
|
156
164
|
...e
|
|
157
|
-
}), De = ({ ...e }) => /* @__PURE__ */ G(
|
|
165
|
+
}), De = ({ ...e }) => /* @__PURE__ */ G(Z, {
|
|
158
166
|
icon: /* @__PURE__ */ G(ie, {
|
|
159
167
|
size: U.SM,
|
|
160
168
|
"aria-hidden": !0,
|
|
@@ -165,27 +173,27 @@ var q = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, pe = (e) =
|
|
|
165
173
|
[e.Network]: "Upload failed · network error",
|
|
166
174
|
[e.UnsupportedType]: "Upload failed · unsupported file type"
|
|
167
175
|
}, ke = ({ attachment: t, searchQuery: n = "", onClick: i, onRetry: s, labels: u, styles: d, onDownload: f, isPasted: p, isLink: m, cssVars: h, onExpand: g, isExpandable: _, onRemove: v, isSelected: y }) => {
|
|
168
|
-
let { clickLabel: b = "Download attachment", retryLabel: x = "Retry upload", removeLabel: S = "Remove attachment", openInNewTabLabel: C = "Open in new tab", sizeLabel: w, uploadingLabel: T = "Uploading", errorReasonLabels: E, genericErrorLabel: D = "Upload failed" } = u ?? {}, { typography: O, className: k } = d ?? {}, { id: A, name: j, status: M, errorReason: N } = t, P = M === r.Loading, F = M === r.Error, I = c(), L = F ? N && (E?.[N] ?? Oe[N]) || D : "", { BottomIcon:
|
|
176
|
+
let { clickLabel: b = "Download attachment", retryLabel: x = "Retry upload", removeLabel: S = "Remove attachment", openInNewTabLabel: C = "Open in new tab", sizeLabel: w, uploadingLabel: T = "Uploading", errorReasonLabels: E, genericErrorLabel: D = "Upload failed" } = u ?? {}, { typography: O, className: k } = d ?? {}, { id: A, name: j, status: M, errorReason: N } = t, P = M === r.Loading, F = M === r.Error, I = c(), L = F ? N && (E?.[N] ?? Oe[N]) || D : "", { BottomIcon: ee, typeLabel: R } = J(t), te = !F && !P && f && !m, z = F && !!s && N !== e.UnsupportedType, B = Number(!!te) + Number(!!z) + Number(!!m) + Number(!!v), V = B > 1 ? "pe-11" : B === 1 ? "pe-5" : void 0, ne = (e) => {
|
|
169
177
|
e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), i?.(t.id));
|
|
170
178
|
}, H = l(() => p ? j : pe(j), [p, j]), re = o(() => {
|
|
171
179
|
window.open(t.referenceUrl, "_blank", "noopener,noreferrer");
|
|
172
|
-
}, [t]), ie = a(Ce, "group/attachment-tile relative flex-col justify-between items-start gap-1 overflow-hidden p-1.5",
|
|
180
|
+
}, [t]), ie = a(Ce, "group/attachment-tile relative flex-col justify-between items-start gap-1 overflow-hidden p-1.5", X.tile, !F && X.hovered, y && X.selected, F && X.tileError, Y.tile, y && Y.tileSelected), U = /* @__PURE__ */ G("div", {
|
|
173
181
|
title: H,
|
|
174
|
-
className: a(O?.nameClassName ?? "dial-caption-text", "line-clamp-2 w-full min-w-0 break-words",
|
|
182
|
+
className: a(O?.nameClassName ?? "dial-caption-text", "line-clamp-2 w-full min-w-0 break-words", X.nameText, !F && V, Y.tileName),
|
|
175
183
|
children: n ? /* @__PURE__ */ G(se, {
|
|
176
184
|
text: H,
|
|
177
185
|
query: n,
|
|
178
186
|
maxLines: 2
|
|
179
187
|
}) : H
|
|
180
|
-
}), W =
|
|
181
|
-
className: a("flex w-full items-center gap-1", F && V),
|
|
182
|
-
children: [/* @__PURE__ */ G(
|
|
188
|
+
}), W = ee && /* @__PURE__ */ K("div", {
|
|
189
|
+
className: a("flex w-full items-center gap-1", F && V, Y.tileType),
|
|
190
|
+
children: [/* @__PURE__ */ G(ee, {
|
|
183
191
|
size: 16,
|
|
184
|
-
className:
|
|
192
|
+
className: X.typeText,
|
|
185
193
|
"aria-hidden": !0
|
|
186
194
|
}), /* @__PURE__ */ G("span", {
|
|
187
|
-
className: a(O?.metaClassName ?? "dial-caption-text", "min-w-0 flex-1 truncate",
|
|
188
|
-
children: w ? `${
|
|
195
|
+
className: a(O?.metaClassName ?? "dial-caption-text", "min-w-0 flex-1 truncate", X.typeText),
|
|
196
|
+
children: w ? `${R} · ${w}` : R
|
|
189
197
|
})]
|
|
190
198
|
}), ae = () => {
|
|
191
199
|
_ && g ? g(A) : i && i(A);
|
|
@@ -195,7 +203,7 @@ var q = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, pe = (e) =
|
|
|
195
203
|
P && /* @__PURE__ */ G("div", {
|
|
196
204
|
role: "progressbar",
|
|
197
205
|
"aria-label": T,
|
|
198
|
-
className: a("absolute start-[-1px] top-[-1px] flex size-full items-center justify-center rounded",
|
|
206
|
+
className: a("absolute start-[-1px] top-[-1px] flex size-full items-center justify-center rounded", X.track),
|
|
199
207
|
children: /* @__PURE__ */ G(ue, { size: 32 })
|
|
200
208
|
}),
|
|
201
209
|
/* @__PURE__ */ K("div", {
|
|
@@ -253,7 +261,7 @@ var q = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, pe = (e) =
|
|
|
253
261
|
children: oe
|
|
254
262
|
})
|
|
255
263
|
});
|
|
256
|
-
},
|
|
264
|
+
}, Q = /* @__PURE__ */ function(e) {
|
|
257
265
|
return e.Idle = "idle", e.Loading = "loading", e.Loaded = "loaded", e.Error = "error", e;
|
|
258
266
|
}({}), Ae = ({ enabled: e, src: t }) => {
|
|
259
267
|
let n = u(null), [r, i] = d("idle");
|
|
@@ -278,7 +286,7 @@ var q = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, pe = (e) =
|
|
|
278
286
|
b && n ? n(_) : w && r && r(_);
|
|
279
287
|
};
|
|
280
288
|
return /* @__PURE__ */ G("div", {
|
|
281
|
-
className: a(Ce, "group/attachment-tile", w && "cursor-pointer",
|
|
289
|
+
className: a(Ce, "group/attachment-tile", w && "cursor-pointer", X.tile, d && X.selected, g, Y.tile, d && Y.tileSelected),
|
|
282
290
|
onClick: D,
|
|
283
291
|
onKeyDown: (e) => {
|
|
284
292
|
e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), D());
|
|
@@ -296,22 +304,22 @@ var q = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, pe = (e) =
|
|
|
296
304
|
ariaLabel: m,
|
|
297
305
|
onClick: o,
|
|
298
306
|
id: _,
|
|
299
|
-
className:
|
|
307
|
+
className: X.imageActionButton
|
|
300
308
|
}), c && /* @__PURE__ */ G(Te, {
|
|
301
309
|
ariaLabel: h,
|
|
302
310
|
onClick: c,
|
|
303
311
|
id: _,
|
|
304
|
-
className:
|
|
312
|
+
className: X.imageActionButton
|
|
305
313
|
})]
|
|
306
314
|
}),
|
|
307
|
-
E !==
|
|
315
|
+
E !== Q.Loaded && /* @__PURE__ */ G(ce, {
|
|
308
316
|
variant: le.Rectangular,
|
|
309
317
|
width: "100%",
|
|
310
318
|
height: "100%",
|
|
311
|
-
active: E ===
|
|
319
|
+
active: E === Q.Loading,
|
|
312
320
|
overlay: /* @__PURE__ */ G(V, {
|
|
313
321
|
size: U.LG,
|
|
314
|
-
className:
|
|
322
|
+
className: X.typeText,
|
|
315
323
|
"aria-hidden": !0,
|
|
316
324
|
stroke: W
|
|
317
325
|
}),
|
|
@@ -323,12 +331,12 @@ var q = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, pe = (e) =
|
|
|
323
331
|
alt: v,
|
|
324
332
|
loading: "lazy",
|
|
325
333
|
decoding: "async",
|
|
326
|
-
className: a("h-full w-full rounded-xl object-cover transition-opacity duration-200", E ===
|
|
334
|
+
className: a("h-full w-full rounded-xl object-cover transition-opacity duration-200", E === Q.Loaded ? "opacity-100" : "opacity-0")
|
|
327
335
|
})
|
|
328
336
|
]
|
|
329
337
|
})
|
|
330
338
|
});
|
|
331
|
-
},
|
|
339
|
+
}, Me = ({ attachment: e, searchQuery: n = "", onRemove: r, onRetry: a, onExpand: o, onClick: s, onDownload: c, labels: u, styles: d, isSelected: f }) => {
|
|
332
340
|
let { colors: p } = d ?? {}, m = e.type === t.Pasted, h = m && o !== void 0, g = i({
|
|
333
341
|
"--ai-tile-bg": p?.background,
|
|
334
342
|
"--ai-tile-border": p?.border,
|
|
@@ -372,15 +380,16 @@ var q = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, pe = (e) =
|
|
|
372
380
|
isExpandable: h,
|
|
373
381
|
isSelected: f
|
|
374
382
|
});
|
|
375
|
-
},
|
|
383
|
+
}, Ne = ({ attachments: e, onRemove: t, onRetry: n, onExpand: r, onAttachmentClick: i, labels: o, styles: s }) => {
|
|
376
384
|
let { ariaLabel: c = "Attached files", removeLabel: l, retryLabel: u, clickLabel: d, uploadingLabel: f } = o ?? {}, { className: p } = s ?? {};
|
|
377
385
|
return e.length === 0 ? null : /* @__PURE__ */ G("div", {
|
|
378
386
|
role: "list",
|
|
379
387
|
"aria-label": c,
|
|
380
|
-
className: a("flex w-full min-w-0 gap-2 overflow-x-auto", p),
|
|
388
|
+
className: a("flex w-full min-w-0 gap-2 overflow-x-auto", p, Y.tray),
|
|
381
389
|
children: e.map((e) => /* @__PURE__ */ G("div", {
|
|
382
390
|
role: "listitem",
|
|
383
|
-
|
|
391
|
+
className: Y.trayItem,
|
|
392
|
+
children: /* @__PURE__ */ G(Me, {
|
|
384
393
|
attachment: e,
|
|
385
394
|
onRemove: t,
|
|
386
395
|
onRetry: n,
|
|
@@ -395,11 +404,11 @@ var q = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, pe = (e) =
|
|
|
395
404
|
})
|
|
396
405
|
}, e.id))
|
|
397
406
|
});
|
|
398
|
-
},
|
|
407
|
+
}, Pe = {
|
|
399
408
|
headerIcon: "_headerIcon_1dmgi_1",
|
|
400
409
|
headerLabel: "_headerLabel_1dmgi_2"
|
|
401
|
-
},
|
|
402
|
-
let { ariaLabel: d = "Attachments", clickLabel: f = "Download attachment", retryLabel: m = "Retry upload", downloadAllLabel: g = "Download all", openInNewTabLabel: _, getHeaderLabel: v = (e) =>
|
|
410
|
+
}, Fe = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, Ie = ({ attachments: e, onAttachmentClick: n, onDownloadAll: o, onRetry: s, labels: c, styles: l, selectedAttachmentId: u }) => {
|
|
411
|
+
let { ariaLabel: d = "Attachments", clickLabel: f = "Download attachment", retryLabel: m = "Retry upload", downloadAllLabel: g = "Download all", openInNewTabLabel: _, getHeaderLabel: v = (e) => Fe(e, "attachment"), promptLabel: y, pastedLabel: b, imageLabel: x } = c ?? {}, { typography: S, colors: C, className: w } = l ?? {}, T = i({ "--ai-group-text": C?.text });
|
|
403
412
|
if (e.length === 0) return null;
|
|
404
413
|
let E = e.some((e) => e.type === t.Image), D = e.some((e) => e.type !== t.Image), O = E && D, k = e.length >= 5, A = O ? B : E ? V : h, j = v(e.length), M = () => {
|
|
405
414
|
let t = e.filter((e) => e.status === r.Idle);
|
|
@@ -412,17 +421,17 @@ var q = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, pe = (e) =
|
|
|
412
421
|
role: "group",
|
|
413
422
|
"aria-label": d,
|
|
414
423
|
style: T,
|
|
415
|
-
className: a("flex flex-col gap-1", k ? "w-full min-w-0 max-w-[492px]" : "max-w-[420px]",
|
|
424
|
+
className: a("flex flex-col gap-1", k ? "w-full min-w-0 max-w-[492px]" : "max-w-[420px]", Pe.container, w),
|
|
416
425
|
children: [/* @__PURE__ */ K("div", {
|
|
417
426
|
className: "flex items-center justify-between",
|
|
418
427
|
children: [/* @__PURE__ */ K("div", {
|
|
419
428
|
className: "flex items-center gap-1",
|
|
420
429
|
children: [/* @__PURE__ */ G(A, {
|
|
421
430
|
size: U.SM,
|
|
422
|
-
className: a("shrink-0",
|
|
431
|
+
className: a("shrink-0", Pe.headerIcon),
|
|
423
432
|
"aria-hidden": !0
|
|
424
433
|
}), /* @__PURE__ */ G("span", {
|
|
425
|
-
className: a(S?.headerLabelClassName ?? "dial-tiny-semi-text",
|
|
434
|
+
className: a(S?.headerLabelClassName ?? "dial-tiny-semi-text", Pe.headerLabel),
|
|
426
435
|
children: j
|
|
427
436
|
})]
|
|
428
437
|
}), e.length >= 2 && (o || n) && /* @__PURE__ */ G(oe, {
|
|
@@ -441,7 +450,7 @@ var q = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, pe = (e) =
|
|
|
441
450
|
className: a("gap-3", k ? "grid grid-cols-[repeat(5,83px)]" : "flex flex-wrap"),
|
|
442
451
|
children: e.map((e, t) => /* @__PURE__ */ G("div", {
|
|
443
452
|
role: "listitem",
|
|
444
|
-
children: /* @__PURE__ */ G(
|
|
453
|
+
children: /* @__PURE__ */ G(Me, {
|
|
445
454
|
attachment: e,
|
|
446
455
|
onClick: n,
|
|
447
456
|
onDownload: N,
|
|
@@ -459,24 +468,24 @@ var q = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, pe = (e) =
|
|
|
459
468
|
}, `${e.id}-${t}`))
|
|
460
469
|
})]
|
|
461
470
|
});
|
|
462
|
-
},
|
|
471
|
+
}, Le = {
|
|
463
472
|
overlay: "_overlay_mzpdp_1",
|
|
464
473
|
icon: "_icon_mzpdp_5",
|
|
465
474
|
deniedIcon: "_deniedIcon_mzpdp_9"
|
|
466
|
-
},
|
|
475
|
+
}, Re = ({ isVisible: e, isAttachmentsAllowed: t = !0, labels: n, styles: r }) => {
|
|
467
476
|
let { title: o, subtitle: s } = n ?? {}, { colors: c, typography: l } = r ?? {};
|
|
468
477
|
if (!e) return null;
|
|
469
478
|
let u = i({
|
|
470
479
|
"--ai-fd-bg": c?.background,
|
|
471
480
|
"--ai-fd-icon": c?.icon,
|
|
472
481
|
"--ai-fd-denied-icon": c?.deniedIcon
|
|
473
|
-
}), d = o ?? (t ? "Attach files" : "No attachments allowed"), f = s ?? (t ? "Drop files here to attach them to message" : "Attachments can't be added to message"), p = t ?
|
|
482
|
+
}), 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 ? Le.icon : Le.deniedIcon, m = (e) => {
|
|
474
483
|
e.preventDefault();
|
|
475
484
|
}, h = t ? g : te;
|
|
476
485
|
return /* @__PURE__ */ G("div", {
|
|
477
486
|
role: "status",
|
|
478
487
|
"aria-live": "polite",
|
|
479
|
-
className: a("fixed inset-0 z-[9999] flex items-center justify-center backdrop-blur-sm",
|
|
488
|
+
className: a("fixed inset-0 z-[9999] flex items-center justify-center backdrop-blur-sm", Le.overlay, t ? "pointer-events-none" : "pointer-events-auto cursor-not-allowed"),
|
|
480
489
|
onDragOver: t ? void 0 : m,
|
|
481
490
|
onDrop: t ? void 0 : m,
|
|
482
491
|
style: u,
|
|
@@ -499,10 +508,10 @@ var q = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, pe = (e) =
|
|
|
499
508
|
]
|
|
500
509
|
})
|
|
501
510
|
});
|
|
502
|
-
}, $ = (e) => String(e).padStart(2, "0"),
|
|
511
|
+
}, $ = (e) => String(e).padStart(2, "0"), ze = (e) => `${e.getFullYear()}-${$(e.getMonth() + 1)}-${$(e.getDate())} ${$(e.getHours())}-${$(e.getMinutes())}-${$(e.getSeconds())}`, Be = (e, t, n) => {
|
|
503
512
|
let r = e.lastIndexOf("."), i = r > 0, a = i ? e.slice(0, r) : e, o = i ? e.slice(r) : "", s = n === 0 ? "" : ` (${n + 1})`;
|
|
504
|
-
return `${a} ${
|
|
505
|
-
},
|
|
513
|
+
return `${a} ${ze(t)}${s}${o}`;
|
|
514
|
+
}, Ve = (e, n, i = {}) => {
|
|
506
515
|
let { screenshotName: a = "Screenshot.png", pastedTextName: s = "Pasted text" } = i;
|
|
507
516
|
return { handlePaste: o((i) => {
|
|
508
517
|
if (!i.clipboardData) return;
|
|
@@ -512,7 +521,7 @@ var q = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, pe = (e) =
|
|
|
512
521
|
for (let e of o) {
|
|
513
522
|
let i = e.getAsFile();
|
|
514
523
|
if (!i) continue;
|
|
515
|
-
let o =
|
|
524
|
+
let o = Be(a, s, n.length), c = new File([i], o, { type: i.type }), l = {
|
|
516
525
|
id: q(),
|
|
517
526
|
name: o,
|
|
518
527
|
contentType: i.type,
|
|
@@ -544,6 +553,6 @@ var q = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, pe = (e) =
|
|
|
544
553
|
a,
|
|
545
554
|
s
|
|
546
555
|
]) };
|
|
547
|
-
},
|
|
556
|
+
}, He = 100;
|
|
548
557
|
//#endregion
|
|
549
|
-
export { Se as ATTACHMENT_COLLAPSE_THRESHOLD,
|
|
558
|
+
export { Se as ATTACHMENT_COLLAPSE_THRESHOLD, Y as ATTACHMENT_INPUT_CLASS, Me as AttachmentCard, Ie as AttachmentGroup, Ne as AttachmentTray, Re as FileDndOverlay, Q as LazyImageLoadStatus, He as MAX_UPLOADS_PER_MINUTE, q as generateAttachmentId, J as getAttachmentCardState, ve as getAttachmentIcon, be as getExtFromContentType, pe as getNameWithoutExtension, _e as isMimeTypeAllowed, ge as mimeTypesToExtensionLabels, Ve as useClipboardPaste, Ae as useLazyImageLoad };
|
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.
|
|
4
|
+
"version": "1.2.0-dev.50",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@tabler/icons-react": "^3.44.0"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@epam/ai-dial-chat-shared": "1.2.0-dev.
|
|
23
|
+
"@epam/ai-dial-chat-shared": "1.2.0-dev.50",
|
|
24
24
|
"react": "^19.2.8",
|
|
25
25
|
"@epam/ai-dial-ui-kit": "^0.15.0-dev.7"
|
|
26
26
|
},
|