@epam/ai-dial-attachment-input 1.0.0-dev.462 → 1.0.0-dev.464
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/AttachmentCard/AttachmentCard.d.ts.map +1 -1
- package/components/AttachmentFileRow/AttachmentFileRow.d.ts +12 -0
- package/components/AttachmentFileRow/AttachmentFileRow.d.ts.map +1 -0
- package/components/AttachmentGroup/AttachmentGroup.d.ts +12 -0
- package/components/AttachmentGroup/AttachmentGroup.d.ts.map +1 -0
- package/components/AttachmentMoreTile/AttachmentMoreTile.d.ts +9 -0
- package/components/AttachmentMoreTile/AttachmentMoreTile.d.ts.map +1 -0
- package/index.css +1 -1
- package/index.d.ts +9 -1
- package/index.d.ts.map +1 -1
- package/index.js +405 -212
- package/models/AttachmentCard.d.ts +6 -0
- package/models/AttachmentCard.d.ts.map +1 -1
- package/models/AttachmentFileRow.d.ts +24 -0
- package/models/AttachmentFileRow.d.ts.map +1 -0
- package/models/AttachmentGroup.d.ts +31 -0
- package/models/AttachmentGroup.d.ts.map +1 -0
- package/models/AttachmentMoreTile.d.ts +18 -0
- package/models/AttachmentMoreTile.d.ts.map +1 -0
- package/package.json +2 -2
- package/utils/getAttachmentCardState.d.ts +2 -0
- package/utils/getAttachmentCardState.d.ts.map +1 -1
- package/utils/getAttachmentGroupLayout.d.ts +23 -0
- package/utils/getAttachmentGroupLayout.d.ts.map +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttachmentCard.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentCard/AttachmentCard.tsx"],"names":[],"mappings":"AAqBA,OAAO,EAAE,KAAK,EAAE,EAAgD,MAAM,OAAO,CAAC;AAK9E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAKvE,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,
|
|
1
|
+
{"version":3,"file":"AttachmentCard.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentCard/AttachmentCard.tsx"],"names":[],"mappings":"AAqBA,OAAO,EAAE,KAAK,EAAE,EAAgD,MAAM,OAAO,CAAC;AAK9E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAKvE,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAsWlD,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { AttachmentFileRowProps } from '../../models/AttachmentFileRow';
|
|
3
|
+
/**
|
|
4
|
+
* Non-previewable attachment tile: a uniform neutral square holding the
|
|
5
|
+
* glyph, extension label, and filename together (no external caption, no
|
|
6
|
+
* per-type color). Type is communicated by glyph + extension text only;
|
|
7
|
+
* color is reserved for upload state (failed = red tile + icon-only retry,
|
|
8
|
+
* uploading = progress bar). Download/retry are icon-only, matching the
|
|
9
|
+
* rest of the app.
|
|
10
|
+
*/
|
|
11
|
+
export declare const AttachmentFileRow: FC<AttachmentFileRowProps>;
|
|
12
|
+
//# sourceMappingURL=AttachmentFileRow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttachmentFileRow.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentFileRow/AttachmentFileRow.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAE,KAAK,EAAE,EAAuC,MAAM,OAAO,CAAC;AACrE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAU7E;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAuKxD,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { AttachmentGroupProps } from '../../models/AttachmentGroup';
|
|
3
|
+
/**
|
|
4
|
+
* Adaptive attachment group for an already-sent message: every attachment —
|
|
5
|
+
* image or file — renders as one uniform 84x84 rounded-square tile, wrapped
|
|
6
|
+
* in a single grid. 5+ attachments collapse behind a "+N" tile; expanding
|
|
7
|
+
* reveals a same-shaped collapse tile to show less again. Type is
|
|
8
|
+
* communicated by glyph + extension text only; color is reserved for
|
|
9
|
+
* upload state. Download actions are icon-only, matching the rest of the app.
|
|
10
|
+
*/
|
|
11
|
+
export declare const AttachmentGroup: FC<AttachmentGroupProps>;
|
|
12
|
+
//# sourceMappingURL=AttachmentGroup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttachmentGroup.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentGroup/AttachmentGroup.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,EAAE,EAAqB,MAAM,OAAO,CAAC;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAczE;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CA4IpD,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { AttachmentMoreTileProps } from '../../models/AttachmentMoreTile';
|
|
3
|
+
/**
|
|
4
|
+
* Square placeholder tile shown in the attachment grid: a "+N" tile when
|
|
5
|
+
* collapsed (activating it expands the group), or — via `children` — a
|
|
6
|
+
* collapse-icon tile in the same tile form for "show less".
|
|
7
|
+
*/
|
|
8
|
+
export declare const AttachmentMoreTile: FC<AttachmentMoreTileProps>;
|
|
9
|
+
//# sourceMappingURL=AttachmentMoreTile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttachmentMoreTile.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentMoreTile/AttachmentMoreTile.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAG/E;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,uBAAuB,CAmB1D,CAAC"}
|
package/index.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
.
|
|
1
|
+
._card_1wsze_1{border-color:var(--ci-card-border,var(--stroke-secondary,#d1dbea));background:var(--ci-card-bg,var(--bg-layer-0,#fcfcfc))}._cardError_1wsze_6{border-color:var(--ci-card-border-error,var(--stroke-error,#ae2f2f))}._cardSelected_1wsze_10{background:var(--ci-card-bg-selected,var(--bg-accent-primary-alpha,#7da4ff2e));border-color:var(--ci-card-border-selected,var(--stroke-accent-primary,#124ace))}._cardPrompt_1wsze_15:hover,._cardPasted_1wsze_16:hover{background:var(--ci-card-bg-hover,var(--controls-bg-neutral-hover,#d1dbea))}._name_1wsze_20{color:var(--ci-card-name,var(--text-primary,#161b2d))}._meta_1wsze_24{color:var(--ci-card-meta,var(--text-secondary,#575f73))}._loadingOverlay_1wsze_28{background:var(--ci-loading-overlay-bg,var(--bg-blackout,#0c101d4d))}._actionBtn_1wsze_32{color:var(--ci-card-action-color,var(--text-primary,#161b2d))}._actionBtn_1wsze_32:hover{background:var(--ci-card-remove-bg-hover,var(--bg-layer-3,#fcfcfc))}._card_1wsze_1:focus-within{outline-color:var(--ci-card-focus-outline,var(--controls-stroke-focus,#eef1f7))}._removeBtnImage_1wsze_43{background:var(--ci-card-remove-bg,var(--bg-layer-2,#eef1f7));color:var(--ci-card-remove-color,var(--text-primary,#161b2d))}._removeBtnImage_1wsze_43:hover{background:var(--ci-card-remove-bg-hover,var(--bg-layer-3,#fcfcfc))}._hoverDownloadIcon_1wsze_51{background:var(--ci-card-hover-icon-bg,var(--bg-layer-2,#161b2d));color:var(--ci-card-hover-icon-color,var(--text-primary,#eef1f7))}._tile_1x7ag_2{background:var(--ci-tile-bg,var(--bg-layer-3,#1d2439));border-color:var(--ci-tile-border,var(--stroke-secondary,#d1dbea))}._tile_1x7ag_2:hover{border-color:var(--ci-tile-border-hover,#0000001f)}._tile_1x7ag_2:focus-visible{outline-color:var(--ci-tile-focus-outline,var(--controls-stroke-focus,#eef1f7))}._tileLight_1x7ag_27{background:var(--ci-tile-bg,var(--bg-layer-6,#f8fafc))}._tileError_1x7ag_31{background:var(--ci-tile-bg-error,var(--bg-error,#402027));border-color:var(--ci-tile-border-error,var(--stroke-error,#f76464))}._tileError_1x7ag_31:hover{border-color:var(--ci-tile-border-error,var(--stroke-error,#f76464))}._tileError_1x7ag_31 ._nameText_1x7ag_38,._tileError_1x7ag_31 ._typeText_1x7ag_39{color:var(--ci-tile-error-text,var(--text-error,#ae2f2f))}._nameText_1x7ag_38{color:var(--ci-tile-name-text,var(--text-primary,#161b2d))}._typeText_1x7ag_39{color:var(--ci-tile-type-text,var(--text-secondary,#575f73))}._retryIcon_1x7ag_51{color:var(--ci-tile-error-text,var(--text-error,#ae2f2f))}._hoverIcon_1x7ag_55{background:var(--ci-tile-hover-icon-bg,var(--bg-layer-2,#161b2d));color:var(--ci-tile-hover-icon-color,var(--text-primary,#eef1f7))}._track_1x7ag_60{background:var(--ci-tile-track-bg,var(--bg-layer-1,#0c101d))}._indeterminateFill_1x7ag_64{background:var(--ci-tile-fill-bg,var(--bg-accent-primary,#5c8dea));animation:1.2s ease-in-out infinite _attachment-tile-indeterminate_1x7ag_1}@media (prefers-reduced-motion:reduce){._indeterminateFill_1x7ag_64{animation:none}}@keyframes _attachment-tile-indeterminate_1x7ag_1{0%{transform:translate(-100%)}to{transform:translate(300%)}}._tile_kvom5_1{background:var(--ci-more-tile-bg,var(--bg-layer-2,#161b2d));border-color:var(--ci-more-tile-border,var(--stroke-secondary,#d1dbea));color:var(--ci-more-tile-color,var(--text-secondary,#575f73))}._tile_kvom5_1:hover{background:var(--ci-more-tile-bg-hover,var(--bg-accent-primary-alpha,#7da4ff2e));color:var(--ci-more-tile-color-hover,var(--bg-accent-primary,#2764d9));border-color:var(--ci-more-tile-border-hover,color-mix(in srgb, var(--stroke-accent-primary,#7da4ff) 50%, transparent))}._tile_kvom5_1:focus-visible{outline-color:var(--ci-more-tile-focus-outline,var(--controls-stroke-focus,#eef1f7))}._container_4zxg9_1{background:var(--ci-group-bg,var(--bg-layer-2,#161b2d));border-color:var(--ci-group-border,var(--stroke-secondary,#d1dbea))}._headerIcon_4zxg9_6,._headerLabel_4zxg9_7,._downloadAllButton_4zxg9_8{color:var(--text-secondary,#575f73)}._imageTile_4zxg9_12{--ci-card-bg:var(--bg-layer-3,#1d2439)}
|
|
2
2
|
/*$vite$:1*/
|
package/index.d.ts
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
export { AttachmentCard } from './components/AttachmentCard/AttachmentCard';
|
|
2
2
|
export { AttachmentTray } from './components/AttachmentTray/AttachmentTray';
|
|
3
|
+
export { AttachmentGroup } from './components/AttachmentGroup/AttachmentGroup';
|
|
4
|
+
export { AttachmentFileRow } from './components/AttachmentFileRow/AttachmentFileRow';
|
|
5
|
+
export { AttachmentMoreTile } from './components/AttachmentMoreTile/AttachmentMoreTile';
|
|
3
6
|
export { FileDndOverlay } from './components/FileDndOverlay/FileDndOverlay';
|
|
4
7
|
export type { AttachmentCardProps, AttachmentCardColors, AttachmentCardTypography, } from './models/AttachmentCard';
|
|
5
8
|
export type { AttachmentTrayProps } from './models/AttachmentTray';
|
|
9
|
+
export type { AttachmentGroupProps } from './models/AttachmentGroup';
|
|
10
|
+
export type { AttachmentFileRowProps } from './models/AttachmentFileRow';
|
|
11
|
+
export type { AttachmentMoreTileProps } from './models/AttachmentMoreTile';
|
|
6
12
|
export type { FileDndOverlayProps } from './models/FileDndOverlay';
|
|
7
13
|
export { useClipboardPaste } from './hooks/useClipboardPaste';
|
|
8
14
|
export { useLazyImageLoad, LazyImageLoadStatus, } from './hooks/useLazyImageLoad';
|
|
9
15
|
export { generateAttachmentId } from './utils/generateAttachmentId';
|
|
10
|
-
export { getAttachmentCardState } from './utils/getAttachmentCardState';
|
|
16
|
+
export { getAttachmentCardState, getExtFromContentType, } from './utils/getAttachmentCardState';
|
|
11
17
|
export type { AttachmentCardState } from './utils/getAttachmentCardState';
|
|
12
18
|
export { getAttachmentIcon } from './utils/getAttachmentIcon';
|
|
19
|
+
export { getAttachmentTilesPlan, AttachmentTilesLayout, ATTACHMENT_COLLAPSE_THRESHOLD, ATTACHMENT_COLLAPSED_VISIBLE_COUNT, } from './utils/getAttachmentGroupLayout';
|
|
20
|
+
export type { AttachmentTilesPlan } from './utils/getAttachmentGroupLayout';
|
|
13
21
|
export { getNameWithoutExtension } from './utils/getNameWithoutExtension';
|
|
14
22
|
export { mimeTypesToExtensionLabels, isMimeTypeAllowed, } from './utils/attachment-mime';
|
|
15
23
|
export { MAX_UPLOADS_PER_MINUTE } from './constants/upload';
|
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,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAE5E,YAAY,EACV,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,yBAAyB,CAAC;AACjC,YAAY,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,YAAY,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAEnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EACL,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,
|
|
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,iBAAiB,EAAE,MAAM,kDAAkD,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AACxF,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAE5E,YAAY,EACV,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,yBAAyB,CAAC;AACjC,YAAY,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,YAAY,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACrE,YAAY,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACzE,YAAY,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,YAAY,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAEnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EACL,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EACL,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,gCAAgC,CAAC;AACxC,YAAY,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,6BAA6B,EAC7B,kCAAkC,GACnC,MAAM,kCAAkC,CAAC;AAC1C,YAAY,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EACL,0BAA0B,EAC1B,iBAAiB,GAClB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { AttachmentErrorReason as e, AttachmentType as t,
|
|
2
|
-
import { DIAL_ICON_SIZE as
|
|
3
|
-
import { IconClipboard as
|
|
4
|
-
import { useCallback as
|
|
5
|
-
import { Fragment as
|
|
1
|
+
import { AttachmentErrorReason as e, AttachmentType as t, CodeBlockTheme as n, Highlight as r, MIME_TYPE_EXT_MAP as i, RequestStatus as a, buildCssVars as o, mergeClasses as s } from "@epam/ai-dial-chat-shared";
|
|
2
|
+
import { DIAL_ICON_SIZE as c, DialGhostIconButton as l, DialSkeleton as u, DialSkeletonVariant as d, DialSpinner as f, ElementSize as p } from "@epam/ai-dial-ui-kit";
|
|
3
|
+
import { IconChevronUp as m, IconClipboard as h, IconDownload as g, IconFile as _, IconFileDescription as v, IconFileTypeBmp as y, IconFileTypeCss as b, IconFileTypeCsv as x, IconFileTypeDoc as S, IconFileTypeDocx as C, IconFileTypeHtml as w, IconFileTypeJpg as T, IconFileTypeJs as E, IconFileTypeJsx as D, IconFileTypePdf as O, IconFileTypePhp as k, IconFileTypePng as A, IconFileTypePpt as j, IconFileTypeRs as M, IconFileTypeSql as N, IconFileTypeSvg as P, IconFileTypeTs as F, IconFileTypeTsx as I, IconFileTypeTxt as L, IconFileTypeVue as ee, IconFileTypeXls as te, IconFileTypeXml as ne, IconFileTypeZip as R, IconFileX as z, IconMusic as B, IconPaperclip as V, IconPhoto as H, IconReload as re, IconTerminal2 as ie, IconVideo as ae, IconX as oe } from "@tabler/icons-react";
|
|
4
|
+
import { useCallback as U, useEffect as W, useMemo as se, useRef as ce, useState as G } from "react";
|
|
5
|
+
import { Fragment as K, jsx as q, jsxs as J } from "react/jsx-runtime";
|
|
6
6
|
//#region src/hooks/useLazyImageLoad.ts
|
|
7
|
-
var
|
|
7
|
+
var Y = /* @__PURE__ */ function(e) {
|
|
8
8
|
return e.Idle = "idle", e.Loading = "loading", e.Loaded = "loaded", e.Error = "error", e;
|
|
9
|
-
}({}),
|
|
10
|
-
let n =
|
|
11
|
-
return
|
|
9
|
+
}({}), le = ({ enabled: e, src: t }) => {
|
|
10
|
+
let n = ce(null), [r, i] = G("idle");
|
|
11
|
+
return W(() => {
|
|
12
12
|
i(e && t ? "loading" : "idle");
|
|
13
|
-
}, [e, t]),
|
|
13
|
+
}, [e, t]), W(() => {
|
|
14
14
|
let r = n.current;
|
|
15
15
|
if (!r || !e || !t) return;
|
|
16
16
|
let a = () => i("loaded"), o = () => i("error");
|
|
@@ -21,327 +21,520 @@ var q = /* @__PURE__ */ function(e) {
|
|
|
21
21
|
imageRef: n,
|
|
22
22
|
imageLoadStatus: r
|
|
23
23
|
};
|
|
24
|
-
},
|
|
25
|
-
card: "
|
|
26
|
-
cardError: "
|
|
27
|
-
cardSelected: "
|
|
28
|
-
cardPrompt: "
|
|
29
|
-
cardPasted: "
|
|
30
|
-
name: "
|
|
31
|
-
meta: "
|
|
32
|
-
loadingOverlay: "
|
|
33
|
-
actionBtn: "
|
|
34
|
-
removeBtnImage: "
|
|
35
|
-
|
|
36
|
-
|
|
24
|
+
}, X = {
|
|
25
|
+
card: "_card_1wsze_1",
|
|
26
|
+
cardError: "_cardError_1wsze_6",
|
|
27
|
+
cardSelected: "_cardSelected_1wsze_10",
|
|
28
|
+
cardPrompt: "_cardPrompt_1wsze_15",
|
|
29
|
+
cardPasted: "_cardPasted_1wsze_16",
|
|
30
|
+
name: "_name_1wsze_20",
|
|
31
|
+
meta: "_meta_1wsze_24",
|
|
32
|
+
loadingOverlay: "_loadingOverlay_1wsze_28",
|
|
33
|
+
actionBtn: "_actionBtn_1wsze_32",
|
|
34
|
+
removeBtnImage: "_removeBtnImage_1wsze_43",
|
|
35
|
+
hoverDownloadIcon: "_hoverDownloadIcon_1wsze_51"
|
|
36
|
+
}, Z = (e) => {
|
|
37
|
+
if (!e) return _;
|
|
37
38
|
if (e.startsWith("image/")) switch (e) {
|
|
38
39
|
case "image/jpeg":
|
|
39
|
-
case "image/jpg": return
|
|
40
|
-
case "image/png": return
|
|
41
|
-
case "image/svg+xml": return
|
|
42
|
-
case "image/bmp": return
|
|
43
|
-
default: return
|
|
40
|
+
case "image/jpg": return T;
|
|
41
|
+
case "image/png": return A;
|
|
42
|
+
case "image/svg+xml": return P;
|
|
43
|
+
case "image/bmp": return y;
|
|
44
|
+
default: return H;
|
|
44
45
|
}
|
|
45
|
-
if (e.startsWith("video/")) return
|
|
46
|
-
if (e.startsWith("audio/")) return
|
|
46
|
+
if (e.startsWith("video/")) return ae;
|
|
47
|
+
if (e.startsWith("audio/")) return B;
|
|
47
48
|
switch (e) {
|
|
48
|
-
case "application/pdf": return
|
|
49
|
+
case "application/pdf": return O;
|
|
49
50
|
case "application/msword":
|
|
50
|
-
case "application/vnd.ms-word": return
|
|
51
|
-
case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": return
|
|
52
|
-
case "application/vnd.ms-powerpoint": return
|
|
53
|
-
case "application/vnd.openxmlformats-officedocument.presentationml.presentation": return
|
|
54
|
-
case "application/vnd.ms-excel": return
|
|
55
|
-
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": return
|
|
51
|
+
case "application/vnd.ms-word": return S;
|
|
52
|
+
case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": return C;
|
|
53
|
+
case "application/vnd.ms-powerpoint": return j;
|
|
54
|
+
case "application/vnd.openxmlformats-officedocument.presentationml.presentation": return j;
|
|
55
|
+
case "application/vnd.ms-excel": return te;
|
|
56
|
+
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": return te;
|
|
56
57
|
case "application/zip":
|
|
57
58
|
case "application/x-zip-compressed":
|
|
58
59
|
case "application/x-rar-compressed":
|
|
59
60
|
case "application/x-7z-compressed":
|
|
60
61
|
case "application/gzip":
|
|
61
|
-
case "application/x-tar": return
|
|
62
|
-
case "text/csv": return
|
|
63
|
-
case "text/plain": return
|
|
62
|
+
case "application/x-tar": return R;
|
|
63
|
+
case "text/csv": return x;
|
|
64
|
+
case "text/plain": return L;
|
|
64
65
|
case "text/html":
|
|
65
|
-
case "application/xhtml+xml": return
|
|
66
|
+
case "application/xhtml+xml": return w;
|
|
66
67
|
case "text/xml":
|
|
67
|
-
case "application/xml": return
|
|
68
|
+
case "application/xml": return ne;
|
|
68
69
|
case "application/sql":
|
|
69
|
-
case "text/x-sql": return
|
|
70
|
+
case "text/x-sql": return N;
|
|
70
71
|
case "text/javascript":
|
|
71
|
-
case "application/javascript": return
|
|
72
|
-
case "text/jsx": return
|
|
72
|
+
case "application/javascript": return E;
|
|
73
|
+
case "text/jsx": return D;
|
|
73
74
|
case "application/typescript":
|
|
74
|
-
case "text/typescript": return
|
|
75
|
-
case "text/tsx": return
|
|
76
|
-
case "text/css": return
|
|
75
|
+
case "text/typescript": return F;
|
|
76
|
+
case "text/tsx": return I;
|
|
77
|
+
case "text/css": return b;
|
|
77
78
|
case "text/x-php":
|
|
78
|
-
case "application/x-php": return
|
|
79
|
+
case "application/x-php": return k;
|
|
79
80
|
case "text/x-rustsrc":
|
|
80
|
-
case "application/x-rust": return
|
|
81
|
-
case "text/x-vue": return
|
|
82
|
-
default: return
|
|
81
|
+
case "application/x-rust": return M;
|
|
82
|
+
case "text/x-vue": return ee;
|
|
83
|
+
default: return _;
|
|
83
84
|
}
|
|
84
|
-
},
|
|
85
|
+
}, ue = (e) => {
|
|
85
86
|
let { type: n, contentType: r } = e;
|
|
86
|
-
return n === t.Prompt ?
|
|
87
|
-
},
|
|
88
|
-
let t = e.toLowerCase().split(";")[0].trim(), n =
|
|
87
|
+
return n === t.Prompt ? ie : n === t.Pasted ? h : n === t.Image ? H : Z(r ?? "");
|
|
88
|
+
}, de = (e) => {
|
|
89
|
+
let t = e.toLowerCase().split(";")[0].trim(), n = i[t];
|
|
89
90
|
if (n) return n;
|
|
90
|
-
let
|
|
91
|
-
if (
|
|
92
|
-
},
|
|
91
|
+
let r = t.split("/")[1];
|
|
92
|
+
if (r && !r.startsWith("vnd.") && !r.includes("+")) return r;
|
|
93
|
+
}, fe = (e) => {
|
|
93
94
|
let { type: n, name: r, contentType: i } = e;
|
|
94
95
|
if (n === t.Prompt) return "Prompt";
|
|
95
96
|
if (n === t.Pasted) return "Pasted";
|
|
96
97
|
if (n === t.Image) return "Image";
|
|
97
98
|
if (i) {
|
|
98
|
-
let e =
|
|
99
|
+
let e = de(i);
|
|
99
100
|
if (e) return `.${e}`;
|
|
100
101
|
}
|
|
101
102
|
let a = r.lastIndexOf(".");
|
|
102
103
|
return a > 0 && a < r.length - 1 ? `.${r.slice(a + 1).toLowerCase()}` : r;
|
|
103
|
-
},
|
|
104
|
-
let { type:
|
|
104
|
+
}, pe = (e, n, r) => {
|
|
105
|
+
let { type: i, status: o, previewUrl: c, url: l } = e, u = o === a.Loading, d = o === a.Error, f = i === t.Image && !!(c ?? l) && !d, p = i === t.Audio && !d, m = s(X.card, d && X.cardError, n && X.cardSelected, !d && !n && i === t.Prompt && X.cardPrompt, !d && !n && i === t.Pasted && X.cardPasted);
|
|
105
106
|
return {
|
|
106
107
|
isLoading: u,
|
|
107
108
|
isError: d,
|
|
108
109
|
isImage: f,
|
|
109
110
|
isAudio: p,
|
|
110
111
|
areActionsVisible: d || r,
|
|
111
|
-
BottomIcon:
|
|
112
|
-
typeLabel:
|
|
113
|
-
cardColorClass:
|
|
114
|
-
removeBtnClass: f ?
|
|
112
|
+
BottomIcon: ue(e),
|
|
113
|
+
typeLabel: fe(e),
|
|
114
|
+
cardColorClass: m,
|
|
115
|
+
removeBtnClass: f ? X.removeBtnImage : X.actionBtn
|
|
115
116
|
};
|
|
116
|
-
},
|
|
117
|
+
}, me = (e) => {
|
|
117
118
|
let t = e.lastIndexOf(".");
|
|
118
119
|
return t > 0 ? e.slice(0, t) : e;
|
|
119
|
-
},
|
|
120
|
-
let { id:
|
|
121
|
-
"--ci-card-border":
|
|
122
|
-
"--ci-card-bg":
|
|
123
|
-
"--ci-card-name":
|
|
124
|
-
"--ci-card-meta":
|
|
125
|
-
}), { isLoading:
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
]), { imageRef:
|
|
130
|
-
enabled:
|
|
131
|
-
src:
|
|
132
|
-
}),
|
|
133
|
-
|
|
134
|
-
},
|
|
135
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
120
|
+
}, he = ({ attachment: n, searchQuery: i = "", onRemove: a, onRetry: m, onExpand: h, onClick: _, isSelected: v, shouldAlwaysShowActions: y, removeLabel: b = "Remove attachment", retryLabel: x = "Retry upload", clickLabel: S = "Open attachment", colors: C, typography: w, roundedClassName: T = "rounded-xl", showHoverDownloadIcon: E = !1, className: D }) => {
|
|
121
|
+
let { id: O, name: k } = n, A = n.previewUrl ?? n.url, j = n.type === t.Pasted, M = j && h !== void 0, N = se(() => j ? k : me(k), [j, k]), P = o({
|
|
122
|
+
"--ci-card-border": C?.border,
|
|
123
|
+
"--ci-card-bg": C?.background,
|
|
124
|
+
"--ci-card-name": C?.nameText,
|
|
125
|
+
"--ci-card-meta": C?.metaText
|
|
126
|
+
}), { isLoading: F, isError: I, isImage: L, isAudio: ee, areActionsVisible: te, BottomIcon: ne, typeLabel: R, cardColorClass: z, removeBtnClass: B } = se(() => pe(n, v ?? !1, y ?? !1), [
|
|
127
|
+
n,
|
|
128
|
+
v,
|
|
129
|
+
y
|
|
130
|
+
]), V = _ !== void 0 && !M && !F && !I, ie = M || V, { imageRef: ae, imageLoadStatus: U } = le({
|
|
131
|
+
enabled: L,
|
|
132
|
+
src: A
|
|
133
|
+
}), W = () => {
|
|
134
|
+
M && h ? h(O) : V && _ && _(O);
|
|
135
|
+
}, ce = (e) => {
|
|
136
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), W());
|
|
136
137
|
};
|
|
137
|
-
if (
|
|
138
|
-
style:
|
|
139
|
-
className:
|
|
140
|
-
children: [/* @__PURE__ */
|
|
138
|
+
if (ee) return /* @__PURE__ */ J("div", {
|
|
139
|
+
style: P,
|
|
140
|
+
className: s("group flex w-full min-w-[280px] max-w-[300px] flex-col gap-2 border p-3", T, z, D),
|
|
141
|
+
children: [/* @__PURE__ */ J("div", {
|
|
141
142
|
className: "flex items-center justify-between gap-2",
|
|
142
|
-
children: [/* @__PURE__ */
|
|
143
|
-
title:
|
|
144
|
-
className:
|
|
145
|
-
children: i ? /* @__PURE__ */
|
|
146
|
-
text:
|
|
143
|
+
children: [/* @__PURE__ */ q("span", {
|
|
144
|
+
title: n.name,
|
|
145
|
+
className: s(w?.fontClassName ?? "dial-tiny-text", "min-w-0 truncate", X.name),
|
|
146
|
+
children: i ? /* @__PURE__ */ q(r, {
|
|
147
|
+
text: n.name,
|
|
147
148
|
query: i,
|
|
148
149
|
maxLines: 1
|
|
149
|
-
}) :
|
|
150
|
-
}),
|
|
151
|
-
icon: /* @__PURE__ */
|
|
152
|
-
size:
|
|
150
|
+
}) : n.name
|
|
151
|
+
}), _ && /* @__PURE__ */ q(l, {
|
|
152
|
+
icon: /* @__PURE__ */ q(g, {
|
|
153
|
+
size: c.SM,
|
|
153
154
|
"aria-hidden": !0
|
|
154
155
|
}),
|
|
155
|
-
size:
|
|
156
|
-
className:
|
|
157
|
-
"aria-label":
|
|
156
|
+
size: p.Small,
|
|
157
|
+
className: s("h-6 w-6 shrink-0 rounded", B),
|
|
158
|
+
"aria-label": S,
|
|
158
159
|
onClick: (e) => {
|
|
159
|
-
e.stopPropagation(),
|
|
160
|
+
e.stopPropagation(), _(O);
|
|
160
161
|
}
|
|
161
162
|
})]
|
|
162
|
-
}),
|
|
163
|
+
}), n.playUrl && /* @__PURE__ */ q("audio", {
|
|
163
164
|
controls: !0,
|
|
164
|
-
src:
|
|
165
|
+
src: n.playUrl,
|
|
165
166
|
className: "w-full",
|
|
166
167
|
preload: "metadata"
|
|
167
168
|
})]
|
|
168
169
|
});
|
|
169
|
-
let
|
|
170
|
-
|
|
170
|
+
let G = s("group relative flex h-[100px] w-[100px] flex-shrink-0 border focus-within:outline focus-within:outline-1 focus-within:outline-offset-1", T, z, !L && "flex-col gap-3 p-3", ie && "cursor-pointer", D), Z = /* @__PURE__ */ J(K, { children: [
|
|
171
|
+
L ? /* @__PURE__ */ J("div", {
|
|
171
172
|
className: "relative h-full w-full overflow-hidden",
|
|
172
|
-
children: [
|
|
173
|
-
variant:
|
|
173
|
+
children: [U !== Y.Loaded && /* @__PURE__ */ q(u, {
|
|
174
|
+
variant: d.Rectangular,
|
|
174
175
|
width: "100%",
|
|
175
176
|
height: "100%",
|
|
176
|
-
active:
|
|
177
|
-
overlay: /* @__PURE__ */
|
|
178
|
-
size:
|
|
179
|
-
className:
|
|
177
|
+
active: U === Y.Loading,
|
|
178
|
+
overlay: /* @__PURE__ */ q(H, {
|
|
179
|
+
size: c.LG,
|
|
180
|
+
className: w?.placeholderIconClassName ?? "text-secondary",
|
|
180
181
|
"aria-hidden": !0
|
|
181
182
|
}),
|
|
182
|
-
className:
|
|
183
|
-
}), /* @__PURE__ */
|
|
184
|
-
ref:
|
|
185
|
-
src:
|
|
186
|
-
alt:
|
|
183
|
+
className: s("absolute inset-0", T)
|
|
184
|
+
}), /* @__PURE__ */ q("img", {
|
|
185
|
+
ref: ae,
|
|
186
|
+
src: A,
|
|
187
|
+
alt: k,
|
|
187
188
|
loading: "lazy",
|
|
188
189
|
decoding: "async",
|
|
189
|
-
className:
|
|
190
|
+
className: s("h-full w-full object-cover transition-opacity duration-200", U === Y.Loaded ? "opacity-100" : "opacity-0", T)
|
|
190
191
|
})]
|
|
191
|
-
}) :
|
|
192
|
+
}) : I ? /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ J("div", {
|
|
192
193
|
className: "flex flex-row items-center gap-1 overflow-hidden",
|
|
193
|
-
children: [/* @__PURE__ */
|
|
194
|
-
size:
|
|
195
|
-
className:
|
|
194
|
+
children: [/* @__PURE__ */ q(ne, {
|
|
195
|
+
size: c.SM,
|
|
196
|
+
className: s("shrink-0", X.meta),
|
|
196
197
|
"aria-hidden": !0
|
|
197
|
-
}), /* @__PURE__ */
|
|
198
|
+
}), /* @__PURE__ */ q("span", {
|
|
198
199
|
title: R,
|
|
199
|
-
className:
|
|
200
|
+
className: s(w?.metaClassName ?? "dial-tiny-text", "min-w-0 truncate", X.meta),
|
|
200
201
|
children: R
|
|
201
202
|
})]
|
|
202
|
-
}), /* @__PURE__ */
|
|
203
|
+
}), /* @__PURE__ */ q("div", {
|
|
203
204
|
className: "min-w-0 flex-1",
|
|
204
|
-
children: /* @__PURE__ */
|
|
205
|
-
title:
|
|
206
|
-
className:
|
|
207
|
-
children: i ? /* @__PURE__ */
|
|
208
|
-
text:
|
|
205
|
+
children: /* @__PURE__ */ q("div", {
|
|
206
|
+
title: N,
|
|
207
|
+
className: s(w?.fontClassName ?? "dial-tiny-text", "line-clamp-3 break-words", X.name),
|
|
208
|
+
children: i ? /* @__PURE__ */ q(r, {
|
|
209
|
+
text: N,
|
|
209
210
|
query: i,
|
|
210
211
|
maxLines: 3
|
|
211
|
-
}) :
|
|
212
|
+
}) : N
|
|
212
213
|
})
|
|
213
|
-
})] }) : /* @__PURE__ */ K
|
|
214
|
+
})] }) : /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q("div", {
|
|
214
215
|
className: "min-w-0 flex-1",
|
|
215
|
-
children: /* @__PURE__ */
|
|
216
|
-
title:
|
|
217
|
-
className:
|
|
218
|
-
children: i ? /* @__PURE__ */
|
|
219
|
-
text:
|
|
216
|
+
children: /* @__PURE__ */ q("div", {
|
|
217
|
+
title: N,
|
|
218
|
+
className: s(w?.fontClassName ?? "dial-tiny-text", "line-clamp-3 break-words", X.name),
|
|
219
|
+
children: i ? /* @__PURE__ */ q(r, {
|
|
220
|
+
text: N,
|
|
220
221
|
query: i,
|
|
221
222
|
maxLines: 3
|
|
222
|
-
}) :
|
|
223
|
+
}) : N
|
|
223
224
|
})
|
|
224
|
-
}), /* @__PURE__ */
|
|
225
|
+
}), /* @__PURE__ */ J("div", {
|
|
225
226
|
className: "flex flex-row items-center gap-1 overflow-hidden",
|
|
226
|
-
children: [/* @__PURE__ */
|
|
227
|
-
size:
|
|
228
|
-
className:
|
|
227
|
+
children: [/* @__PURE__ */ q(ne, {
|
|
228
|
+
size: c.SM,
|
|
229
|
+
className: s("shrink-0", X.meta),
|
|
229
230
|
"aria-hidden": !0
|
|
230
|
-
}), /* @__PURE__ */
|
|
231
|
+
}), /* @__PURE__ */ q("span", {
|
|
231
232
|
title: R,
|
|
232
|
-
className:
|
|
233
|
+
className: s(w?.metaClassName ?? "dial-tiny-text", "min-w-0 truncate", X.meta),
|
|
233
234
|
children: R
|
|
234
235
|
})]
|
|
235
236
|
})] }),
|
|
236
|
-
|
|
237
|
-
className:
|
|
238
|
-
children: /* @__PURE__ */
|
|
237
|
+
F && /* @__PURE__ */ q("span", {
|
|
238
|
+
className: s("absolute inset-0 flex items-center justify-center", T, X.loadingOverlay),
|
|
239
|
+
children: /* @__PURE__ */ q(f, {
|
|
239
240
|
size: 40,
|
|
240
241
|
ariaLabel: "Loading attachment",
|
|
241
242
|
className: "z-50"
|
|
242
243
|
})
|
|
243
244
|
}),
|
|
244
|
-
!
|
|
245
|
-
className:
|
|
246
|
-
children: [
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
245
|
+
!F && /* @__PURE__ */ J("div", {
|
|
246
|
+
className: s("absolute end-1 top-1 flex gap-1 transition-opacity", te ? "opacity-100" : "opacity-0 group-focus-within:opacity-100 group-hover:opacity-100 mobile:opacity-100"),
|
|
247
|
+
children: [
|
|
248
|
+
I && m && n.errorReason !== e.UnsupportedType && /* @__PURE__ */ q(l, {
|
|
249
|
+
icon: /* @__PURE__ */ q(re, {
|
|
250
|
+
size: c.SM,
|
|
251
|
+
"aria-hidden": !0
|
|
252
|
+
}),
|
|
253
|
+
size: p.Small,
|
|
254
|
+
className: s("h-6 w-6 rounded", B),
|
|
255
|
+
"aria-label": x,
|
|
256
|
+
onClick: (e) => {
|
|
257
|
+
e.stopPropagation(), m(O);
|
|
258
|
+
}
|
|
250
259
|
}),
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
260
|
+
a && /* @__PURE__ */ q(l, {
|
|
261
|
+
icon: /* @__PURE__ */ q(oe, {
|
|
262
|
+
size: c.SM,
|
|
263
|
+
"aria-hidden": !0
|
|
264
|
+
}),
|
|
265
|
+
size: p.Small,
|
|
266
|
+
className: s("h-6 w-6 rounded", B),
|
|
267
|
+
"aria-label": b,
|
|
268
|
+
onClick: (e) => {
|
|
269
|
+
e.stopPropagation(), a?.(O);
|
|
270
|
+
}
|
|
261
271
|
}),
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
})]
|
|
272
|
+
E && !a && !I && /* @__PURE__ */ q(g, {
|
|
273
|
+
size: c.SM,
|
|
274
|
+
"aria-hidden": !0,
|
|
275
|
+
className: s("h-6 w-6 rounded-lg p-1", X.hoverDownloadIcon)
|
|
276
|
+
})
|
|
277
|
+
]
|
|
269
278
|
})
|
|
270
279
|
] });
|
|
271
|
-
return
|
|
272
|
-
style:
|
|
273
|
-
className:
|
|
274
|
-
onClick:
|
|
275
|
-
onKeyDown:
|
|
280
|
+
return ie ? /* @__PURE__ */ q("div", {
|
|
281
|
+
style: P,
|
|
282
|
+
className: G,
|
|
283
|
+
onClick: W,
|
|
284
|
+
onKeyDown: ce,
|
|
276
285
|
tabIndex: 0,
|
|
277
286
|
role: "button",
|
|
278
|
-
"aria-label":
|
|
287
|
+
"aria-label": V ? S : void 0,
|
|
279
288
|
children: Z
|
|
280
|
-
}) : /* @__PURE__ */
|
|
281
|
-
style:
|
|
282
|
-
className:
|
|
289
|
+
}) : /* @__PURE__ */ q("div", {
|
|
290
|
+
style: P,
|
|
291
|
+
className: G,
|
|
283
292
|
children: Z
|
|
284
293
|
});
|
|
285
|
-
},
|
|
294
|
+
}, ge = ({ attachments: e, onRemove: t, onRetry: n, onExpand: r, ariaLabel: i = "Attached files", removeLabel: a, retryLabel: o, onAttachmentClick: c, clickLabel: l, className: u }) => e.length === 0 ? null : /* @__PURE__ */ q("div", {
|
|
286
295
|
role: "list",
|
|
287
296
|
"aria-label": i,
|
|
288
|
-
className:
|
|
289
|
-
children: e.map((e) => /* @__PURE__ */
|
|
297
|
+
className: s("flex w-full min-w-0 gap-2 overflow-x-auto", u),
|
|
298
|
+
children: e.map((e) => /* @__PURE__ */ q("div", {
|
|
290
299
|
role: "listitem",
|
|
291
|
-
children: /* @__PURE__ */
|
|
300
|
+
children: /* @__PURE__ */ q(he, {
|
|
292
301
|
attachment: e,
|
|
293
302
|
onRemove: t,
|
|
294
303
|
onRetry: n,
|
|
295
304
|
onExpand: r,
|
|
296
305
|
removeLabel: a,
|
|
297
|
-
retryLabel:
|
|
306
|
+
retryLabel: o,
|
|
298
307
|
onClick: c ? () => c(e) : void 0,
|
|
299
308
|
clickLabel: l
|
|
300
309
|
})
|
|
301
310
|
}, e.id))
|
|
302
|
-
}),
|
|
311
|
+
}), _e = /* @__PURE__ */ function(e) {
|
|
312
|
+
return e.None = "none", e.AllVisible = "all-visible", e.Collapsed = "collapsed", e;
|
|
313
|
+
}({}), ve = 5, ye = 4, be = (e, t) => e <= 0 ? {
|
|
314
|
+
layout: "none",
|
|
315
|
+
visibleCount: 0,
|
|
316
|
+
hiddenCount: 0
|
|
317
|
+
} : e < 5 || t ? {
|
|
318
|
+
layout: "all-visible",
|
|
319
|
+
visibleCount: e,
|
|
320
|
+
hiddenCount: 0
|
|
321
|
+
} : {
|
|
322
|
+
layout: "collapsed",
|
|
323
|
+
visibleCount: 4,
|
|
324
|
+
hiddenCount: e - 4
|
|
325
|
+
}, Q = {
|
|
326
|
+
tile: "_tile_1x7ag_2",
|
|
327
|
+
tileLight: "_tileLight_1x7ag_27",
|
|
328
|
+
tileError: "_tileError_1x7ag_31",
|
|
329
|
+
nameText: "_nameText_1x7ag_38",
|
|
330
|
+
typeText: "_typeText_1x7ag_39",
|
|
331
|
+
retryIcon: "_retryIcon_1x7ag_51",
|
|
332
|
+
hoverIcon: "_hoverIcon_1x7ag_55",
|
|
333
|
+
track: "_track_1x7ag_60",
|
|
334
|
+
indeterminateFill: "_indeterminateFill_1x7ag_64",
|
|
335
|
+
"attachment-tile-indeterminate": "_attachment-tile-indeterminate_1x7ag_1"
|
|
336
|
+
}, xe = {
|
|
337
|
+
[e.Network]: "Upload failed · network error",
|
|
338
|
+
[e.UnsupportedType]: "Upload failed · unsupported file type"
|
|
339
|
+
}, Se = ({ attachment: t, onClick: r, onRetry: i, clickLabel: o = "Download attachment", retryLabel: u = "Retry upload", theme: d = n.Dark, className: f }) => {
|
|
340
|
+
let { id: m, name: h, status: _, errorReason: v } = t, y = _ === a.Loading, b = _ === a.Error, x = b && (v && xe[v] || "Upload failed"), { BottomIcon: S, typeLabel: C } = pe(t, !1, !1), w = !b && !y && r !== void 0, T = b && !!i && v !== e.UnsupportedType, E = w || T ? "pe-5" : void 0, D = () => {
|
|
341
|
+
w && r?.(t);
|
|
342
|
+
}, O = (e) => {
|
|
343
|
+
(e.key === "Enter" || e.key === " ") && w && (e.preventDefault(), D());
|
|
344
|
+
}, k = s("group relative flex size-[84px] flex-col justify-between gap-1 overflow-hidden rounded-xl border p-1.5", Q.tile, !b && d === n.Light && Q.tileLight, b && Q.tileError), A = /* @__PURE__ */ q("div", {
|
|
345
|
+
title: h,
|
|
346
|
+
className: s("dial-caption-text line-clamp-2 min-w-0 break-words", Q.nameText, !b && E),
|
|
347
|
+
children: h
|
|
348
|
+
}), j = /* @__PURE__ */ J("div", {
|
|
349
|
+
className: s("flex items-center gap-1 overflow-hidden", b && E),
|
|
350
|
+
children: [/* @__PURE__ */ q(S, {
|
|
351
|
+
size: 16,
|
|
352
|
+
className: Q.typeText,
|
|
353
|
+
"aria-hidden": !0
|
|
354
|
+
}), /* @__PURE__ */ q("span", {
|
|
355
|
+
className: s("dial-caption-text truncate", Q.typeText),
|
|
356
|
+
children: C
|
|
357
|
+
})]
|
|
358
|
+
}), M = /* @__PURE__ */ J(K, { children: [
|
|
359
|
+
b ? /* @__PURE__ */ J(K, { children: [j, A] }) : /* @__PURE__ */ J(K, { children: [A, j] }),
|
|
360
|
+
y && /* @__PURE__ */ q("div", {
|
|
361
|
+
role: "progressbar",
|
|
362
|
+
"aria-label": "Uploading",
|
|
363
|
+
className: s("absolute inset-x-2 bottom-2 h-[3px] overflow-hidden rounded-full", Q.track),
|
|
364
|
+
children: /* @__PURE__ */ q("div", { className: s("h-full w-1/3 rounded-full", Q.indeterminateFill) })
|
|
365
|
+
}),
|
|
366
|
+
w && /* @__PURE__ */ q(g, {
|
|
367
|
+
size: c.SM,
|
|
368
|
+
"aria-hidden": !0,
|
|
369
|
+
className: s("absolute end-1 top-1 h-6 w-6 rounded-lg p-1 opacity-0 transition-opacity group-hover:opacity-100 mobile:opacity-100", Q.hoverIcon)
|
|
370
|
+
}),
|
|
371
|
+
T && /* @__PURE__ */ q(l, {
|
|
372
|
+
icon: /* @__PURE__ */ q(re, {
|
|
373
|
+
size: c.SM,
|
|
374
|
+
"aria-hidden": !0
|
|
375
|
+
}),
|
|
376
|
+
size: p.Small,
|
|
377
|
+
className: s("absolute end-1 top-1 h-6 w-6 rounded-lg", Q.retryIcon),
|
|
378
|
+
"aria-label": u,
|
|
379
|
+
onClick: (e) => {
|
|
380
|
+
e.stopPropagation(), i(m);
|
|
381
|
+
}
|
|
382
|
+
})
|
|
383
|
+
] });
|
|
384
|
+
return /* @__PURE__ */ q("div", {
|
|
385
|
+
className: s("inline-flex", f),
|
|
386
|
+
children: w ? /* @__PURE__ */ q("div", {
|
|
387
|
+
role: "button",
|
|
388
|
+
tabIndex: 0,
|
|
389
|
+
"aria-label": o,
|
|
390
|
+
onClick: D,
|
|
391
|
+
onKeyDown: O,
|
|
392
|
+
className: s(k, "cursor-pointer focus-within:outline focus-within:outline-1 focus-within:outline-offset-1"),
|
|
393
|
+
children: M
|
|
394
|
+
}) : /* @__PURE__ */ q("div", {
|
|
395
|
+
className: k,
|
|
396
|
+
title: x || void 0,
|
|
397
|
+
children: M
|
|
398
|
+
})
|
|
399
|
+
});
|
|
400
|
+
}, Ce = { tile: "_tile_kvom5_1" }, we = ({ count: e, onClick: t, ariaLabel: n, children: r, className: i }) => /* @__PURE__ */ q("button", {
|
|
401
|
+
type: "button",
|
|
402
|
+
onClick: t,
|
|
403
|
+
"aria-label": n ?? `Show ${e} more attachments`,
|
|
404
|
+
className: s("dial-small-semi-text flex size-[84px] items-center justify-center rounded-xl border", Ce.tile, i),
|
|
405
|
+
children: r ?? /* @__PURE__ */ q("bdi", {
|
|
406
|
+
dir: "ltr",
|
|
407
|
+
children: `+${e}`
|
|
408
|
+
})
|
|
409
|
+
}), $ = {
|
|
410
|
+
container: "_container_4zxg9_1",
|
|
411
|
+
headerIcon: "_headerIcon_4zxg9_6",
|
|
412
|
+
headerLabel: "_headerLabel_4zxg9_7",
|
|
413
|
+
downloadAllButton: "_downloadAllButton_4zxg9_8",
|
|
414
|
+
imageTile: "_imageTile_4zxg9_12"
|
|
415
|
+
}, Te = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, Ee = ({ attachments: e, onAttachmentClick: n, onRetry: r, getSizeLabel: i, ariaLabel: o = "Attachments", clickLabel: u = "Download attachment", retryLabel: d = "Retry upload", showLessLabel: f = "Show less", downloadAllLabel: p = "Download all", theme: h, className: v }) => {
|
|
416
|
+
let [y, b] = G(!1), x = se(() => be(e.length, y), [e.length, y]);
|
|
417
|
+
if (e.length === 0) return null;
|
|
418
|
+
let S = e.some((e) => e.type === t.Image), C = e.some((e) => e.type !== t.Image), w = S && C, T = e.length >= 5, E = w ? V : S ? H : _, D = Te(e.length, "attachment"), O = e.slice(0, x.visibleCount);
|
|
419
|
+
return /* @__PURE__ */ J("div", {
|
|
420
|
+
role: "group",
|
|
421
|
+
"aria-label": o,
|
|
422
|
+
className: s("rounded-2xl border p-3", T ? "w-full min-w-0 max-w-[492px]" : "max-w-[420px]", $.container, v),
|
|
423
|
+
children: [/* @__PURE__ */ J("div", {
|
|
424
|
+
className: "mb-3 flex min-h-6 items-center gap-2",
|
|
425
|
+
children: [
|
|
426
|
+
/* @__PURE__ */ q(E, {
|
|
427
|
+
size: c.SM,
|
|
428
|
+
className: s("shrink-0", $.headerIcon),
|
|
429
|
+
"aria-hidden": !0
|
|
430
|
+
}),
|
|
431
|
+
/* @__PURE__ */ q("span", {
|
|
432
|
+
className: s("dial-tiny-semi-text", $.headerLabel),
|
|
433
|
+
children: D
|
|
434
|
+
}),
|
|
435
|
+
e.length >= 2 && n && /* @__PURE__ */ q(l, {
|
|
436
|
+
icon: /* @__PURE__ */ q(g, {
|
|
437
|
+
size: c.SM,
|
|
438
|
+
"aria-hidden": !0
|
|
439
|
+
}),
|
|
440
|
+
className: s("ms-auto h-6 w-6 rounded-lg", $.downloadAllButton),
|
|
441
|
+
"aria-label": p,
|
|
442
|
+
onClick: () => {
|
|
443
|
+
e.filter((e) => e.status === a.Idle).forEach((e) => n?.(e));
|
|
444
|
+
}
|
|
445
|
+
})
|
|
446
|
+
]
|
|
447
|
+
}), /* @__PURE__ */ J("div", {
|
|
448
|
+
role: "list",
|
|
449
|
+
"aria-label": D,
|
|
450
|
+
className: s("gap-3", T ? "grid grid-cols-[repeat(5,84px)] overflow-x-auto" : "flex flex-wrap"),
|
|
451
|
+
children: [
|
|
452
|
+
O.map((e) => /* @__PURE__ */ q("div", {
|
|
453
|
+
role: "listitem",
|
|
454
|
+
children: e.type === t.Image ? /* @__PURE__ */ q(he, {
|
|
455
|
+
attachment: e,
|
|
456
|
+
onClick: n ? () => n(e) : void 0,
|
|
457
|
+
onRetry: r,
|
|
458
|
+
clickLabel: u,
|
|
459
|
+
retryLabel: d,
|
|
460
|
+
roundedClassName: "rounded-xl",
|
|
461
|
+
showHoverDownloadIcon: !0,
|
|
462
|
+
className: s("size-[84px]", $.imageTile)
|
|
463
|
+
}) : /* @__PURE__ */ q(Se, {
|
|
464
|
+
attachment: e,
|
|
465
|
+
sizeLabel: i?.(e),
|
|
466
|
+
onClick: n,
|
|
467
|
+
onRetry: r,
|
|
468
|
+
clickLabel: u,
|
|
469
|
+
retryLabel: d,
|
|
470
|
+
theme: h
|
|
471
|
+
})
|
|
472
|
+
}, e.id)),
|
|
473
|
+
x.layout === _e.Collapsed && /* @__PURE__ */ q("div", {
|
|
474
|
+
role: "listitem",
|
|
475
|
+
children: /* @__PURE__ */ q(we, {
|
|
476
|
+
count: x.hiddenCount,
|
|
477
|
+
onClick: () => b(!0)
|
|
478
|
+
})
|
|
479
|
+
}),
|
|
480
|
+
T && y && /* @__PURE__ */ q("div", {
|
|
481
|
+
role: "listitem",
|
|
482
|
+
children: /* @__PURE__ */ q(we, {
|
|
483
|
+
count: 0,
|
|
484
|
+
onClick: () => b(!1),
|
|
485
|
+
ariaLabel: f,
|
|
486
|
+
children: /* @__PURE__ */ q(m, {
|
|
487
|
+
size: c.MD,
|
|
488
|
+
"aria-hidden": !0
|
|
489
|
+
})
|
|
490
|
+
})
|
|
491
|
+
})
|
|
492
|
+
]
|
|
493
|
+
})]
|
|
494
|
+
});
|
|
495
|
+
}, De = ({ isVisible: e, isAttachmentsAllowed: t = !0, title: n, subtitle: r, iconClassName: i = "text-accent-primary", deniedIconClassName: a = "text-error", titleClassName: o = "heading-3 font-semibold", subtitleClassName: c = "dial-small-text" }) => {
|
|
303
496
|
if (!e) return null;
|
|
304
497
|
let l = n ?? (t ? "Attach files" : "No attachments allowed"), u = r ?? (t ? "Drop files here to attach them to message" : "Attachments can't be added to message"), d = t ? i : a, f = (e) => {
|
|
305
498
|
e.preventDefault();
|
|
306
|
-
}, p = t ?
|
|
307
|
-
return /* @__PURE__ */
|
|
308
|
-
className:
|
|
499
|
+
}, p = t ? v : z;
|
|
500
|
+
return /* @__PURE__ */ q("div", {
|
|
501
|
+
className: s("fixed inset-0 z-[9999] flex items-center justify-center bg-blackout backdrop-blur-sm", t ? "pointer-events-none" : "pointer-events-auto cursor-not-allowed"),
|
|
309
502
|
onDragOver: t ? void 0 : f,
|
|
310
503
|
onDrop: t ? void 0 : f,
|
|
311
|
-
children: /* @__PURE__ */
|
|
504
|
+
children: /* @__PURE__ */ J("div", {
|
|
312
505
|
className: "flex flex-col items-center text-center",
|
|
313
506
|
children: [
|
|
314
|
-
/* @__PURE__ */
|
|
507
|
+
/* @__PURE__ */ q(p, {
|
|
315
508
|
size: 100,
|
|
316
509
|
className: d
|
|
317
510
|
}),
|
|
318
|
-
/* @__PURE__ */
|
|
319
|
-
className:
|
|
511
|
+
/* @__PURE__ */ q("span", {
|
|
512
|
+
className: s("mt-5", o),
|
|
320
513
|
children: l
|
|
321
514
|
}),
|
|
322
|
-
/* @__PURE__ */
|
|
323
|
-
className:
|
|
515
|
+
/* @__PURE__ */ q("span", {
|
|
516
|
+
className: s("mt-4", c),
|
|
324
517
|
children: u
|
|
325
518
|
})
|
|
326
519
|
]
|
|
327
520
|
})
|
|
328
521
|
});
|
|
329
|
-
},
|
|
522
|
+
}, Oe = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, ke = (e, n) => ({ handlePaste: U((r) => {
|
|
330
523
|
if (!r.clipboardData) return;
|
|
331
|
-
let
|
|
332
|
-
if (
|
|
524
|
+
let i = Array.from(r.clipboardData.items).filter((e) => e.kind === "file" && e.type.startsWith("image/")), o = r.clipboardData.getData("text/plain").length > 0;
|
|
525
|
+
if (i.length > 0 && !o) {
|
|
333
526
|
let n = [];
|
|
334
|
-
for (let e of
|
|
527
|
+
for (let e of i) {
|
|
335
528
|
let r = e.getAsFile();
|
|
336
529
|
if (!r) continue;
|
|
337
|
-
let
|
|
338
|
-
id:
|
|
530
|
+
let i = new File([r], "Screenshot.png", { type: r.type }), o = {
|
|
531
|
+
id: Oe(),
|
|
339
532
|
name: "Screenshot.png",
|
|
340
533
|
contentType: r.type,
|
|
341
|
-
file:
|
|
534
|
+
file: i,
|
|
342
535
|
type: t.Image,
|
|
343
|
-
status:
|
|
344
|
-
previewUrl: URL.createObjectURL(
|
|
536
|
+
status: a.Idle,
|
|
537
|
+
previewUrl: URL.createObjectURL(i)
|
|
345
538
|
};
|
|
346
539
|
n.push(o);
|
|
347
540
|
}
|
|
@@ -350,35 +543,35 @@ var q = /* @__PURE__ */ function(e) {
|
|
|
350
543
|
}
|
|
351
544
|
let s = r.clipboardData.getData("text/plain");
|
|
352
545
|
if (s.length > n) {
|
|
353
|
-
let n = s.trim(),
|
|
354
|
-
id:
|
|
355
|
-
name:
|
|
546
|
+
let n = s.trim(), i = (n.length > 80 ? `${n.slice(0, 80).trimEnd()}…` : n) || "Pasted text", o = new File([s], i, { type: "text/plain" }), c = {
|
|
547
|
+
id: Oe(),
|
|
548
|
+
name: i,
|
|
356
549
|
contentType: "text/plain",
|
|
357
550
|
file: o,
|
|
358
551
|
type: t.Pasted,
|
|
359
|
-
status:
|
|
552
|
+
status: a.Idle
|
|
360
553
|
};
|
|
361
554
|
r.preventDefault(), e([c]);
|
|
362
555
|
}
|
|
363
|
-
}, [e, n]) }),
|
|
556
|
+
}, [e, n]) }), Ae = {
|
|
364
557
|
image: "Image files",
|
|
365
558
|
audio: "Audio files",
|
|
366
559
|
video: "Video files",
|
|
367
560
|
text: "Text files"
|
|
368
|
-
},
|
|
561
|
+
}, je = (e) => e.map((e) => {
|
|
369
562
|
if (e.endsWith("/*")) {
|
|
370
563
|
let t = e.slice(0, -2);
|
|
371
|
-
return
|
|
564
|
+
return Ae[t] ?? `${t} files`;
|
|
372
565
|
}
|
|
373
566
|
let t = e.split("/")[1];
|
|
374
567
|
return t == null ? e.toUpperCase() : t.toUpperCase();
|
|
375
|
-
}).join(", "),
|
|
568
|
+
}).join(", "), Me = (e, t) => t.length === 0 ? !1 : t.some((t) => {
|
|
376
569
|
if (t === "*" || t === "*/*") return !0;
|
|
377
570
|
if (t.endsWith("/*")) {
|
|
378
571
|
let n = t.slice(0, -2);
|
|
379
572
|
return e.startsWith(`${n}/`);
|
|
380
573
|
}
|
|
381
574
|
return e === t;
|
|
382
|
-
}),
|
|
575
|
+
}), Ne = 100;
|
|
383
576
|
//#endregion
|
|
384
|
-
export {
|
|
577
|
+
export { ye as ATTACHMENT_COLLAPSED_VISIBLE_COUNT, ve as ATTACHMENT_COLLAPSE_THRESHOLD, he as AttachmentCard, Se as AttachmentFileRow, Ee as AttachmentGroup, we as AttachmentMoreTile, _e as AttachmentTilesLayout, ge as AttachmentTray, De as FileDndOverlay, Y as LazyImageLoadStatus, Ne as MAX_UPLOADS_PER_MINUTE, Oe as generateAttachmentId, pe as getAttachmentCardState, Z as getAttachmentIcon, be as getAttachmentTilesPlan, de as getExtFromContentType, me as getNameWithoutExtension, Me as isMimeTypeAllowed, je as mimeTypesToExtensionLabels, ke as useClipboardPaste, le as useLazyImageLoad };
|
|
@@ -49,6 +49,12 @@ export interface AttachmentCardProps {
|
|
|
49
49
|
typography?: AttachmentCardTypography;
|
|
50
50
|
/** Tailwind border-radius utility class applied to the card and its inner layers (e.g. `'rounded'`, `'rounded-lg'`). */
|
|
51
51
|
roundedClassName?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Shows a small decorative download-icon overlay on hover/focus, on top of
|
|
54
|
+
* the existing whole-card click-to-download interaction. Opt-in so the
|
|
55
|
+
* composer (which uses remove/retry actions, not download) is unaffected.
|
|
56
|
+
*/
|
|
57
|
+
showHoverDownloadIcon?: boolean;
|
|
52
58
|
/** Extra class name(s) merged onto the root element. */
|
|
53
59
|
className?: string;
|
|
54
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttachmentCard.d.ts","sourceRoot":"","sources":["../../src/models/AttachmentCard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,wEAAwE;AACxE,MAAM,WAAW,oBAAoB;IACnC,8CAA8C;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4BAA4B;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,+DAA+D;AAC/D,MAAM,WAAW,wBAAwB;IACvC,mFAAmF;IACnF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2GAA2G;IAC3G,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sHAAsH;IACtH,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC;AAED,wDAAwD;AACxD,MAAM,WAAW,mBAAmB;IAClC,sCAAsC;IACtC,UAAU,EAAE,iBAAiB,CAAC;IAC9B,iFAAiF;IACjF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,0EAA0E;IAC1E,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,6GAA6G;IAC7G,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,8EAA8E;IAC9E,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kFAAkF;IAClF,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,8CAA8C;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gGAAgG;IAChG,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,uHAAuH;IACvH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,8DAA8D;IAC9D,UAAU,CAAC,EAAE,wBAAwB,CAAC;IACtC,wHAAwH;IACxH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
1
|
+
{"version":3,"file":"AttachmentCard.d.ts","sourceRoot":"","sources":["../../src/models/AttachmentCard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,wEAAwE;AACxE,MAAM,WAAW,oBAAoB;IACnC,8CAA8C;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4BAA4B;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,+DAA+D;AAC/D,MAAM,WAAW,wBAAwB;IACvC,mFAAmF;IACnF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2GAA2G;IAC3G,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sHAAsH;IACtH,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC;AAED,wDAAwD;AACxD,MAAM,WAAW,mBAAmB;IAClC,sCAAsC;IACtC,UAAU,EAAE,iBAAiB,CAAC;IAC9B,iFAAiF;IACjF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,0EAA0E;IAC1E,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,6GAA6G;IAC7G,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,8EAA8E;IAC9E,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kFAAkF;IAClF,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,8CAA8C;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gGAAgG;IAChG,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,uHAAuH;IACvH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,8DAA8D;IAC9D,UAAU,CAAC,EAAE,wBAAwB,CAAC;IACtC,wHAAwH;IACxH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CodeBlockTheme, DisplayAttachment } from '@epam/ai-dial-chat-shared';
|
|
2
|
+
/** Props accepted by the `AttachmentFileRow` component. */
|
|
3
|
+
export interface AttachmentFileRowProps {
|
|
4
|
+
/** The non-previewable attachment this row represents. */
|
|
5
|
+
attachment: DisplayAttachment;
|
|
6
|
+
/** Byte size, when derivable; omitted from the meta line if absent. */
|
|
7
|
+
sizeLabel?: string;
|
|
8
|
+
/** Called when the user clicks the row or its download button. */
|
|
9
|
+
onClick?: (attachment: DisplayAttachment) => void;
|
|
10
|
+
/** Called when the user retries a failed upload. */
|
|
11
|
+
onRetry?: (id: string) => void;
|
|
12
|
+
/** Accessible label for the download action. Defaults to `'Download attachment'`. */
|
|
13
|
+
clickLabel?: string;
|
|
14
|
+
/** Accessible label for the retry action. Defaults to `'Retry upload'`. */
|
|
15
|
+
retryLabel?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Tile surface color theme, matching the markdown code block's own
|
|
18
|
+
* light/dark surface (never plain white). Defaults to `'dark'`.
|
|
19
|
+
*/
|
|
20
|
+
theme?: CodeBlockTheme;
|
|
21
|
+
/** Extra class name(s) merged onto the root element. */
|
|
22
|
+
className?: string;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=AttachmentFileRow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttachmentFileRow.d.ts","sourceRoot":"","sources":["../../src/models/AttachmentFileRow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AAEnC,2DAA2D;AAC3D,MAAM,WAAW,sBAAsB;IACrC,0DAA0D;IAC1D,UAAU,EAAE,iBAAiB,CAAC;IAC9B,uEAAuE;IACvE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kEAAkE;IAClE,OAAO,CAAC,EAAE,CAAC,UAAU,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAClD,oDAAoD;IACpD,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,qFAAqF;IACrF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2EAA2E;IAC3E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { CodeBlockTheme, DisplayAttachment } from '@epam/ai-dial-chat-shared';
|
|
2
|
+
/** Props accepted by the `AttachmentGroup` component. */
|
|
3
|
+
export interface AttachmentGroupProps {
|
|
4
|
+
/** The message's full attachment list (images and files together). */
|
|
5
|
+
attachments: DisplayAttachment[];
|
|
6
|
+
/** Called when the user clicks/activates a previewable image tile or a file row (downloads it). */
|
|
7
|
+
onAttachmentClick?: (attachment: DisplayAttachment) => void;
|
|
8
|
+
/** Called when the user retries a failed upload. */
|
|
9
|
+
onRetry?: (id: string) => void;
|
|
10
|
+
/** Resolves the human-readable size label for an attachment, when derivable. Omitted from display when absent. */
|
|
11
|
+
getSizeLabel?: (attachment: DisplayAttachment) => string | undefined;
|
|
12
|
+
/** Accessible label for the group region. */
|
|
13
|
+
ariaLabel?: string;
|
|
14
|
+
/** Accessible label for each tile/row's click action. Defaults to `'Download attachment'`. */
|
|
15
|
+
clickLabel?: string;
|
|
16
|
+
/** Accessible label for each row's retry action. Defaults to `'Retry upload'`. */
|
|
17
|
+
retryLabel?: string;
|
|
18
|
+
/** Label for the "show less" header action, shown once the group has been expanded via the "+N" tile. Defaults to `'Show less'`. */
|
|
19
|
+
showLessLabel?: string;
|
|
20
|
+
/** Label for the "download all" header action, shown whenever the group has 2+ attachments. Defaults to `'Download all'`. */
|
|
21
|
+
downloadAllLabel?: string;
|
|
22
|
+
/**
|
|
23
|
+
* File tile surface color theme, matching the markdown code block's own
|
|
24
|
+
* light/dark surface (never plain white). Forwarded to each
|
|
25
|
+
* non-previewable file tile. Defaults to `'dark'`.
|
|
26
|
+
*/
|
|
27
|
+
theme?: CodeBlockTheme;
|
|
28
|
+
/** Extra class name(s) merged onto the root element. */
|
|
29
|
+
className?: string;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=AttachmentGroup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttachmentGroup.d.ts","sourceRoot":"","sources":["../../src/models/AttachmentGroup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AAEnC,yDAAyD;AACzD,MAAM,WAAW,oBAAoB;IACnC,sEAAsE;IACtE,WAAW,EAAE,iBAAiB,EAAE,CAAC;IACjC,mGAAmG;IACnG,iBAAiB,CAAC,EAAE,CAAC,UAAU,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC5D,oDAAoD;IACpD,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,kHAAkH;IAClH,YAAY,CAAC,EAAE,CAAC,UAAU,EAAE,iBAAiB,KAAK,MAAM,GAAG,SAAS,CAAC;IACrE,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8FAA8F;IAC9F,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kFAAkF;IAClF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oIAAoI;IACpI,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,6HAA6H;IAC7H,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/** Props accepted by the `AttachmentMoreTile` component. */
|
|
3
|
+
export interface AttachmentMoreTileProps {
|
|
4
|
+
/** Number of additional, not-yet-visible attachments. Only used for the default `"+N"` content/label. */
|
|
5
|
+
count: number;
|
|
6
|
+
/** Called when the tile is activated (expands or collapses the group). */
|
|
7
|
+
onClick: () => void;
|
|
8
|
+
/**
|
|
9
|
+
* Accessible label. Defaults to `'Show {count} more attachments'`; pass an
|
|
10
|
+
* explicit label (e.g. `'Show less'`) when overriding `children`.
|
|
11
|
+
*/
|
|
12
|
+
ariaLabel?: string;
|
|
13
|
+
/** Overrides the default `"+N"` content, e.g. a collapse icon for the "show less" placeholder tile. */
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
/** Extra class name(s) merged onto the root element. */
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=AttachmentMoreTile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttachmentMoreTile.d.ts","sourceRoot":"","sources":["../../src/models/AttachmentMoreTile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,4DAA4D;AAC5D,MAAM,WAAW,uBAAuB;IACtC,yGAAyG;IACzG,KAAK,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uGAAuG;IACvG,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
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.0.0-dev.
|
|
4
|
+
"version": "1.0.0-dev.464",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"@epam/ai-dial-chat-shared": "1.0.0-dev.
|
|
20
|
+
"@epam/ai-dial-chat-shared": "1.0.0-dev.464",
|
|
21
21
|
"@epam/ai-dial-ui-kit": "0.12.0-dev.25",
|
|
22
22
|
"@tabler/icons-react": "^3.44.0",
|
|
23
23
|
"react": "^19.0.0"
|
|
@@ -11,5 +11,7 @@ export interface AttachmentCardState {
|
|
|
11
11
|
cardColorClass: string;
|
|
12
12
|
removeBtnClass: string;
|
|
13
13
|
}
|
|
14
|
+
/** Derives a bare file extension (no leading dot) from a MIME type, e.g. `'application/pdf'` -> `'pdf'`. */
|
|
15
|
+
export declare const getExtFromContentType: (contentType: string) => string | undefined;
|
|
14
16
|
export declare const getAttachmentCardState: (attachment: DisplayAttachment, isSelected: boolean, shouldAlwaysShowActions: boolean) => AttachmentCardState;
|
|
15
17
|
//# sourceMappingURL=getAttachmentCardState.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAttachmentCardState.d.ts","sourceRoot":"","sources":["../../src/utils/getAttachmentCardState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAOnE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAKhD,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,UAAU,EAAE,IAAI,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;CACxB;
|
|
1
|
+
{"version":3,"file":"getAttachmentCardState.d.ts","sourceRoot":"","sources":["../../src/utils/getAttachmentCardState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAOnE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAKhD,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,UAAU,EAAE,IAAI,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;CACxB;AAUD,4GAA4G;AAC5G,eAAO,MAAM,qBAAqB,GAChC,aAAa,MAAM,KAClB,MAAM,GAAG,SAUX,CAAC;AAuBF,eAAO,MAAM,sBAAsB,GACjC,YAAY,iBAAiB,EAC7B,YAAY,OAAO,EACnB,yBAAyB,OAAO,KAC/B,mBAkCF,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** How the unified attachment tile grid should render for a given total attachment count. */
|
|
2
|
+
export declare enum AttachmentTilesLayout {
|
|
3
|
+
/** No attachments. */
|
|
4
|
+
None = "none",
|
|
5
|
+
/** Below the collapse threshold, or expanded: every tile shown. */
|
|
6
|
+
AllVisible = "all-visible",
|
|
7
|
+
/** At/above the collapse threshold, not yet expanded: a few tiles + a "+N" tile. */
|
|
8
|
+
Collapsed = "collapsed"
|
|
9
|
+
}
|
|
10
|
+
export interface AttachmentTilesPlan {
|
|
11
|
+
layout: AttachmentTilesLayout;
|
|
12
|
+
/** Number of tiles to actually render. */
|
|
13
|
+
visibleCount: number;
|
|
14
|
+
/** Number of attachments hidden behind the "+N" tile (0 unless `layout` is `Collapsed`). */
|
|
15
|
+
hiddenCount: number;
|
|
16
|
+
}
|
|
17
|
+
/** Total attachment count at/above which the grid collapses behind a "+N" tile by default. */
|
|
18
|
+
export declare const ATTACHMENT_COLLAPSE_THRESHOLD = 5;
|
|
19
|
+
/** Number of tiles shown before the "+N" tile while collapsed. */
|
|
20
|
+
export declare const ATTACHMENT_COLLAPSED_VISIBLE_COUNT = 4;
|
|
21
|
+
/** Decides how the unified tile grid should render for `totalCount` attachments, given whether the group is expanded. */
|
|
22
|
+
export declare const getAttachmentTilesPlan: (totalCount: number, isExpanded: boolean) => AttachmentTilesPlan;
|
|
23
|
+
//# sourceMappingURL=getAttachmentGroupLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getAttachmentGroupLayout.d.ts","sourceRoot":"","sources":["../../src/utils/getAttachmentGroupLayout.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,oBAAY,qBAAqB;IAC/B,sBAAsB;IACtB,IAAI,SAAS;IACb,mEAAmE;IACnE,UAAU,gBAAgB;IAC1B,oFAAoF;IACpF,SAAS,cAAc;CACxB;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,qBAAqB,CAAC;IAC9B,0CAA0C;IAC1C,YAAY,EAAE,MAAM,CAAC;IACrB,4FAA4F;IAC5F,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,8FAA8F;AAC9F,eAAO,MAAM,6BAA6B,IAAI,CAAC;AAC/C,kEAAkE;AAClE,eAAO,MAAM,kCAAkC,IAAI,CAAC;AAEpD,yHAAyH;AACzH,eAAO,MAAM,sBAAsB,GACjC,YAAY,MAAM,EAClB,YAAY,OAAO,KAClB,mBAoBF,CAAC"}
|