@epam/ai-dial-attachment-input 1.2.0-dev.28 → 1.2.0-dev.284
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.css +2 -2
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +251 -243
- package/models/attachment-tray.d.ts +3 -0
- package/models/attachment-tray.d.ts.map +1 -1
- package/package.json +3 -3
- package/utils/attachment.d.ts +5 -2
- package/utils/attachment.d.ts.map +1 -1
|
@@ -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;AAoB/E,2HAA2H;AAC3H,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAuPlD,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,CAiDlD,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.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
.
|
|
2
|
-
/*$vite$:1*/.sr-only{height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;clip:rect(0,0,0,0);border-width:0;white-space:nowrap}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.invisible{visibility:hidden}.collapse{visibility:collapse}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.end-1{inset-inline-end:.25rem}.start-\[-1px\]{inset-inline-start:-1px}.top-1{top:.25rem}.top-\[-1px\]{top:-1px}.z-10{z-index:10}.z-\[9999\]{z-index:9999}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.line-clamp-2{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:2}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.size-\[84px\]{height:84px;width:84px}.size-full{width:100%}.h-full,.size-full{height:100%}.w-full{width:100%}.min-w-0{min-width:0}.max-w-\[420px\]{max-width:420px}.max-w-\[492px\]{max-width:492px}.flex-1{flex:1 1 0%}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.grid-cols-\[repeat\(5\2c 83px\)\]{grid-template-columns:repeat(5,83px)}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.break-words{overflow-wrap:break-word}.rounded{border-radius:4px}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.object-cover{-o-object-fit:cover;object-fit:cover}.p-1
|
|
1
|
+
._tile_s2es2_12{box-sizing:border-box;background:var(--ai-tile-bg,var(--bg-layer-raised,#fcfcfc));border-style:solid;border-color:var(--ai-tile-border,var(--stroke-secondary,#d1dbea))}._tile_s2es2_12._hovered_s2es2_18:hover{background:var(--ai-tile-bg-hover,var(--bg-control-neutral-hover-muted,#e0e6f0));border-color:var(--ai-tile-border-hover,var(--ai-tile-border,var(--stroke-secondary,#d1dbea)))}._tile_s2es2_12:focus-visible{outline-color:var(--ai-tile-focus-outline,var(--stroke-focus-black,#161b2d))}._selected_s2es2_28{background:var(--ai-tile-bg-selected,var(--bg-control-accent-alpha,#2764d90f));border-color:var(--ai-tile-border-selected,var(--stroke-accent-alpha,#2764d933))}._tileError_s2es2_33{background:var(--ai-tile-bg-error,var(--bg-error,#f3d6d8));border-color:var(--ai-tile-border-error,var(--stroke-error,#ae2f2f))}._nameText_s2es2_38{color:var(--ai-tile-name-text,var(--text-primary,#161b2d))}._typeText_s2es2_42{color:var(--ai-tile-type-text,var(--text-secondary,#57647a))}._retryIcon_s2es2_46{color:var(--ai-tile-error-text,var(--text-error,#ae2f2f))}._track_s2es2_50{background:var(--ai-tile-progress-track,var(--bg-backdrop,#161b2d4d))}._actionButton_s2es2_56{background:var(--ai-tile-hover-icon-bg,var(--bg-control-neutral-hover-muted,#e0e6f0))}._imageActionButton_s2es2_60{background:var(--ai-tile-hover-icon-bg,var(--bg-layer-base,#f5f7fa));color:var(--ai-tile-hover-icon-color,var(--text-secondary,#57647a))}._headerIcon_1dmgi_1,._headerLabel_1dmgi_2{color:var(--ai-group-text,var(--text-secondary,#57647a))}._overlay_mzpdp_1{background:var(--ai-fd-bg,var(--bg-backdrop,#161b2d4d))}._icon_mzpdp_5{color:var(--ai-fd-icon,var(--text-accent,#1d4ed8))}._deniedIcon_mzpdp_9{color:var(--ai-fd-denied-icon,var(--text-error,#ae2f2f))}
|
|
2
|
+
/*$vite$:1*/.sr-only{height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;clip:rect(0,0,0,0);border-width:0;white-space:nowrap}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.invisible{visibility:hidden}.collapse{visibility:collapse}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.end-1{inset-inline-end:.25rem}.start-\[-1px\]{inset-inline-start:-1px}.top-1{top:.25rem}.top-\[-1px\]{top:-1px}.z-10{z-index:10}.z-\[9999\]{z-index:9999}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.line-clamp-2{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:2}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.size-\[84px\]{height:84px;width:84px}.size-full{width:100%}.h-full,.size-full{height:100%}.w-full{width:100%}.min-w-0{min-width:0}.max-w-\[420px\]{max-width:420px}.max-w-\[492px\]{max-width:492px}.flex-1{flex:1 1 0%}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.grid-cols-\[repeat\(5\2c 83px\)\]{grid-template-columns:repeat(5,83px)}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.break-words{overflow-wrap:break-word}.rounded{border-radius:4px}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.object-cover{-o-object-fit:cover;object-fit:cover}.p-1\.5{padding:.375rem}.pe-11{padding-inline-end:2.75rem}.pe-5{padding-inline-end:1.25rem}.text-center{text-align:center}.opacity-0{opacity:0}.opacity-100{opacity:1}.outline{outline-style:solid;outline-width:1px}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm{--tw-backdrop-blur:blur(4px);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-200{transition-duration:.2s}.focus-within\:outline:focus-within{outline-style:solid;outline-width:1px}.focus-within\:outline-1:focus-within{outline-width:1px}.focus-within\:outline-offset-1:focus-within{outline-offset:1px}.focus-visible\:opacity-100:focus-visible{opacity:1}.group\/attachment-tile:focus-within .group-focus-within\/attachment-tile\:opacity-100{opacity:1}.group\/attachment-tile:hover .group-hover\/attachment-tile\:opacity-100{opacity:1}
|
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,102 +1,99 @@
|
|
|
1
|
-
import { AttachmentErrorReason as e, AttachmentType as t, MIME_TYPE_EXT_MAP as n, RequestStatus as r, buildCssVars as i,
|
|
2
|
-
import { useCallback as
|
|
3
|
-
import { IconClipboard as
|
|
4
|
-
import { DIAL_ICON_SIZE as
|
|
5
|
-
import { Fragment as
|
|
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
|
+
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 ee, IconFileTypeXls as R, IconFileTypeXml as z, IconFileTypeZip as B, IconFileX as V, IconMusic as H, IconPaperclip as te, 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, 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
|
+
import { Fragment as pe, jsx as K, jsxs as q } from "react/jsx-runtime";
|
|
6
6
|
//#region src/utils/attachment.ts
|
|
7
|
-
var
|
|
7
|
+
var me = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, he = (e) => {
|
|
8
8
|
if (e == null) return "";
|
|
9
9
|
let t = e.lastIndexOf(".");
|
|
10
10
|
return t > 0 ? e.slice(0, t) : e;
|
|
11
|
-
},
|
|
11
|
+
}, ge = {
|
|
12
12
|
image: "Image files",
|
|
13
13
|
audio: "Audio files",
|
|
14
14
|
video: "Video files",
|
|
15
15
|
text: "Text files",
|
|
16
16
|
"*": "All files"
|
|
17
|
-
},
|
|
18
|
-
let r = e
|
|
17
|
+
}, _e = { "image/jpeg": "JPEG" }, ve = (e, t = ge) => e.map((e) => {
|
|
18
|
+
let r = a(e);
|
|
19
19
|
if (r.endsWith("/*")) {
|
|
20
20
|
let e = r.slice(0, -2);
|
|
21
21
|
return t[e] ?? `${e} files`;
|
|
22
22
|
}
|
|
23
|
-
let i =
|
|
24
|
-
if (
|
|
25
|
-
let
|
|
26
|
-
if (
|
|
27
|
-
let
|
|
28
|
-
return
|
|
29
|
-
}).join(", "),
|
|
30
|
-
if (t ===
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
23
|
+
let i = s(r), o = _e[i];
|
|
24
|
+
if (o) return o;
|
|
25
|
+
let c = n[i];
|
|
26
|
+
if (c) return c.toUpperCase();
|
|
27
|
+
let l = i.split("/")[1];
|
|
28
|
+
return l == null ? e.toUpperCase() : l.toUpperCase();
|
|
29
|
+
}).join(", "), ye = (e, t) => {
|
|
30
|
+
if (t.length === 0) return !1;
|
|
31
|
+
let n = a(e), r = s(n);
|
|
32
|
+
return t.some((e) => {
|
|
33
|
+
let t = a(e);
|
|
34
|
+
if (t === "*" || t === "*/*") return !0;
|
|
35
|
+
if (t.endsWith("/*")) {
|
|
36
|
+
let e = t.slice(0, -2);
|
|
37
|
+
return n.startsWith(`${e}/`) || r.startsWith(`${e}/`);
|
|
38
|
+
}
|
|
39
|
+
return r === s(t);
|
|
40
|
+
});
|
|
41
|
+
}, be = (e) => {
|
|
42
|
+
if (!e) return _;
|
|
43
|
+
let t = s(e);
|
|
44
|
+
if (t.startsWith("image/")) switch (t) {
|
|
45
|
+
case "image/jpeg": return T;
|
|
46
|
+
case "image/png": return A;
|
|
47
|
+
case "image/svg+xml": return P;
|
|
48
|
+
case "image/bmp": return y;
|
|
49
|
+
default: return U;
|
|
45
50
|
}
|
|
46
|
-
if (
|
|
47
|
-
if (
|
|
48
|
-
switch (
|
|
49
|
-
case "application/pdf": return
|
|
50
|
-
case "application/msword":
|
|
51
|
-
case "application/vnd.
|
|
52
|
-
case "application/vnd.
|
|
53
|
-
case "application/vnd.
|
|
54
|
-
case "application/vnd.
|
|
55
|
-
case "application/vnd.
|
|
56
|
-
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": return L;
|
|
51
|
+
if (t.startsWith("video/")) return ie;
|
|
52
|
+
if (t.startsWith("audio/")) return H;
|
|
53
|
+
switch (t) {
|
|
54
|
+
case "application/pdf": return O;
|
|
55
|
+
case "application/msword": return S;
|
|
56
|
+
case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": return C;
|
|
57
|
+
case "application/vnd.ms-powerpoint": return j;
|
|
58
|
+
case "application/vnd.openxmlformats-officedocument.presentationml.presentation": return j;
|
|
59
|
+
case "application/vnd.ms-excel": return R;
|
|
60
|
+
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": return R;
|
|
57
61
|
case "application/zip":
|
|
58
|
-
case "application/
|
|
59
|
-
case "application/x-rar-compressed":
|
|
62
|
+
case "application/vnd.rar":
|
|
60
63
|
case "application/x-7z-compressed":
|
|
61
64
|
case "application/gzip":
|
|
62
|
-
case "application/x-tar": return
|
|
63
|
-
case "text/csv": return
|
|
64
|
-
case "text/plain": return
|
|
65
|
+
case "application/x-tar": return B;
|
|
66
|
+
case "text/csv": return x;
|
|
67
|
+
case "text/plain": return L;
|
|
65
68
|
case "text/html":
|
|
66
|
-
case "application/xhtml+xml": return
|
|
67
|
-
case "
|
|
68
|
-
case "application/
|
|
69
|
-
case "
|
|
70
|
-
case "text/
|
|
71
|
-
case "text/
|
|
72
|
-
case "
|
|
73
|
-
case "text/
|
|
74
|
-
case "
|
|
75
|
-
case "text/
|
|
76
|
-
case "text/
|
|
77
|
-
|
|
78
|
-
case "text/x-php":
|
|
79
|
-
case "application/x-php": return D;
|
|
80
|
-
case "text/x-rustsrc":
|
|
81
|
-
case "application/x-rust": return A;
|
|
82
|
-
case "text/x-vue": return I;
|
|
83
|
-
default: return h;
|
|
69
|
+
case "application/xhtml+xml": return w;
|
|
70
|
+
case "application/xml": return z;
|
|
71
|
+
case "application/sql": return N;
|
|
72
|
+
case "text/javascript": return E;
|
|
73
|
+
case "text/jsx": return D;
|
|
74
|
+
case "text/typescript": return F;
|
|
75
|
+
case "text/tsx": return I;
|
|
76
|
+
case "text/css": return b;
|
|
77
|
+
case "text/x-php": return k;
|
|
78
|
+
case "text/x-rustsrc": return M;
|
|
79
|
+
case "text/x-vue": return ee;
|
|
80
|
+
default: return _;
|
|
84
81
|
}
|
|
85
|
-
},
|
|
82
|
+
}, xe = (e) => {
|
|
86
83
|
let { type: n, contentType: r } = e;
|
|
87
|
-
return n === t.Prompt ?
|
|
88
|
-
},
|
|
89
|
-
let t = e
|
|
84
|
+
return n === t.Prompt ? re : n === t.Pasted ? m : n === t.Image ? U : be(r ?? "");
|
|
85
|
+
}, Se = (e) => {
|
|
86
|
+
let t = s(e), r = n[t];
|
|
90
87
|
if (r) return r;
|
|
91
88
|
let i = t.split("/")[1];
|
|
92
89
|
if (i && !i.startsWith("vnd.") && !i.includes("+")) return i;
|
|
93
|
-
},
|
|
90
|
+
}, Ce = (e, n) => {
|
|
94
91
|
let { type: r, name: i, contentType: a } = e;
|
|
95
92
|
if (r === t.Prompt) return n.promptLabel ?? "Prompt";
|
|
96
93
|
if (r === t.Pasted) return n.pastedLabel ?? "Pasted";
|
|
97
94
|
if (r === t.Image) return n.imageLabel ?? "Image";
|
|
98
95
|
if (a) {
|
|
99
|
-
let e =
|
|
96
|
+
let e = Se(a);
|
|
100
97
|
if (e) return `.${e}`;
|
|
101
98
|
}
|
|
102
99
|
if (i == null) return "";
|
|
@@ -109,119 +106,128 @@ var q = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, pe = (e) =
|
|
|
109
106
|
isError: l,
|
|
110
107
|
isImage: u,
|
|
111
108
|
isLink: d,
|
|
112
|
-
BottomIcon: d ? null :
|
|
113
|
-
typeLabel: d ? null :
|
|
109
|
+
BottomIcon: d ? null : xe(e),
|
|
110
|
+
typeLabel: d ? null : Ce(e, n)
|
|
114
111
|
};
|
|
115
|
-
},
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
112
|
+
}, we = 5, Te = "flex size-[84px] items-center justify-center rounded-xl border", Y = {
|
|
113
|
+
tray: "dial-ai-attachment-tray",
|
|
114
|
+
trayItem: "dial-ai-attachment-tray-item",
|
|
115
|
+
tile: "dial-ai-attachment-tile",
|
|
116
|
+
tileSelected: "dial-ai-attachment-tile-selected",
|
|
117
|
+
tileName: "dial-ai-attachment-tile-name",
|
|
118
|
+
tileType: "dial-ai-attachment-tile-type",
|
|
119
|
+
tileAction: "dial-ai-attachment-tile-action"
|
|
120
|
+
}, X = {
|
|
121
|
+
tile: "_tile_s2es2_12",
|
|
122
|
+
hovered: "_hovered_s2es2_18",
|
|
123
|
+
selected: "_selected_s2es2_28",
|
|
124
|
+
tileError: "_tileError_s2es2_33",
|
|
125
|
+
nameText: "_nameText_s2es2_38",
|
|
126
|
+
typeText: "_typeText_s2es2_42",
|
|
127
|
+
retryIcon: "_retryIcon_s2es2_46",
|
|
128
|
+
track: "_track_s2es2_50",
|
|
129
|
+
actionButton: "_actionButton_s2es2_56",
|
|
130
|
+
imageActionButton: "_imageActionButton_s2es2_60"
|
|
131
|
+
}, Z = ({ ariaLabel: e, errorTitle: t, errorDescId: n, onClick: r, id: i, icon: a, className: s }) => /* @__PURE__ */ K(fe, {
|
|
132
|
+
icon: a,
|
|
133
|
+
size: oe.Small,
|
|
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),
|
|
130
135
|
"aria-label": e,
|
|
131
136
|
"aria-describedby": t ? n : void 0,
|
|
132
137
|
onClick: (e) => {
|
|
133
138
|
e.stopPropagation(), r(i);
|
|
134
139
|
}
|
|
135
|
-
}),
|
|
136
|
-
icon: /* @__PURE__ */
|
|
137
|
-
size:
|
|
140
|
+
}), Ee = ({ ...e }) => /* @__PURE__ */ K(Z, {
|
|
141
|
+
icon: /* @__PURE__ */ K(ne, {
|
|
142
|
+
size: W.SM,
|
|
138
143
|
"aria-hidden": !0,
|
|
139
|
-
stroke:
|
|
144
|
+
stroke: G
|
|
140
145
|
}),
|
|
141
|
-
className:
|
|
146
|
+
className: X.retryIcon,
|
|
142
147
|
...e
|
|
143
|
-
}),
|
|
144
|
-
icon: /* @__PURE__ */
|
|
145
|
-
size:
|
|
148
|
+
}), De = ({ ...e }) => /* @__PURE__ */ K(Z, {
|
|
149
|
+
icon: /* @__PURE__ */ K(h, {
|
|
150
|
+
size: W.SM,
|
|
146
151
|
"aria-hidden": !0,
|
|
147
|
-
stroke:
|
|
152
|
+
stroke: G
|
|
148
153
|
}),
|
|
149
154
|
...e
|
|
150
|
-
}),
|
|
151
|
-
icon: /* @__PURE__ */
|
|
152
|
-
size:
|
|
155
|
+
}), Oe = ({ ...e }) => /* @__PURE__ */ K(Z, {
|
|
156
|
+
icon: /* @__PURE__ */ K(g, {
|
|
157
|
+
size: W.SM,
|
|
153
158
|
"aria-hidden": !0,
|
|
154
|
-
stroke:
|
|
159
|
+
stroke: G
|
|
155
160
|
}),
|
|
156
161
|
...e
|
|
157
|
-
}),
|
|
158
|
-
icon: /* @__PURE__ */
|
|
159
|
-
size:
|
|
162
|
+
}), ke = ({ ...e }) => /* @__PURE__ */ K(Z, {
|
|
163
|
+
icon: /* @__PURE__ */ K(ae, {
|
|
164
|
+
size: W.SM,
|
|
160
165
|
"aria-hidden": !0,
|
|
161
|
-
stroke:
|
|
166
|
+
stroke: G
|
|
162
167
|
}),
|
|
163
168
|
...e
|
|
164
|
-
}),
|
|
169
|
+
}), Ae = {
|
|
165
170
|
[e.Network]: "Upload failed · network error",
|
|
166
|
-
[e.UnsupportedType]: "Upload failed · unsupported file type"
|
|
167
|
-
|
|
168
|
-
|
|
171
|
+
[e.UnsupportedType]: "Upload failed · unsupported file type",
|
|
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", 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" } = s ?? {}, { typography: O, className: k } = l ?? {}, { id: A, name: j, status: M, errorReason: N } = t, P = M === r.Loading, F = M === r.Error, I = u(), L = F ? N && (E?.[N] ?? Ae[N]) || D : "", { BottomIcon: ee, typeLabel: R } = J(t), z = !F && !P && f && !m, B = F && !!a && N !== e.UnsupportedType && N !== e.FileTooLarge, V = Number(!!z) + Number(!!B) + Number(!!m) + Number(!!v), H = V > 1 ? "pe-11" : V === 1 ? "pe-5" : void 0, te = (e) => {
|
|
169
175
|
e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), i?.(t.id));
|
|
170
|
-
},
|
|
176
|
+
}, U = d(() => p ? j : he(j), [p, j]), ne = c(() => {
|
|
171
177
|
window.open(t.referenceUrl, "_blank", "noopener,noreferrer");
|
|
172
|
-
}, [t]),
|
|
173
|
-
title:
|
|
174
|
-
className:
|
|
175
|
-
children: n ? /* @__PURE__ */
|
|
176
|
-
text:
|
|
178
|
+
}, [t]), re = o(Te, "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), ie = /* @__PURE__ */ K("div", {
|
|
179
|
+
title: U,
|
|
180
|
+
className: o(O?.nameClassName ?? "dial-caption-text", "line-clamp-2 w-full min-w-0 break-words", X.nameText, !F && H, Y.tileName),
|
|
181
|
+
children: n ? /* @__PURE__ */ K(ce, {
|
|
182
|
+
text: U,
|
|
177
183
|
query: n,
|
|
178
184
|
maxLines: 2
|
|
179
|
-
}) :
|
|
180
|
-
}),
|
|
181
|
-
className:
|
|
182
|
-
children: [/* @__PURE__ */
|
|
185
|
+
}) : U
|
|
186
|
+
}), ae = ee && /* @__PURE__ */ q("div", {
|
|
187
|
+
className: o("flex w-full items-center gap-1", F && H, Y.tileType),
|
|
188
|
+
children: [/* @__PURE__ */ K(ee, {
|
|
183
189
|
size: 16,
|
|
184
|
-
className:
|
|
190
|
+
className: X.typeText,
|
|
185
191
|
"aria-hidden": !0
|
|
186
|
-
}), /* @__PURE__ */
|
|
187
|
-
className:
|
|
188
|
-
children: w ? `${
|
|
192
|
+
}), /* @__PURE__ */ K("span", {
|
|
193
|
+
className: o(O?.metaClassName ?? "dial-caption-text", "min-w-0 flex-1 truncate", X.typeText),
|
|
194
|
+
children: w ? `${R} · ${w}` : R
|
|
189
195
|
})]
|
|
190
|
-
}),
|
|
196
|
+
}), W = () => {
|
|
191
197
|
_ && g ? g(A) : i && i(A);
|
|
192
|
-
},
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
P && /* @__PURE__ */
|
|
198
|
+
}, G = /* @__PURE__ */ q(pe, { children: [
|
|
199
|
+
ie,
|
|
200
|
+
ae,
|
|
201
|
+
P && /* @__PURE__ */ K("div", {
|
|
196
202
|
role: "progressbar",
|
|
197
203
|
"aria-label": T,
|
|
198
|
-
className:
|
|
199
|
-
children: /* @__PURE__ */
|
|
204
|
+
className: o("absolute start-[-1px] top-[-1px] flex size-full items-center justify-center rounded", X.track),
|
|
205
|
+
children: /* @__PURE__ */ K(de, { size: 32 })
|
|
200
206
|
}),
|
|
201
|
-
/* @__PURE__ */
|
|
207
|
+
/* @__PURE__ */ q("div", {
|
|
202
208
|
className: "absolute end-1 top-1 flex gap-1",
|
|
203
209
|
children: [
|
|
204
|
-
|
|
210
|
+
z && /* @__PURE__ */ K(De, {
|
|
205
211
|
ariaLabel: b,
|
|
206
212
|
errorTitle: L,
|
|
207
213
|
errorDescId: I,
|
|
208
214
|
onClick: f,
|
|
209
215
|
id: A
|
|
210
216
|
}),
|
|
211
|
-
|
|
217
|
+
B && /* @__PURE__ */ K(Ee, {
|
|
212
218
|
ariaLabel: x,
|
|
213
219
|
errorTitle: L,
|
|
214
220
|
errorDescId: I,
|
|
215
|
-
onClick:
|
|
221
|
+
onClick: a,
|
|
216
222
|
id: A
|
|
217
223
|
}),
|
|
218
|
-
m && /* @__PURE__ */
|
|
224
|
+
m && /* @__PURE__ */ K(Oe, {
|
|
219
225
|
ariaLabel: C,
|
|
220
226
|
errorTitle: L,
|
|
221
227
|
errorDescId: I,
|
|
222
|
-
onClick:
|
|
228
|
+
onClick: ne
|
|
223
229
|
}),
|
|
224
|
-
v && /* @__PURE__ */
|
|
230
|
+
v && /* @__PURE__ */ K(ke, {
|
|
225
231
|
ariaLabel: S,
|
|
226
232
|
errorTitle: L,
|
|
227
233
|
errorDescId: I,
|
|
@@ -230,7 +236,7 @@ var q = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, pe = (e) =
|
|
|
230
236
|
})
|
|
231
237
|
]
|
|
232
238
|
}),
|
|
233
|
-
F && /* @__PURE__ */
|
|
239
|
+
F && /* @__PURE__ */ K("span", {
|
|
234
240
|
id: I,
|
|
235
241
|
role: "status",
|
|
236
242
|
"aria-live": "polite",
|
|
@@ -238,28 +244,28 @@ var q = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, pe = (e) =
|
|
|
238
244
|
children: L
|
|
239
245
|
})
|
|
240
246
|
] });
|
|
241
|
-
return /* @__PURE__ */
|
|
247
|
+
return /* @__PURE__ */ K("div", {
|
|
242
248
|
style: h,
|
|
243
|
-
className:
|
|
244
|
-
children: /* @__PURE__ */
|
|
249
|
+
className: o("inline-flex", k),
|
|
250
|
+
children: /* @__PURE__ */ K("div", {
|
|
245
251
|
role: "button",
|
|
246
252
|
tabIndex: 0,
|
|
247
253
|
"aria-label": b,
|
|
248
254
|
"aria-busy": P,
|
|
249
|
-
onClick:
|
|
250
|
-
onKeyDown:
|
|
255
|
+
onClick: W,
|
|
256
|
+
onKeyDown: te,
|
|
251
257
|
style: h,
|
|
252
|
-
className:
|
|
253
|
-
children:
|
|
258
|
+
className: o(re, "cursor-pointer focus-within:outline focus-within:outline-1 focus-within:outline-offset-1"),
|
|
259
|
+
children: G
|
|
254
260
|
})
|
|
255
261
|
});
|
|
256
|
-
},
|
|
262
|
+
}, Q = /* @__PURE__ */ function(e) {
|
|
257
263
|
return e.Idle = "idle", e.Loading = "loading", e.Loaded = "loaded", e.Error = "error", e;
|
|
258
|
-
}({}),
|
|
259
|
-
let n =
|
|
260
|
-
return
|
|
264
|
+
}({}), Me = ({ enabled: e, src: t }) => {
|
|
265
|
+
let n = f(null), [r, i] = p("idle");
|
|
266
|
+
return l(() => {
|
|
261
267
|
i(e && t ? "loading" : "idle");
|
|
262
|
-
}, [e, t]),
|
|
268
|
+
}, [e, t]), l(() => {
|
|
263
269
|
let r = n.current;
|
|
264
270
|
if (!r || !e || !t) return;
|
|
265
271
|
let a = () => i("loaded"), o = () => i("error");
|
|
@@ -270,15 +276,15 @@ var q = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, pe = (e) =
|
|
|
270
276
|
imageRef: n,
|
|
271
277
|
imageLoadStatus: r
|
|
272
278
|
};
|
|
273
|
-
},
|
|
274
|
-
let { clickLabel: f = "Open attachment", expandLabel: p = "Expand pasted text", removeLabel: m = "Remove attachment", downloadLabel: h = "Download attachment" } = i ?? {}, { className: g } =
|
|
279
|
+
}, Ne = ({ attachment: e, onExpand: n, onClick: r, labels: i, onRemove: a, cssVars: s, onDownload: c, styles: l, isSelected: u }) => {
|
|
280
|
+
let { clickLabel: f = "Open attachment", expandLabel: p = "Expand pasted text", removeLabel: m = "Remove attachment", downloadLabel: h = "Download attachment" } = i ?? {}, { className: g } = l ?? {}, { id: _, name: v } = e, y = e.previewUrl ?? e.url, b = e.type === t.Pasted && n !== void 0, { isLoading: x, isError: S, isImage: C } = d(() => J(e), [e]), w = r !== void 0 && !b && !x && !S, { imageRef: T, imageLoadStatus: E } = Me({
|
|
275
281
|
enabled: C,
|
|
276
282
|
src: y
|
|
277
283
|
}), D = () => {
|
|
278
284
|
b && n ? n(_) : w && r && r(_);
|
|
279
285
|
};
|
|
280
|
-
return /* @__PURE__ */
|
|
281
|
-
className:
|
|
286
|
+
return /* @__PURE__ */ K("div", {
|
|
287
|
+
className: o(Te, "group/attachment-tile", w && "cursor-pointer", X.tile, u && X.selected, g, Y.tile, u && Y.tileSelected),
|
|
282
288
|
onClick: D,
|
|
283
289
|
onKeyDown: (e) => {
|
|
284
290
|
e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), D());
|
|
@@ -287,49 +293,49 @@ var q = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, pe = (e) =
|
|
|
287
293
|
role: "button",
|
|
288
294
|
style: s,
|
|
289
295
|
"aria-label": w ? f : b ? p : void 0,
|
|
290
|
-
children: /* @__PURE__ */
|
|
296
|
+
children: /* @__PURE__ */ q("div", {
|
|
291
297
|
className: "relative h-full w-full overflow-hidden",
|
|
292
298
|
children: [
|
|
293
|
-
/* @__PURE__ */
|
|
299
|
+
/* @__PURE__ */ q("div", {
|
|
294
300
|
className: "absolute end-1 top-1 z-10 flex gap-1",
|
|
295
|
-
children: [
|
|
301
|
+
children: [a && /* @__PURE__ */ K(ke, {
|
|
296
302
|
ariaLabel: m,
|
|
297
|
-
onClick:
|
|
303
|
+
onClick: a,
|
|
298
304
|
id: _,
|
|
299
|
-
className:
|
|
300
|
-
}), c && /* @__PURE__ */
|
|
305
|
+
className: X.imageActionButton
|
|
306
|
+
}), c && /* @__PURE__ */ K(De, {
|
|
301
307
|
ariaLabel: h,
|
|
302
308
|
onClick: c,
|
|
303
309
|
id: _,
|
|
304
|
-
className:
|
|
310
|
+
className: X.imageActionButton
|
|
305
311
|
})]
|
|
306
312
|
}),
|
|
307
|
-
E !==
|
|
308
|
-
variant:
|
|
313
|
+
E !== Q.Loaded && /* @__PURE__ */ K(le, {
|
|
314
|
+
variant: ue.Rectangular,
|
|
309
315
|
width: "100%",
|
|
310
316
|
height: "100%",
|
|
311
|
-
active: E ===
|
|
312
|
-
overlay: /* @__PURE__ */
|
|
313
|
-
size:
|
|
314
|
-
className:
|
|
317
|
+
active: E === Q.Loading,
|
|
318
|
+
overlay: /* @__PURE__ */ K(U, {
|
|
319
|
+
size: W.LG,
|
|
320
|
+
className: X.typeText,
|
|
315
321
|
"aria-hidden": !0,
|
|
316
|
-
stroke:
|
|
322
|
+
stroke: G
|
|
317
323
|
}),
|
|
318
324
|
className: "absolute inset-0 rounded-xl"
|
|
319
325
|
}),
|
|
320
|
-
/* @__PURE__ */
|
|
326
|
+
/* @__PURE__ */ K("img", {
|
|
321
327
|
ref: T,
|
|
322
328
|
src: y,
|
|
323
329
|
alt: v,
|
|
324
330
|
loading: "lazy",
|
|
325
331
|
decoding: "async",
|
|
326
|
-
className:
|
|
332
|
+
className: o("h-full w-full rounded-xl object-cover transition-opacity duration-200", E === Q.Loaded ? "opacity-100" : "opacity-0")
|
|
327
333
|
})
|
|
328
334
|
]
|
|
329
335
|
})
|
|
330
336
|
});
|
|
331
|
-
},
|
|
332
|
-
let { colors: p } =
|
|
337
|
+
}, Pe = ({ attachment: e, searchQuery: n = "", onRemove: r, onRetry: a, onExpand: o, onClick: s, onDownload: c, labels: l, styles: u, isSelected: f }) => {
|
|
338
|
+
let { colors: p } = u ?? {}, m = e.type === t.Pasted, h = m && o !== void 0, g = i({
|
|
333
339
|
"--ai-tile-bg": p?.background,
|
|
334
340
|
"--ai-tile-border": p?.border,
|
|
335
341
|
"--ai-tile-bg-hover": p?.backgroundHover,
|
|
@@ -345,18 +351,18 @@ var q = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, pe = (e) =
|
|
|
345
351
|
"--ai-tile-hover-icon-bg": p?.hoverIconBackground,
|
|
346
352
|
"--ai-tile-hover-icon-color": p?.hoverIconColor,
|
|
347
353
|
"--ai-tile-progress-track": p?.trackBackground
|
|
348
|
-
}), { isImage: _, isLink: v } =
|
|
349
|
-
return _ ? /* @__PURE__ */
|
|
354
|
+
}), { isImage: _, isLink: v } = d(() => J(e), [e]);
|
|
355
|
+
return _ ? /* @__PURE__ */ K(Ne, {
|
|
350
356
|
attachment: e,
|
|
351
|
-
labels:
|
|
357
|
+
labels: l,
|
|
352
358
|
onClick: s,
|
|
353
359
|
onExpand: o,
|
|
354
|
-
styles:
|
|
360
|
+
styles: u,
|
|
355
361
|
onRemove: r,
|
|
356
362
|
cssVars: g,
|
|
357
363
|
onDownload: c,
|
|
358
364
|
isSelected: f
|
|
359
|
-
}) : /* @__PURE__ */
|
|
365
|
+
}) : /* @__PURE__ */ K(je, {
|
|
360
366
|
attachment: e,
|
|
361
367
|
searchQuery: n,
|
|
362
368
|
onClick: s,
|
|
@@ -365,22 +371,23 @@ var q = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, pe = (e) =
|
|
|
365
371
|
onDownload: c,
|
|
366
372
|
isLink: v,
|
|
367
373
|
isPasted: m,
|
|
368
|
-
styles:
|
|
369
|
-
labels:
|
|
374
|
+
styles: u,
|
|
375
|
+
labels: l,
|
|
370
376
|
onExpand: o,
|
|
371
377
|
cssVars: g,
|
|
372
378
|
isExpandable: h,
|
|
373
379
|
isSelected: f
|
|
374
380
|
});
|
|
375
|
-
},
|
|
376
|
-
let { ariaLabel: c = "Attached files", removeLabel: l, retryLabel: u, clickLabel: d, uploadingLabel: f } =
|
|
377
|
-
return e.length === 0 ? null : /* @__PURE__ */
|
|
381
|
+
}, Fe = ({ attachments: e, onRemove: t, onRetry: n, onExpand: r, onAttachmentClick: i, labels: a, styles: s }) => {
|
|
382
|
+
let { ariaLabel: c = "Attached files", removeLabel: l, retryLabel: u, clickLabel: d, uploadingLabel: f } = a ?? {}, { className: p, card: m } = s ?? {};
|
|
383
|
+
return e.length === 0 ? null : /* @__PURE__ */ K("div", {
|
|
378
384
|
role: "list",
|
|
379
385
|
"aria-label": c,
|
|
380
|
-
className:
|
|
381
|
-
children: e.map((e) => /* @__PURE__ */
|
|
386
|
+
className: o("flex w-full min-w-0 gap-2 overflow-x-auto", p, Y.tray),
|
|
387
|
+
children: e.map((e) => /* @__PURE__ */ K("div", {
|
|
382
388
|
role: "listitem",
|
|
383
|
-
|
|
389
|
+
className: Y.trayItem,
|
|
390
|
+
children: /* @__PURE__ */ K(Pe, {
|
|
384
391
|
attachment: e,
|
|
385
392
|
onRemove: t,
|
|
386
393
|
onRetry: n,
|
|
@@ -391,130 +398,131 @@ var q = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, pe = (e) =
|
|
|
391
398
|
clickLabel: d,
|
|
392
399
|
uploadingLabel: f
|
|
393
400
|
},
|
|
401
|
+
styles: m,
|
|
394
402
|
onClick: i
|
|
395
403
|
})
|
|
396
404
|
}, e.id))
|
|
397
405
|
});
|
|
398
|
-
},
|
|
406
|
+
}, Ie = {
|
|
399
407
|
headerIcon: "_headerIcon_1dmgi_1",
|
|
400
408
|
headerLabel: "_headerLabel_1dmgi_2"
|
|
401
|
-
},
|
|
402
|
-
let { ariaLabel: d = "Attachments", clickLabel: f = "Download attachment", retryLabel:
|
|
409
|
+
}, Le = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, Re = ({ attachments: e, onAttachmentClick: n, onDownloadAll: a, onRetry: s, labels: c, styles: l, selectedAttachmentId: u }) => {
|
|
410
|
+
let { ariaLabel: d = "Attachments", clickLabel: f = "Download attachment", retryLabel: p = "Retry upload", downloadAllLabel: m = "Download all", openInNewTabLabel: g, getHeaderLabel: v = (e) => Le(e, "attachment"), promptLabel: y, pastedLabel: b, imageLabel: x } = c ?? {}, { typography: S, colors: C, className: w } = l ?? {}, T = i({ "--ai-group-text": C?.text });
|
|
403
411
|
if (e.length === 0) return null;
|
|
404
|
-
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 ?
|
|
412
|
+
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 ? te : E ? U : _, j = v(e.length), M = () => {
|
|
405
413
|
let t = e.filter((e) => e.status === r.Idle);
|
|
406
|
-
|
|
414
|
+
a ? a(t) : t.forEach((e) => n?.(e.id));
|
|
407
415
|
}, N = (t) => {
|
|
408
416
|
let n = e.find((e) => e.id === t);
|
|
409
|
-
n &&
|
|
417
|
+
n && a?.([n]);
|
|
410
418
|
};
|
|
411
|
-
return /* @__PURE__ */
|
|
419
|
+
return /* @__PURE__ */ q("div", {
|
|
412
420
|
role: "group",
|
|
413
421
|
"aria-label": d,
|
|
414
422
|
style: T,
|
|
415
|
-
className:
|
|
416
|
-
children: [/* @__PURE__ */
|
|
423
|
+
className: o("flex flex-col gap-1", k ? "w-full min-w-0 max-w-[492px]" : "max-w-[420px]", Ie.container, w),
|
|
424
|
+
children: [/* @__PURE__ */ q("div", {
|
|
417
425
|
className: "flex items-center justify-between",
|
|
418
|
-
children: [/* @__PURE__ */
|
|
426
|
+
children: [/* @__PURE__ */ q("div", {
|
|
419
427
|
className: "flex items-center gap-1",
|
|
420
|
-
children: [/* @__PURE__ */
|
|
421
|
-
size:
|
|
422
|
-
className:
|
|
428
|
+
children: [/* @__PURE__ */ K(A, {
|
|
429
|
+
size: W.SM,
|
|
430
|
+
className: o("shrink-0", Ie.headerIcon),
|
|
423
431
|
"aria-hidden": !0
|
|
424
|
-
}), /* @__PURE__ */
|
|
425
|
-
className:
|
|
432
|
+
}), /* @__PURE__ */ K("span", {
|
|
433
|
+
className: o(S?.headerLabelClassName ?? "dial-tiny-semi-text", Ie.headerLabel),
|
|
426
434
|
children: j
|
|
427
435
|
})]
|
|
428
|
-
}), e.length >= 2 && (
|
|
429
|
-
icon: /* @__PURE__ */
|
|
430
|
-
size:
|
|
436
|
+
}), e.length >= 2 && (a || n) && /* @__PURE__ */ K(se, {
|
|
437
|
+
icon: /* @__PURE__ */ K(h, {
|
|
438
|
+
size: W.SM,
|
|
431
439
|
"aria-hidden": !0,
|
|
432
|
-
stroke:
|
|
440
|
+
stroke: G
|
|
433
441
|
}),
|
|
434
|
-
size:
|
|
435
|
-
"aria-label":
|
|
442
|
+
size: oe.Small,
|
|
443
|
+
"aria-label": m,
|
|
436
444
|
onClick: M
|
|
437
445
|
})]
|
|
438
|
-
}), /* @__PURE__ */
|
|
446
|
+
}), /* @__PURE__ */ K("div", {
|
|
439
447
|
role: "list",
|
|
440
448
|
"aria-label": j,
|
|
441
|
-
className:
|
|
442
|
-
children: e.map((e, t) => /* @__PURE__ */
|
|
449
|
+
className: o("gap-3", k ? "grid grid-cols-[repeat(5,83px)]" : "flex flex-wrap"),
|
|
450
|
+
children: e.map((e, t) => /* @__PURE__ */ K("div", {
|
|
443
451
|
role: "listitem",
|
|
444
|
-
children: /* @__PURE__ */
|
|
452
|
+
children: /* @__PURE__ */ K(Pe, {
|
|
445
453
|
attachment: e,
|
|
446
454
|
onClick: n,
|
|
447
455
|
onDownload: N,
|
|
448
456
|
onRetry: s,
|
|
449
457
|
labels: {
|
|
450
458
|
clickLabel: f,
|
|
451
|
-
retryLabel:
|
|
459
|
+
retryLabel: p,
|
|
452
460
|
promptLabel: y,
|
|
453
461
|
pastedLabel: b,
|
|
454
462
|
imageLabel: x,
|
|
455
|
-
openInNewTabLabel:
|
|
463
|
+
openInNewTabLabel: g
|
|
456
464
|
},
|
|
457
465
|
isSelected: e.id === u
|
|
458
466
|
})
|
|
459
467
|
}, `${e.id}-${t}`))
|
|
460
468
|
})]
|
|
461
469
|
});
|
|
462
|
-
},
|
|
470
|
+
}, ze = {
|
|
463
471
|
overlay: "_overlay_mzpdp_1",
|
|
464
472
|
icon: "_icon_mzpdp_5",
|
|
465
473
|
deniedIcon: "_deniedIcon_mzpdp_9"
|
|
466
|
-
},
|
|
467
|
-
let { title:
|
|
474
|
+
}, Be = ({ isVisible: e, isAttachmentsAllowed: t = !0, labels: n, styles: r }) => {
|
|
475
|
+
let { title: a, subtitle: s } = n ?? {}, { colors: c, typography: l } = r ?? {};
|
|
468
476
|
if (!e) return null;
|
|
469
477
|
let u = i({
|
|
470
478
|
"--ai-fd-bg": c?.background,
|
|
471
479
|
"--ai-fd-icon": c?.icon,
|
|
472
480
|
"--ai-fd-denied-icon": c?.deniedIcon
|
|
473
|
-
}), d =
|
|
481
|
+
}), 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) => {
|
|
474
482
|
e.preventDefault();
|
|
475
|
-
}, h = t ?
|
|
476
|
-
return /* @__PURE__ */
|
|
483
|
+
}, h = t ? v : V;
|
|
484
|
+
return /* @__PURE__ */ K("div", {
|
|
477
485
|
role: "status",
|
|
478
486
|
"aria-live": "polite",
|
|
479
|
-
className:
|
|
487
|
+
className: o("fixed inset-0 z-[9999] flex items-center justify-center backdrop-blur-sm", ze.overlay, t ? "pointer-events-none" : "pointer-events-auto cursor-not-allowed"),
|
|
480
488
|
onDragOver: t ? void 0 : m,
|
|
481
489
|
onDrop: t ? void 0 : m,
|
|
482
490
|
style: u,
|
|
483
|
-
children: /* @__PURE__ */
|
|
491
|
+
children: /* @__PURE__ */ q("div", {
|
|
484
492
|
className: "flex flex-col items-center text-center",
|
|
485
493
|
children: [
|
|
486
|
-
/* @__PURE__ */
|
|
494
|
+
/* @__PURE__ */ K(h, {
|
|
487
495
|
size: 100,
|
|
488
496
|
className: p,
|
|
489
497
|
"aria-hidden": !0
|
|
490
498
|
}),
|
|
491
|
-
/* @__PURE__ */
|
|
492
|
-
className:
|
|
499
|
+
/* @__PURE__ */ K("span", {
|
|
500
|
+
className: o("mt-5", l?.titleClassName ?? "dial-h3-text"),
|
|
493
501
|
children: d
|
|
494
502
|
}),
|
|
495
|
-
/* @__PURE__ */
|
|
496
|
-
className:
|
|
503
|
+
/* @__PURE__ */ K("span", {
|
|
504
|
+
className: o("mt-4", l?.subtitleClassName ?? "dial-small-text"),
|
|
497
505
|
children: f
|
|
498
506
|
})
|
|
499
507
|
]
|
|
500
508
|
})
|
|
501
509
|
});
|
|
502
|
-
}, $ = (e) => String(e).padStart(2, "0"),
|
|
510
|
+
}, $ = (e) => String(e).padStart(2, "0"), Ve = (e) => `${e.getFullYear()}-${$(e.getMonth() + 1)}-${$(e.getDate())} ${$(e.getHours())}-${$(e.getMinutes())}-${$(e.getSeconds())}`, He = (e, t, n) => {
|
|
503
511
|
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
|
-
},
|
|
506
|
-
let { screenshotName: a = "Screenshot.png", pastedTextName:
|
|
507
|
-
return { handlePaste:
|
|
512
|
+
return `${a} ${Ve(t)}${s}${o}`;
|
|
513
|
+
}, Ue = (e, n, i = {}) => {
|
|
514
|
+
let { screenshotName: a = "Screenshot.png", pastedTextName: o = "Pasted text" } = i;
|
|
515
|
+
return { handlePaste: c((i) => {
|
|
508
516
|
if (!i.clipboardData) return;
|
|
509
|
-
let
|
|
510
|
-
if (
|
|
511
|
-
let n = [],
|
|
512
|
-
for (let e of
|
|
517
|
+
let s = Array.from(i.clipboardData.items).filter((e) => e.kind === "file" && e.type.startsWith("image/")), c = i.clipboardData.getData("text/plain").length > 0;
|
|
518
|
+
if (s.length > 0 && !c) {
|
|
519
|
+
let n = [], o = /* @__PURE__ */ new Date();
|
|
520
|
+
for (let e of s) {
|
|
513
521
|
let i = e.getAsFile();
|
|
514
522
|
if (!i) continue;
|
|
515
|
-
let
|
|
516
|
-
id:
|
|
517
|
-
name:
|
|
523
|
+
let s = He(a, o, n.length), c = new File([i], s, { type: i.type }), l = {
|
|
524
|
+
id: me(),
|
|
525
|
+
name: s,
|
|
518
526
|
contentType: i.type,
|
|
519
527
|
file: c,
|
|
520
528
|
type: t.Image,
|
|
@@ -528,11 +536,11 @@ var q = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, pe = (e) =
|
|
|
528
536
|
}
|
|
529
537
|
let l = i.clipboardData.getData("text/plain");
|
|
530
538
|
if (l.length > n) {
|
|
531
|
-
let n = l.trim(), a = (n.length > 80 ? `${n.slice(0, 80).trimEnd()}…` : n) ||
|
|
532
|
-
id:
|
|
539
|
+
let n = l.trim(), a = (n.length > 80 ? `${n.slice(0, 80).trimEnd()}…` : n) || o, s = new File([l], a, { type: "text/plain" }), c = {
|
|
540
|
+
id: me(),
|
|
533
541
|
name: a,
|
|
534
542
|
contentType: "text/plain",
|
|
535
|
-
file:
|
|
543
|
+
file: s,
|
|
536
544
|
type: t.Pasted,
|
|
537
545
|
status: r.Idle
|
|
538
546
|
};
|
|
@@ -542,8 +550,8 @@ var q = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, pe = (e) =
|
|
|
542
550
|
e,
|
|
543
551
|
n,
|
|
544
552
|
a,
|
|
545
|
-
|
|
553
|
+
o
|
|
546
554
|
]) };
|
|
547
|
-
},
|
|
555
|
+
}, We = 100;
|
|
548
556
|
//#endregion
|
|
549
|
-
export {
|
|
557
|
+
export { we as ATTACHMENT_COLLAPSE_THRESHOLD, Y as ATTACHMENT_INPUT_CLASS, Pe as AttachmentCard, Re as AttachmentGroup, Fe as AttachmentTray, Be as FileDndOverlay, Q as LazyImageLoadStatus, We as MAX_UPLOADS_PER_MINUTE, me as generateAttachmentId, J as getAttachmentCardState, be as getAttachmentIcon, Se as getExtFromContentType, he as getNameWithoutExtension, ye as isMimeTypeAllowed, ve as mimeTypesToExtensionLabels, Ue as useClipboardPaste, Me as useLazyImageLoad };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DisplayAttachment } from '@epam/ai-dial-chat-shared';
|
|
2
|
+
import { AttachmentCardStyles } from './attachment-card';
|
|
2
3
|
/** Localised accessible labels for the `AttachmentTray` component. */
|
|
3
4
|
export interface AttachmentTrayLabels {
|
|
4
5
|
/** Accessible label for the tray region. Defaults to `'Attached files'`. */
|
|
@@ -16,6 +17,8 @@ export interface AttachmentTrayLabels {
|
|
|
16
17
|
export interface AttachmentTrayStyles {
|
|
17
18
|
/** Extra class name(s) merged onto the root element. */
|
|
18
19
|
className?: string;
|
|
20
|
+
/** Colors, typography, and shape forwarded to every card in the tray. */
|
|
21
|
+
card?: AttachmentCardStyles;
|
|
19
22
|
}
|
|
20
23
|
/** Props accepted by the `AttachmentTray` component. */
|
|
21
24
|
export interface AttachmentTrayProps {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment-tray.d.ts","sourceRoot":"","sources":["../../src/models/attachment-tray.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"attachment-tray.d.ts","sourceRoot":"","sources":["../../src/models/attachment-tray.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE9D,sEAAsE;AACtE,MAAM,WAAW,oBAAoB;IACnC,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wEAAwE;IACxE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iJAAiJ;IACjJ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mGAAmG;IACnG,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,0DAA0D;AAC1D,MAAM,WAAW,oBAAoB;IACnC,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yEAAyE;IACzE,IAAI,CAAC,EAAE,oBAAoB,CAAC;CAC7B;AAED,wDAAwD;AACxD,MAAM,WAAW,mBAAmB;IAClC,0CAA0C;IAC1C,WAAW,EAAE,iBAAiB,EAAE,CAAC;IACjC,uDAAuD;IACvD,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,+DAA+D;IAC/D,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,gGAAgG;IAChG,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,0HAA0H;IAC1H,iBAAiB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,4FAA4F;IAC5F,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,oCAAoC;IACpC,MAAM,CAAC,EAAE,oBAAoB,CAAC;CAC/B"}
|
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.284",
|
|
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.
|
|
23
|
+
"@epam/ai-dial-chat-shared": "1.2.0-dev.284",
|
|
24
24
|
"react": "^19.2.8",
|
|
25
|
-
"@epam/ai-dial-ui-kit": "^0.
|
|
25
|
+
"@epam/ai-dial-ui-kit": "^0.15.0-dev.36"
|
|
26
26
|
},
|
|
27
27
|
"repository": {
|
|
28
28
|
"type": "git",
|
package/utils/attachment.d.ts
CHANGED
|
@@ -13,12 +13,15 @@ export declare const mimeTypesToExtensionLabels: (types: string[], wildcardLabel
|
|
|
13
13
|
* Matching rules:
|
|
14
14
|
* - Exact match: `'application/pdf'` allows `'application/pdf'`.
|
|
15
15
|
* - Wildcard prefix: `'image/*'` allows any `'image/...'` MIME type.
|
|
16
|
+
* - Alias match: both sides are canonicalized, so `'text/json'` allows
|
|
17
|
+
* `'application/json'` and vice versa.
|
|
18
|
+
* - Parameters and letter case are ignored on both sides.
|
|
16
19
|
*
|
|
17
20
|
* Returns `false` when `allowedTypes` is empty (no attachment types allowed).
|
|
18
21
|
*/
|
|
19
22
|
export declare const isMimeTypeAllowed: (mimeType: string, allowedTypes: string[]) => boolean;
|
|
20
|
-
/** Returns the Tabler icon component for a given MIME content type, or `IconFile` for unknown types. */
|
|
21
|
-
export declare const getAttachmentIcon: (
|
|
23
|
+
/** Returns the Tabler icon component for a given MIME content type, or `IconFile` for unknown types. Aliases resolve to their canonical type first. */
|
|
24
|
+
export declare const getAttachmentIcon: (rawContentType: string) => Icon;
|
|
22
25
|
/** Derives a bare file extension (no leading dot) from a MIME type, e.g. `'application/pdf'` -> `'pdf'`. */
|
|
23
26
|
export declare const getExtFromContentType: (contentType: string) => string | undefined;
|
|
24
27
|
/** Derives the display state (icons, labels, color classes) an AttachmentCard needs to render a given attachment. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment.d.ts","sourceRoot":"","sources":["../../src/utils/attachment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"attachment.d.ts","sourceRoot":"","sources":["../../src/utils/attachment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAQnE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAgChD,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,2BAA2B,CAAC;AAEnC,uDAAuD;AACvD,eAAO,MAAM,oBAAoB,QAAO,MACgB,CAAC;AAEzD,4GAA4G;AAC5G,eAAO,MAAM,uBAAuB,GAAI,MAAM,MAAM,KAAG,MAItD,CAAC;AAcF,uHAAuH;AACvH,eAAO,MAAM,0BAA0B,GACrC,OAAO,MAAM,EAAE,EACf,iBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAwB,KAC5D,MAoBF,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,GAC5B,UAAU,MAAM,EAChB,cAAc,MAAM,EAAE,KACrB,OAsBF,CAAC;AAEF,uJAAuJ;AACvJ,eAAO,MAAM,iBAAiB,GAAI,gBAAgB,MAAM,KAAG,IAkF1D,CAAC;AAUF,4GAA4G;AAC5G,eAAO,MAAM,qBAAqB,GAChC,aAAa,MAAM,KAClB,MAAM,GAAG,SAUX,CAAC;AA6BF,qHAAqH;AACrH,eAAO,MAAM,sBAAsB,GACjC,YAAY,iBAAiB,EAC7B,aAAY,oBAAyB,KACpC,mBAiBF,CAAC"}
|