@aleph-alpha/chat-kit 1.7.0 → 1.10.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-C5C09u0z.js → CkInput.vue_vue_type_script_setup_true_lang-CR3lzV0q.js} +252 -57
- package/dist/adapters/responses-api.d.ts +22 -0
- package/dist/adapters/responses-api.d.ts.map +1 -1
- package/dist/adapters/responses-api.js +9 -5
- 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/CkHistoryItem/activeIndicator.d.ts +2 -12
- package/dist/components/base/CkHistoryItem/activeIndicator.d.ts.map +1 -1
- 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/dist/types.d.ts +8 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -5
- package/src/adapters/responses-api.spec.ts +51 -0
- package/src/adapters/responses-api.ts +36 -5
- 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/CkHistoryItem/activeIndicator.ts +2 -13
- package/src/components/base/index.ts +6 -0
- package/src/components/index.ts +4 -0
- package/src/index.ts +4 -0
- package/src/types.ts +8 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type UiFileItemSize } from '@aleph-alpha/ui-library';
|
|
2
|
+
import type { CkFileEntry, CkFileItemsListProps } from './types';
|
|
3
|
+
type __VLS_Slots = {
|
|
4
|
+
item: (props: {
|
|
5
|
+
file: CkFileEntry;
|
|
6
|
+
remove: () => void;
|
|
7
|
+
size: UiFileItemSize;
|
|
8
|
+
isRemovable: boolean;
|
|
9
|
+
removeLabel: string;
|
|
10
|
+
disabled: boolean;
|
|
11
|
+
}) => unknown;
|
|
12
|
+
};
|
|
13
|
+
declare const __VLS_base: import("vue").DefineComponent<CkFileItemsListProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
14
|
+
remove: (id: string | number) => any;
|
|
15
|
+
"item-click": (file: CkFileEntry, originalEvent: MouseEvent) => any;
|
|
16
|
+
}, string, import("vue").PublicProps, Readonly<CkFileItemsListProps> & Readonly<{
|
|
17
|
+
onRemove?: ((id: string | number) => any) | undefined;
|
|
18
|
+
"onItem-click"?: ((file: CkFileEntry, originalEvent: MouseEvent) => any) | undefined;
|
|
19
|
+
}>, {
|
|
20
|
+
size: UiFileItemSize;
|
|
21
|
+
disabled: boolean;
|
|
22
|
+
isRemovable: boolean;
|
|
23
|
+
removeLabel: string;
|
|
24
|
+
maxInline: number;
|
|
25
|
+
triggerLabel: string;
|
|
26
|
+
triggerAriaLabel: string;
|
|
27
|
+
listLabel: string;
|
|
28
|
+
popoverClass: string;
|
|
29
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
30
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
31
|
+
declare const _default: typeof __VLS_export;
|
|
32
|
+
export default _default;
|
|
33
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
34
|
+
new (): {
|
|
35
|
+
$slots: S;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=CkFileItemsList.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CkFileItemsList.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkFileItemsList/CkFileItemsList.vue"],"names":[],"mappings":"AA2KA,OAAO,EAML,KAAK,cAAc,EACpB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,KAAK,EACV,WAAW,EAEX,oBAAoB,EACrB,MAAM,SAAS,CAAC;AAwBjB,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,CAAC,KAAK,EAAE;QACZ,IAAI,EAAE,WAAW,CAAC;QAClB,MAAM,EAAE,MAAM,IAAI,CAAC;QACnB,IAAI,EAAE,cAAc,CAAC;QACrB,WAAW,EAAE,OAAO,CAAC;QACrB,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,EAAE,OAAO,CAAC;KACnB,KAAK,OAAO,CAAC;CACf,CAAC;AAqVF,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;;6EAId,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AAWzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkFileItemsList/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACnE,mBAAmB,SAAS,CAAC"}
|
|
@@ -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"}
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* history row.
|
|
4
|
-
*
|
|
5
|
-
* The `::before` pseudo-element is always mounted so CSS has something to
|
|
6
|
-
* transition. At rest it's painted from `scale-x-0` + `opacity-0` with its
|
|
7
|
-
* transform anchored on the left edge (`origin-left`); when the row's
|
|
8
|
-
* `data-active="true"` flips on, the bar paints in from left to right while
|
|
9
|
-
* fading in, using a 200ms linear curve.
|
|
10
|
-
*
|
|
11
|
-
* Kept as a string constant (rather than generated via `cn`) so UnoCSS's
|
|
12
|
-
* static scanner picks up every utility class for atomic CSS generation.
|
|
2
|
+
* Uses the shared UI library active indicator preflight class.
|
|
13
3
|
*/
|
|
14
|
-
export declare const CHAT_HISTORY_ACTIVE_INDICATOR_CLASS = "
|
|
4
|
+
export declare const CHAT_HISTORY_ACTIVE_INDICATOR_CLASS = "ui-active-indicator";
|
|
15
5
|
//# sourceMappingURL=activeIndicator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activeIndicator.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkHistoryItem/activeIndicator.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"activeIndicator.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkHistoryItem/activeIndicator.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,mCAAmC,wBAAwB,CAAC"}
|
|
@@ -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,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/base/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EA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|
|
|
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-CR3lzV0q.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,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,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,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"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.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,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-CR3lzV0q.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/dist/types.d.ts
CHANGED
|
@@ -24,11 +24,19 @@ export interface MessageTextContent {
|
|
|
24
24
|
* Tool invocation triggered by the assistant during its turn. Only the tool
|
|
25
25
|
* name is rendered; arguments and results are intentionally outside the
|
|
26
26
|
* UI-facing model and should be tracked by the host application.
|
|
27
|
+
*
|
|
28
|
+
* `text` and `icon` are optional server-provided display hints (sourced from
|
|
29
|
+
* a `display` block on the wire payload, e.g.
|
|
30
|
+
* `ResponseOutputTool.display`). When present, the UI is expected to render
|
|
31
|
+
* the human-readable `text` and the lucide.dev `icon` instead of falling
|
|
32
|
+
* back to the raw tool `name`.
|
|
27
33
|
*/
|
|
28
34
|
export interface MessageToolContent {
|
|
29
35
|
type: 'tool';
|
|
30
36
|
id: string;
|
|
31
37
|
name: string;
|
|
38
|
+
text?: string;
|
|
39
|
+
icon?: string;
|
|
32
40
|
}
|
|
33
41
|
/**
|
|
34
42
|
* Chain-of-thought / reasoning segment produced by the assistant. `text` is
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE1D,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,WAA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C;AAE5B,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,SAAS,EAAE,IAAI,CAAC;IAChB,MAAM,EAAE,aAAa,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,MAAM,EAAE,aAAa,CAAC;IACtB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACnC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aleph-alpha/chat-kit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "Chat kit package for building chat interfaces with Vue",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -52,8 +52,7 @@
|
|
|
52
52
|
"node": ">=20.19.0"
|
|
53
53
|
},
|
|
54
54
|
"publishConfig": {
|
|
55
|
-
"access": "public"
|
|
56
|
-
"registry": "https://npm.pkg.github.com"
|
|
55
|
+
"access": "public"
|
|
57
56
|
},
|
|
58
57
|
"repository": {
|
|
59
58
|
"type": "git",
|
|
@@ -72,7 +71,7 @@
|
|
|
72
71
|
"remark-parse": "^11.0.0",
|
|
73
72
|
"remark-rehype": "^11.1.2",
|
|
74
73
|
"unified": "^11.0.5",
|
|
75
|
-
"@aleph-alpha/ui-library": "2.
|
|
74
|
+
"@aleph-alpha/ui-library": "2.6.0"
|
|
76
75
|
},
|
|
77
76
|
"devDependencies": {
|
|
78
77
|
"@storybook/addon-a11y": "10.2.17",
|
|
@@ -98,7 +97,7 @@
|
|
|
98
97
|
"vitest": "4.0.15",
|
|
99
98
|
"vue": "^3.5.27",
|
|
100
99
|
"vue-tsc": "^3.2.4",
|
|
101
|
-
"@aleph-alpha/config-css": "1.
|
|
100
|
+
"@aleph-alpha/config-css": "1.2.0"
|
|
102
101
|
},
|
|
103
102
|
"scripts": {
|
|
104
103
|
"build": "vite build && vue-tsc --project tsconfig.build.json --declaration --emitDeclarationOnly --outDir dist",
|
|
@@ -271,6 +271,57 @@ describe('responsesToTree', () => {
|
|
|
271
271
|
expect(assistant.content[2].type).toBe('text');
|
|
272
272
|
});
|
|
273
273
|
|
|
274
|
+
it('forwards `display.text` and `display.icon` from a tool output onto the resulting tool content', () => {
|
|
275
|
+
const tree = responsesToTree([
|
|
276
|
+
makeResponse({
|
|
277
|
+
id: 'r1',
|
|
278
|
+
request_input: [userInput('Hello')],
|
|
279
|
+
output: [
|
|
280
|
+
toolOutput({
|
|
281
|
+
id: 'tool-1',
|
|
282
|
+
type: 'mcp_call',
|
|
283
|
+
name: 'firecrawl_scrape',
|
|
284
|
+
display: {
|
|
285
|
+
text: 'Searching the web',
|
|
286
|
+
icon: 'globe',
|
|
287
|
+
phase: 'done',
|
|
288
|
+
},
|
|
289
|
+
}),
|
|
290
|
+
assistantOutput('msg-a1', 'Done'),
|
|
291
|
+
],
|
|
292
|
+
}),
|
|
293
|
+
]);
|
|
294
|
+
|
|
295
|
+
const tool = tree.nodes['msg-a1']!.content[0];
|
|
296
|
+
expect(tool).toMatchObject({
|
|
297
|
+
type: 'tool',
|
|
298
|
+
id: 'tool-1',
|
|
299
|
+
name: 'firecrawl_scrape',
|
|
300
|
+
text: 'Searching the web',
|
|
301
|
+
icon: 'globe',
|
|
302
|
+
});
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
it('omits `text` / `icon` on tool content when the tool output has no `display` block', () => {
|
|
306
|
+
const tree = responsesToTree([
|
|
307
|
+
makeResponse({
|
|
308
|
+
id: 'r1',
|
|
309
|
+
request_input: [userInput('Hello')],
|
|
310
|
+
output: [
|
|
311
|
+
toolOutput({ id: 'tool-1', type: 'mcp_call', name: 'search' }),
|
|
312
|
+
assistantOutput('msg-a1', 'Done'),
|
|
313
|
+
],
|
|
314
|
+
}),
|
|
315
|
+
]);
|
|
316
|
+
|
|
317
|
+
const tool = tree.nodes['msg-a1']!.content[0];
|
|
318
|
+
expect(tool.type).toBe('tool');
|
|
319
|
+
if (tool.type === 'tool') {
|
|
320
|
+
expect(tool.text).toBeUndefined();
|
|
321
|
+
expect(tool.icon).toBeUndefined();
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
|
|
274
325
|
it('creates an assistant node from reasoning / tool outputs even when no message output is present', () => {
|
|
275
326
|
const tree = responsesToTree([
|
|
276
327
|
makeResponse({
|
|
@@ -142,6 +142,23 @@ export type ResponseOutputToolType =
|
|
|
142
142
|
| 'image_generation_call'
|
|
143
143
|
| 'local_shell_call';
|
|
144
144
|
|
|
145
|
+
/**
|
|
146
|
+
* Server-provided rendering hints for a tool invocation. The server emits a
|
|
147
|
+
* human-readable `text` (e.g. "Searching the web…") and a lucide.dev `icon`
|
|
148
|
+
* name to display alongside the tool, plus a `phase` describing the current
|
|
149
|
+
* lifecycle stage so the UI can swap labels/icons as the call progresses.
|
|
150
|
+
*
|
|
151
|
+
* Only `'done'` is received in a response today.
|
|
152
|
+
*/
|
|
153
|
+
export interface ResponseOutputToolDisplay {
|
|
154
|
+
/** Human-readable label to render for the tool (server-controlled). */
|
|
155
|
+
text: string;
|
|
156
|
+
/** Lucide.dev icon name to render next to the label. */
|
|
157
|
+
icon: string;
|
|
158
|
+
/** Lifecycle phase of the tool call. */
|
|
159
|
+
phase: 'done';
|
|
160
|
+
}
|
|
161
|
+
|
|
145
162
|
/**
|
|
146
163
|
* Tool-related output produced during a Responses-API turn. Covers tool
|
|
147
164
|
* discovery (`mcp_list_tools`), invocation (`mcp_call`, `function_call`,
|
|
@@ -165,6 +182,12 @@ export interface ResponseOutputTool {
|
|
|
165
182
|
call_id?: string;
|
|
166
183
|
/** Tool result payload (shape depends on the tool kind). */
|
|
167
184
|
output?: unknown;
|
|
185
|
+
/**
|
|
186
|
+
* Optional server-provided display hints (label, icon, phase). When
|
|
187
|
+
* present, `responsesToTree` forwards `text` and `icon` onto the
|
|
188
|
+
* resulting `MessageToolContent` so the UI can render them directly.
|
|
189
|
+
*/
|
|
190
|
+
display?: ResponseOutputToolDisplay;
|
|
168
191
|
[key: string]: unknown;
|
|
169
192
|
}
|
|
170
193
|
|
|
@@ -260,6 +283,18 @@ function textPart(text: string, id?: string): MessageContent {
|
|
|
260
283
|
return { type: 'text', id: id ?? generateId(), text, status: 'completed' };
|
|
261
284
|
}
|
|
262
285
|
|
|
286
|
+
// Build a `MessageToolContent` for one tool invocation, forwarding the
|
|
287
|
+
// optional server-provided `display.text` / `display.icon` hints when
|
|
288
|
+
// present so the UI can render them directly.
|
|
289
|
+
function toolPart(out: ResponseOutputTool): MessageContent {
|
|
290
|
+
return {
|
|
291
|
+
type: 'tool',
|
|
292
|
+
id: out.id,
|
|
293
|
+
name: out.name ?? out.type,
|
|
294
|
+
...(out.display ? { text: out.display.text, icon: out.display.icon } : {}),
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
|
|
263
298
|
// Build the `content` array for one assistant turn from a Responses-API
|
|
264
299
|
// record. Reasoning trails, tool invocations, and visible text all belong to
|
|
265
300
|
// the same turn and are kept in their original wire order so the UI can
|
|
@@ -291,11 +326,7 @@ function toAssistantParts(resp: StoredResponse): MessageContent[] {
|
|
|
291
326
|
case 'mcp_call':
|
|
292
327
|
case 'function_call':
|
|
293
328
|
case 'tool_call': {
|
|
294
|
-
parts.push(
|
|
295
|
-
type: 'tool',
|
|
296
|
-
id: out.id,
|
|
297
|
-
name: out.name ?? out.type,
|
|
298
|
-
});
|
|
329
|
+
parts.push(toolPart(out));
|
|
299
330
|
break;
|
|
300
331
|
}
|
|
301
332
|
default:
|
|
@@ -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
|
+
});
|