@aleph-alpha/chat-kit 1.9.1 → 1.11.0
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/dist/{CkInput.vue_vue_type_script_setup_true_lang-CHPs-R5p.js → CkInput.vue_vue_type_script_setup_true_lang-C1Jnn1fK.js} +251 -56
- package/dist/components/base/CkFileItemsList/CkFileItemRow.vue.d.ts +33 -0
- package/dist/components/base/CkFileItemsList/CkFileItemRow.vue.d.ts.map +1 -0
- package/dist/components/base/CkFileItemsList/CkFileItemsList.stories.d.ts +42 -0
- package/dist/components/base/CkFileItemsList/CkFileItemsList.stories.d.ts.map +1 -0
- package/dist/components/base/CkFileItemsList/CkFileItemsList.vue.d.ts +38 -0
- package/dist/components/base/CkFileItemsList/CkFileItemsList.vue.d.ts.map +1 -0
- package/dist/components/base/CkFileItemsList/index.d.ts +3 -0
- package/dist/components/base/CkFileItemsList/index.d.ts.map +1 -0
- package/dist/components/base/CkFileItemsList/types.d.ts +59 -0
- package/dist/components/base/CkFileItemsList/types.d.ts.map +1 -0
- package/dist/components/base/index.d.ts +2 -0
- package/dist/components/base/index.d.ts.map +1 -1
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +15 -14
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -14
- package/package.json +3 -3
- package/src/components/base/CkFileItemsList/CkFileItemRow.vue +61 -0
- package/src/components/base/CkFileItemsList/CkFileItemsList.spec.ts +96 -0
- package/src/components/base/CkFileItemsList/CkFileItemsList.stories.ts +307 -0
- package/src/components/base/CkFileItemsList/CkFileItemsList.vue +168 -0
- package/src/components/base/CkFileItemsList/index.ts +2 -0
- package/src/components/base/CkFileItemsList/types.ts +64 -0
- package/src/components/base/index.ts +6 -0
- package/src/components/index.ts +4 -0
- package/src/index.ts +4 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { UiFileItemMediaTone, UiFileItemSize } from '@aleph-alpha/ui-library';
|
|
2
|
+
export interface CkFileEntry {
|
|
3
|
+
/** Stable id used as the `:key` and emitted with `remove`. */
|
|
4
|
+
id: string | number;
|
|
5
|
+
/** Full file name. */
|
|
6
|
+
filename: string;
|
|
7
|
+
/** Short type label, e.g. `PDF`. */
|
|
8
|
+
typeLabel?: string;
|
|
9
|
+
/** Size label, e.g. `1.2 MB`. */
|
|
10
|
+
sizeLabel?: string;
|
|
11
|
+
/** Upload progress 0–100; `< 100` shows a progress bar. */
|
|
12
|
+
progress?: number | null;
|
|
13
|
+
/** Error message; non-empty enters the error state. */
|
|
14
|
+
error?: string | null;
|
|
15
|
+
/** Lucide icon override for the media badge. */
|
|
16
|
+
mediaIcon?: string;
|
|
17
|
+
/** Media badge tone override. */
|
|
18
|
+
mediaTone?: UiFileItemMediaTone;
|
|
19
|
+
/** Per-row disable. */
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Horizontal list of file attachments; collapses to a popover once the
|
|
24
|
+
* count exceeds `maxInline`.
|
|
25
|
+
*
|
|
26
|
+
* @category Inputs
|
|
27
|
+
* @useCases user message attachments, prompt input previews, chat file row
|
|
28
|
+
* @keywords files, attachments, file list, popover, chat
|
|
29
|
+
* @related UiFileItem, UiPopover
|
|
30
|
+
*/
|
|
31
|
+
export interface CkFileItemsListProps {
|
|
32
|
+
/** Files to render. Order is preserved. */
|
|
33
|
+
files: CkFileEntry[];
|
|
34
|
+
/** @default 3 */
|
|
35
|
+
maxInline?: number;
|
|
36
|
+
/** @default 'small' */
|
|
37
|
+
size?: UiFileItemSize;
|
|
38
|
+
/** Show a remove control on every row. @default false */
|
|
39
|
+
isRemovable?: boolean;
|
|
40
|
+
/** Remove control label, forwarded to `UiFileItem`. */
|
|
41
|
+
removeLabel?: string;
|
|
42
|
+
/** Disable every row + the collapsed trigger. @default false */
|
|
43
|
+
disabled?: boolean;
|
|
44
|
+
/** Visible label on the collapsed trigger. Defaults to `"{n} files"`. */
|
|
45
|
+
triggerLabel?: string;
|
|
46
|
+
/** A11y label for the trigger. Falls back to `triggerLabel`, then count. */
|
|
47
|
+
triggerAriaLabel?: string;
|
|
48
|
+
/** `aria-label` for the `<ul>` (e.g. `"Attached files"`). */
|
|
49
|
+
listLabel?: string;
|
|
50
|
+
/** Extra classes for the popover content (override the default `w-64`). */
|
|
51
|
+
popoverClass?: string;
|
|
52
|
+
}
|
|
53
|
+
export interface CkFileItemsListEmits {
|
|
54
|
+
/** Remove control activated. Suppressed for disabled rows. */
|
|
55
|
+
(event: 'remove', id: CkFileEntry['id']): void;
|
|
56
|
+
/** Row clicked outside any interactive child. Suppressed for disabled rows. */
|
|
57
|
+
(event: 'item-click', file: CkFileEntry, originalEvent: MouseEvent): void;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkFileItemsList/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACf,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,WAAW;IAC1B,8DAA8D;IAC9D,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,sBAAsB;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,oCAAoC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iCAAiC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,uDAAuD;IACvD,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iCAAiC;IACjC,SAAS,CAAC,EAAE,mBAAmB,CAAC;IAChC,uBAAuB;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,oBAAoB;IACnC,2CAA2C;IAC3C,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,iBAAiB;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uBAAuB;IACvB,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,yDAAyD;IACzD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yEAAyE;IACzE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4EAA4E;IAC5E,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2EAA2E;IAC3E,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,oBAAoB;IACnC,8DAA8D;IAC9D,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,WAAW,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC/C,+EAA+E;IAC/E,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,GAAG,IAAI,CAAC;CAC3E"}
|
|
@@ -5,6 +5,8 @@ export type { CkConversationLayoutProps } from './CkConversationLayout';
|
|
|
5
5
|
export { CkCopyMessageActionButton } from './CkCopyMessageActionButton';
|
|
6
6
|
export { CkFeedbackButton } from './CkFeedbackButton';
|
|
7
7
|
export type { CkFeedbackButtonProps, CkFeedbackValue, } from './CkFeedbackButton';
|
|
8
|
+
export { CkFileItemsList } from './CkFileItemsList';
|
|
9
|
+
export type { CkFileEntry, CkFileItemsListProps, CkFileItemsListEmits, } from './CkFileItemsList';
|
|
8
10
|
export { CkHistoryItem } from './CkHistoryItem';
|
|
9
11
|
export type { CkHistoryItemProps, CkHistoryItemEmits } from './CkHistoryItem';
|
|
10
12
|
export { CkHistoryWrapper } from './CkHistoryWrapper';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/base/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,YAAY,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EACV,qBAAqB,EACrB,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EACV,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY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MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { CkAgentMessage, CkConversationLayout, CkCopyMessageActionButton, CkFeedbackButton, CkHistoryItem, CkHistoryWrapper, CkMarkdownRenderer, CkMessageActionButton, CkPromptActionButton, CkPromptStopButton, CkPromptInput, CkPromptInputDisclaimer, CkSendIcon, CkStopIcon, CkUserMessage, } from './base';
|
|
2
|
-
export type { CkConversationLayoutProps, CkFeedbackButtonProps, CkFeedbackValue, CkHistoryItemEmits, CkHistoryItemProps, CkHistoryWrapperProps, CkMarkdownElementClasses, CkMarkdownRendererProps, CkUserMessageProps, } from './base';
|
|
1
|
+
export { CkAgentMessage, CkConversationLayout, CkCopyMessageActionButton, CkFeedbackButton, CkFileItemsList, CkHistoryItem, CkHistoryWrapper, CkMarkdownRenderer, CkMessageActionButton, CkPromptActionButton, CkPromptStopButton, CkPromptInput, CkPromptInputDisclaimer, CkSendIcon, CkStopIcon, CkUserMessage, } from './base';
|
|
2
|
+
export type { CkConversationLayoutProps, CkFeedbackButtonProps, CkFeedbackValue, CkFileEntry, CkFileItemsListEmits, CkFileItemsListProps, CkHistoryItemEmits, CkHistoryItemProps, CkHistoryWrapperProps, CkMarkdownElementClasses, CkMarkdownRendererProps, CkUserMessageProps, } from './base';
|
|
3
3
|
export { CkConversation, CkHistory, CkInput } from './composed';
|
|
4
4
|
export type { CkConversationProps, CkHistoryEmits, CkHistoryProps, } from './composed';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,yBAAyB,EACzB,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACb,uBAAuB,EACvB,UAAU,EACV,UAAU,EACV,aAAa,GACd,MAAM,QAAQ,CAAC;AAChB,YAAY,EACV,yBAAyB,EACzB,qBAAqB,EACrB,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,QAAQ,CAAC;AAGhB,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAChE,YAAY,EACV,mBAAmB,EACnB,cAAc,EACd,cAAc,GACf,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,yBAAyB,EACzB,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACb,uBAAuB,EACvB,UAAU,EACV,UAAU,EACV,aAAa,GACd,MAAM,QAAQ,CAAC;AAChB,YAAY,EACV,yBAAyB,EACzB,qBAAqB,EACrB,eAAe,EACf,WAAW,EACX,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,QAAQ,CAAC;AAGhB,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAChE,YAAY,EACV,mBAAmB,EACnB,cAAc,EACd,cAAc,GACf,MAAM,YAAY,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { _, a, b, C, c, d, e, f, g, h, i, j, k, l, m, n, o, p } from "../CkInput.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
import { _, a, b, C, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q } from "../CkInput.vue_vue_type_script_setup_true_lang-C1Jnn1fK.js";
|
|
2
2
|
export {
|
|
3
3
|
_ as CkAgentMessage,
|
|
4
4
|
a as CkConversation,
|
|
5
5
|
b as CkConversationLayout,
|
|
6
6
|
C as CkCopyMessageActionButton,
|
|
7
7
|
c as CkFeedbackButton,
|
|
8
|
-
d as
|
|
9
|
-
e as
|
|
10
|
-
f as
|
|
11
|
-
g as
|
|
12
|
-
h as
|
|
13
|
-
i as
|
|
14
|
-
j as
|
|
15
|
-
k as
|
|
16
|
-
l as
|
|
17
|
-
m as
|
|
18
|
-
n as
|
|
19
|
-
o as
|
|
20
|
-
p as
|
|
8
|
+
d as CkFileItemsList,
|
|
9
|
+
e as CkHistory,
|
|
10
|
+
f as CkHistoryItem,
|
|
11
|
+
g as CkHistoryWrapper,
|
|
12
|
+
h as CkInput,
|
|
13
|
+
i as CkMarkdownRenderer,
|
|
14
|
+
j as CkMessageActionButton,
|
|
15
|
+
k as CkPromptActionButton,
|
|
16
|
+
l as CkPromptInput,
|
|
17
|
+
m as CkPromptInputDisclaimer,
|
|
18
|
+
n as CkPromptStopButton,
|
|
19
|
+
o as CkSendIcon,
|
|
20
|
+
p as CkStopIcon,
|
|
21
|
+
q as CkUserMessage
|
|
21
22
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { useChat, useConversationSessions, useConversations, } from './composabl
|
|
|
5
5
|
export type { ChatActions, ChatState, ConversationSession, CreateConversationInput, MessageHandler, MutationOptions, UseChatReturn, UseConversationSessionsReturn, UseConversationsOptions, UseConversationsReturn, } from './composables';
|
|
6
6
|
export { SdkError, createDocumentUploadProvider, defaultDocumentUploadConfig, defaultEndpoints, useDocumentUploadWithDefaultConfig, } from './composables/fileUpload';
|
|
7
7
|
export type { DocumentUploadConfig, DocumentUploadProvider, FileEntry, FileStatus, } from './composables/fileUpload';
|
|
8
|
-
export { CkAgentMessage, CkConversation, CkConversationLayout, CkCopyMessageActionButton, CkFeedbackButton, CkHistory, CkHistoryItem, CkHistoryWrapper, CkInput, CkMarkdownRenderer, CkMessageActionButton, CkPromptActionButton, CkPromptStopButton, CkPromptInput, CkPromptInputDisclaimer, CkSendIcon, CkStopIcon, CkUserMessage, } from './components';
|
|
9
|
-
export type { CkConversationLayoutProps, CkConversationProps, CkFeedbackButtonProps, CkFeedbackValue, CkHistoryEmits, CkHistoryItemEmits, CkHistoryItemProps, CkHistoryProps, CkHistoryWrapperProps, CkMarkdownElementClasses, CkMarkdownRendererProps, CkUserMessageProps, } from './components';
|
|
8
|
+
export { CkAgentMessage, CkConversation, CkConversationLayout, CkCopyMessageActionButton, CkFeedbackButton, CkFileItemsList, CkHistory, CkHistoryItem, CkHistoryWrapper, CkInput, CkMarkdownRenderer, CkMessageActionButton, CkPromptActionButton, CkPromptStopButton, CkPromptInput, CkPromptInputDisclaimer, CkSendIcon, CkStopIcon, CkUserMessage, } from './components';
|
|
9
|
+
export type { CkConversationLayoutProps, CkConversationProps, CkFeedbackButtonProps, CkFeedbackValue, CkFileEntry, CkFileItemsListEmits, CkFileItemsListProps, CkHistoryEmits, CkHistoryItemEmits, CkHistoryItemProps, CkHistoryProps, CkHistoryWrapperProps, CkMarkdownElementClasses, CkMarkdownRendererProps, CkUserMessageProps, } from './components';
|
|
10
10
|
export type { BaseMessage, Conversation, ConversationTree, MessageContent, MessageContentStatus, MessageReasoningContent, MessageRole, MessageStatus, MessageTextContent, MessageToolContent, TreeMessage, } from './types';
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK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uBAAuB,EACvB,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,GACZ,MAAM,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,WAAW,GACjB,MAAM,YAAY,CAAC;AASpB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,GAChB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD,OAAO,EACL,OAAO,EACP,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,WAAW,EACX,SAAS,EACT,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,EACd,eAAe,EACf,aAAa,EACb,6BAA6B,EAC7B,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,QAAQ,EACR,4BAA4B,EAC5B,2BAA2B,EAC3B,gBAAgB,EAChB,kCAAkC,GACnC,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACV,oBAAoB,EACpB,sBAAsB,EACtB,SAAS,EACT,UAAU,GACX,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,yBAAyB,EACzB,gBAAgB,EAChB,eAAe,EACf,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,OAAO,EACP,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACb,uBAAuB,EACvB,UAAU,EACV,UAAU,EACV,aAAa,GACd,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,yBAAyB,EACzB,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,EACf,WAAW,EACX,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AAGtB,YAAY,EACV,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,uBAAuB,EACvB,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,GACZ,MAAM,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { u } from "./useMessageHandler-ZRC-gIOJ.js";
|
|
2
2
|
import { C, d, p, u as u2, a } from "./useChatKitLabels-ftC52m7f.js";
|
|
3
3
|
import { S, c, d as d2, a as a2, u as u3, b, e, f } from "./index-BLq6_Lt2.js";
|
|
4
|
-
import { _, a as a3, b as b2, C as C2, c as c2, d as d3, e as e2, f as f2, g, h, i, j, k, l, m, n, o, p as p2 } from "./CkInput.vue_vue_type_script_setup_true_lang-
|
|
4
|
+
import { _, a as a3, b as b2, C as C2, c as c2, d as d3, e as e2, f as f2, g, h, i, j, k, l, m, n, o, p as p2, q } from "./CkInput.vue_vue_type_script_setup_true_lang-C1Jnn1fK.js";
|
|
5
5
|
export {
|
|
6
6
|
C as CHAT_KIT_LABELS,
|
|
7
7
|
_ as CkAgentMessage,
|
|
@@ -9,19 +9,20 @@ export {
|
|
|
9
9
|
b2 as CkConversationLayout,
|
|
10
10
|
C2 as CkCopyMessageActionButton,
|
|
11
11
|
c2 as CkFeedbackButton,
|
|
12
|
-
d3 as
|
|
13
|
-
e2 as
|
|
14
|
-
f2 as
|
|
15
|
-
g as
|
|
16
|
-
h as
|
|
17
|
-
i as
|
|
18
|
-
j as
|
|
19
|
-
k as
|
|
20
|
-
l as
|
|
21
|
-
m as
|
|
22
|
-
n as
|
|
23
|
-
o as
|
|
24
|
-
p2 as
|
|
12
|
+
d3 as CkFileItemsList,
|
|
13
|
+
e2 as CkHistory,
|
|
14
|
+
f2 as CkHistoryItem,
|
|
15
|
+
g as CkHistoryWrapper,
|
|
16
|
+
h as CkInput,
|
|
17
|
+
i as CkMarkdownRenderer,
|
|
18
|
+
j as CkMessageActionButton,
|
|
19
|
+
k as CkPromptActionButton,
|
|
20
|
+
l as CkPromptInput,
|
|
21
|
+
m as CkPromptInputDisclaimer,
|
|
22
|
+
n as CkPromptStopButton,
|
|
23
|
+
o as CkSendIcon,
|
|
24
|
+
p2 as CkStopIcon,
|
|
25
|
+
q as CkUserMessage,
|
|
25
26
|
S as SdkError,
|
|
26
27
|
c as createDocumentUploadProvider,
|
|
27
28
|
d as defaultChatKitLabels,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aleph-alpha/chat-kit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"description": "Chat kit package for building chat interfaces with Vue",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"remark-parse": "^11.0.0",
|
|
72
72
|
"remark-rehype": "^11.1.2",
|
|
73
73
|
"unified": "^11.0.5",
|
|
74
|
-
"@aleph-alpha/ui-library": "2.
|
|
74
|
+
"@aleph-alpha/ui-library": "2.6.1"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@storybook/addon-a11y": "10.2.17",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"vitest": "4.0.15",
|
|
98
98
|
"vue": "^3.5.27",
|
|
99
99
|
"vue-tsc": "^3.2.4",
|
|
100
|
-
"@aleph-alpha/config-css": "1.
|
|
100
|
+
"@aleph-alpha/config-css": "1.2.0"
|
|
101
101
|
},
|
|
102
102
|
"scripts": {
|
|
103
103
|
"build": "vite build && vue-tsc --project tsconfig.build.json --declaration --emitDeclarationOnly --outDir dist",
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { UiFileItem, type UiFileItemSize } from '@aleph-alpha/ui-library';
|
|
3
|
+
import type { CkFileEntry } from './types';
|
|
4
|
+
|
|
5
|
+
// Private row used by `CkFileItemsList` to share the slot fallback between
|
|
6
|
+
// the inline row and the popover list. Not exported from the package.
|
|
7
|
+
defineOptions({
|
|
8
|
+
name: 'CkFileItemRow',
|
|
9
|
+
inheritAttrs: false,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
defineProps<{
|
|
13
|
+
file: CkFileEntry;
|
|
14
|
+
size: UiFileItemSize;
|
|
15
|
+
isRemovable: boolean;
|
|
16
|
+
removeLabel: string;
|
|
17
|
+
disabled: boolean;
|
|
18
|
+
}>();
|
|
19
|
+
|
|
20
|
+
const emit = defineEmits<{
|
|
21
|
+
remove: [];
|
|
22
|
+
}>();
|
|
23
|
+
|
|
24
|
+
// Mirrors the public `item` slot scope on `CkFileItemsList`.
|
|
25
|
+
defineSlots<{
|
|
26
|
+
default?: (props: {
|
|
27
|
+
file: CkFileEntry;
|
|
28
|
+
remove: () => void;
|
|
29
|
+
size: UiFileItemSize;
|
|
30
|
+
isRemovable: boolean;
|
|
31
|
+
removeLabel: string;
|
|
32
|
+
disabled: boolean;
|
|
33
|
+
}) => unknown;
|
|
34
|
+
}>();
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<template>
|
|
38
|
+
<slot
|
|
39
|
+
:file="file"
|
|
40
|
+
:remove="() => emit('remove')"
|
|
41
|
+
:size="size"
|
|
42
|
+
:is-removable="isRemovable"
|
|
43
|
+
:remove-label="removeLabel"
|
|
44
|
+
:disabled="disabled"
|
|
45
|
+
>
|
|
46
|
+
<UiFileItem
|
|
47
|
+
:filename="file.filename"
|
|
48
|
+
:type-label="file.typeLabel"
|
|
49
|
+
:size-label="file.sizeLabel"
|
|
50
|
+
:progress="file.progress ?? null"
|
|
51
|
+
:error="file.error ?? null"
|
|
52
|
+
:media-icon="file.mediaIcon"
|
|
53
|
+
:media-tone="file.mediaTone"
|
|
54
|
+
:size="size"
|
|
55
|
+
:removable="isRemovable && !disabled"
|
|
56
|
+
:remove-label="removeLabel"
|
|
57
|
+
:disabled="disabled"
|
|
58
|
+
@remove="emit('remove')"
|
|
59
|
+
/>
|
|
60
|
+
</slot>
|
|
61
|
+
</template>
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { render, screen, within } from '@testing-library/vue';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { describe, expect, it } from 'vitest';
|
|
4
|
+
import CkFileItemsList from './CkFileItemsList.vue';
|
|
5
|
+
import type { CkFileEntry } from './types';
|
|
6
|
+
|
|
7
|
+
const files: CkFileEntry[] = [
|
|
8
|
+
{ id: 'a', filename: 'report.pdf' },
|
|
9
|
+
{ id: 'b', filename: 'notes.md' },
|
|
10
|
+
{ id: 'c', filename: 'data.csv' },
|
|
11
|
+
{ id: 'd', filename: 'archive.zip' },
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
describe('CkFileItemsList', () => {
|
|
15
|
+
it('renders all files inline when count <= maxInline', () => {
|
|
16
|
+
const { container } = render(CkFileItemsList, {
|
|
17
|
+
props: { files: files.slice(0, 3) },
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const list = container.querySelector('[data-slot="file-items-list"]');
|
|
21
|
+
expect(list).toBeTruthy();
|
|
22
|
+
expect(list?.querySelectorAll('li')).toHaveLength(3);
|
|
23
|
+
expect(
|
|
24
|
+
container.querySelector('[data-slot="file-items-list-trigger"]'),
|
|
25
|
+
).toBeNull();
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('collapses into a popover trigger when count exceeds maxInline', () => {
|
|
29
|
+
render(CkFileItemsList, { props: { files } });
|
|
30
|
+
|
|
31
|
+
const trigger = screen.getByRole('button', { name: /4 files/i });
|
|
32
|
+
expect(trigger).toBeInTheDocument();
|
|
33
|
+
expect(trigger).toHaveTextContent('4 files');
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('uses an explicit triggerLabel when provided', () => {
|
|
37
|
+
render(CkFileItemsList, {
|
|
38
|
+
props: { files, triggerLabel: '+1 more attachment' },
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
expect(screen.getByRole('button')).toHaveTextContent('+1 more attachment');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('emits remove with the file id from inline items', async () => {
|
|
45
|
+
const user = userEvent.setup();
|
|
46
|
+
const { emitted } = render(CkFileItemsList, {
|
|
47
|
+
props: { files: files.slice(0, 2), isRemovable: true },
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const list = document.querySelector('[data-slot="file-items-list"]')!;
|
|
51
|
+
const removeButtons = within(list as HTMLElement).getAllByRole('button', {
|
|
52
|
+
name: /remove file/i,
|
|
53
|
+
});
|
|
54
|
+
await user.click(removeButtons[1]);
|
|
55
|
+
|
|
56
|
+
expect(emitted('remove')).toEqual([['b']]);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('hides remove controls by default', () => {
|
|
60
|
+
render(CkFileItemsList, { props: { files: files.slice(0, 2) } });
|
|
61
|
+
|
|
62
|
+
expect(screen.queryByRole('button', { name: /remove file/i })).toBeNull();
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('renders a custom row via the `item` scoped slot and forwards remove', async () => {
|
|
66
|
+
const user = userEvent.setup();
|
|
67
|
+
const { container, emitted } = render(CkFileItemsList, {
|
|
68
|
+
props: { files: files.slice(0, 2) },
|
|
69
|
+
slots: {
|
|
70
|
+
item: `
|
|
71
|
+
<template #item="{ file, remove }">
|
|
72
|
+
<button
|
|
73
|
+
type="button"
|
|
74
|
+
data-testid="custom-row"
|
|
75
|
+
:data-id="file.id"
|
|
76
|
+
@click="remove"
|
|
77
|
+
>
|
|
78
|
+
{{ file.filename }}
|
|
79
|
+
</button>
|
|
80
|
+
</template>
|
|
81
|
+
`,
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
const rows = container.querySelectorAll<HTMLElement>(
|
|
86
|
+
'[data-testid="custom-row"]',
|
|
87
|
+
);
|
|
88
|
+
expect(rows).toHaveLength(2);
|
|
89
|
+
expect(rows[0]).toHaveTextContent('report.pdf');
|
|
90
|
+
|
|
91
|
+
expect(container.querySelector('[data-slot="file-item"]')).toBeNull();
|
|
92
|
+
|
|
93
|
+
await user.click(rows[1]);
|
|
94
|
+
expect(emitted('remove')).toEqual([['b']]);
|
|
95
|
+
});
|
|
96
|
+
});
|