@aleph-alpha/chat-kit 2.3.0 → 3.0.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-DYTizPsB.js → CkInput.vue_vue_type_script_setup_true_lang-CwH5M5WD.js} +203 -141
- package/dist/chat-kit.css +33 -6
- package/dist/components/base/CkDropZoneOverlay/CkDropZoneOverlay.vue.d.ts.map +1 -1
- package/dist/components/base/CkModelSelector/types.d.ts +1 -1
- package/dist/components/base/CkPromptInput/CkPromptInput.stories.d.ts +48 -5
- package/dist/components/base/CkPromptInput/CkPromptInput.stories.d.ts.map +1 -1
- package/dist/components/base/CkPromptInput/CkPromptInput.vue.d.ts +7 -6
- package/dist/components/base/CkPromptInput/CkPromptInput.vue.d.ts.map +1 -1
- package/dist/components/base/CkPromptInput/types.d.ts +11 -12
- package/dist/components/base/CkPromptInput/types.d.ts.map +1 -1
- package/dist/components/base/CkPromptMenuButton/CkPromptMenuButton.stories.d.ts +18 -0
- package/dist/components/base/CkPromptMenuButton/CkPromptMenuButton.stories.d.ts.map +1 -0
- package/dist/components/base/CkPromptMenuButton/CkPromptMenuButton.vue.d.ts +18 -0
- package/dist/components/base/CkPromptMenuButton/CkPromptMenuButton.vue.d.ts.map +1 -0
- package/dist/components/base/CkPromptMenuButton/index.d.ts +3 -0
- package/dist/components/base/CkPromptMenuButton/index.d.ts.map +1 -0
- package/dist/components/base/CkPromptMenuButton/types.d.ts +30 -0
- package/dist/components/base/CkPromptMenuButton/types.d.ts.map +1 -0
- package/dist/components/base/{CkPromptActionButton/CkPromptActionButton.stories.d.ts → CkPromptSendButton/CkPromptSendButton.stories.d.ts} +5 -5
- package/dist/components/base/CkPromptSendButton/CkPromptSendButton.stories.d.ts.map +1 -0
- package/dist/components/base/{CkPromptActionButton/CkPromptActionButton.vue.d.ts → CkPromptSendButton/CkPromptSendButton.vue.d.ts} +3 -3
- package/dist/components/base/CkPromptSendButton/CkPromptSendButton.vue.d.ts.map +1 -0
- package/dist/components/base/CkPromptSendButton/index.d.ts +3 -0
- package/dist/components/base/CkPromptSendButton/index.d.ts.map +1 -0
- package/dist/components/base/CkPromptSendButton/types.d.ts +34 -0
- package/dist/components/base/CkPromptSendButton/types.d.ts.map +1 -0
- package/dist/components/base/CkPromptStopButton/CkPromptStopButton.stories.d.ts +1 -1
- package/dist/components/base/CkPromptStopButton/CkPromptStopButton.vue.d.ts.map +1 -1
- package/dist/components/base/CkPromptStopButton/types.d.ts +6 -4
- package/dist/components/base/CkPromptStopButton/types.d.ts.map +1 -1
- package/dist/components/base/icons/CkSendIcon.vue.d.ts.map +1 -1
- package/dist/components/base/index.d.ts +3 -1
- package/dist/components/base/index.d.ts.map +1 -1
- package/dist/components/composed/CkHistory/CkHistory.vue.d.ts +1 -1
- package/dist/components/composed/CkInput/CkInput.stories.d.ts.map +1 -1
- package/dist/components/composed/CkInput/CkInput.vue.d.ts +9 -8
- package/dist/components/composed/CkInput/CkInput.vue.d.ts.map +1 -1
- package/dist/components/composed/CkInput/types.d.ts +2 -7
- package/dist/components/composed/CkInput/types.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 +9 -8
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -9
- package/package.json +1 -1
- package/src/components/base/CkDropZoneOverlay/CkDropZoneOverlay.vue +2 -7
- package/src/components/base/CkModelSelector/types.ts +1 -1
- package/src/components/base/CkPromptInput/CkPromptInput.spec.ts +206 -11
- package/src/components/base/CkPromptInput/CkPromptInput.stories.ts +1068 -43
- package/src/components/base/CkPromptInput/CkPromptInput.vue +137 -28
- package/src/components/base/CkPromptInput/types.ts +11 -12
- package/src/components/base/CkPromptMenuButton/CkPromptMenuButton.spec.ts +62 -0
- package/src/components/base/CkPromptMenuButton/CkPromptMenuButton.stories.ts +75 -0
- package/src/components/base/CkPromptMenuButton/CkPromptMenuButton.vue +26 -0
- package/src/components/base/CkPromptMenuButton/index.ts +2 -0
- package/src/components/base/CkPromptMenuButton/types.ts +29 -0
- package/src/components/base/{CkPromptActionButton/CkPromptActionButton.spec.ts → CkPromptSendButton/CkPromptSendButton.spec.ts} +11 -11
- package/src/components/base/CkPromptSendButton/CkPromptSendButton.stories.ts +117 -0
- package/src/components/base/{CkPromptActionButton/CkPromptActionButton.vue → CkPromptSendButton/CkPromptSendButton.vue} +4 -4
- package/src/components/base/CkPromptSendButton/index.ts +2 -0
- package/src/components/base/CkPromptSendButton/types.ts +33 -0
- package/src/components/base/CkPromptStopButton/CkPromptStopButton.spec.ts +5 -5
- package/src/components/base/CkPromptStopButton/CkPromptStopButton.stories.ts +1 -1
- package/src/components/base/CkPromptStopButton/CkPromptStopButton.vue +3 -2
- package/src/components/base/CkPromptStopButton/types.ts +6 -4
- package/src/components/base/icons/CkSendIcon.vue +3 -16
- package/src/components/base/icons/CkStopIcon.vue +1 -1
- package/src/components/base/index.ts +3 -1
- package/src/components/composed/CkInput/CkInput.stories.ts +0 -4
- package/src/components/composed/CkInput/CkInput.vue +7 -5
- package/src/components/composed/CkInput/types.ts +2 -7
- package/src/components/index.ts +3 -1
- package/src/index.ts +3 -1
- package/dist/components/base/CkPromptActionButton/CkPromptActionButton.stories.d.ts.map +0 -1
- package/dist/components/base/CkPromptActionButton/CkPromptActionButton.vue.d.ts.map +0 -1
- package/dist/components/base/CkPromptActionButton/index.d.ts +0 -3
- package/dist/components/base/CkPromptActionButton/index.d.ts.map +0 -1
- package/dist/components/base/CkPromptActionButton/types.d.ts +0 -33
- package/dist/components/base/CkPromptActionButton/types.d.ts.map +0 -1
- package/src/components/base/CkPromptActionButton/CkPromptActionButton.stories.ts +0 -126
- package/src/components/base/CkPromptActionButton/index.ts +0 -2
- package/src/components/base/CkPromptActionButton/types.ts +0 -32
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Icon-only send button styled for the chat prompt area (brand color, pill
|
|
3
|
+
* shape). Sits in `CkPromptInput`'s `toolbar-right` slot as the submit
|
|
4
|
+
* trigger. Shows a spinner via `loading` while the previous request is in
|
|
5
|
+
* flight; pair with `CkPromptStopButton` to expose an abort control.
|
|
6
|
+
*
|
|
7
|
+
* @category Actions
|
|
8
|
+
* @useCases send message button, submit prompt, primary chat send action, loading send button, disabled send button
|
|
9
|
+
* @keywords prompt, send, submit, button, icon, loading, brand
|
|
10
|
+
* @related CkPromptInput, CkPromptStopButton, CkInput, CkSendIcon
|
|
11
|
+
*/
|
|
12
|
+
export interface CkPromptSendButtonProps {
|
|
13
|
+
/**
|
|
14
|
+
* Accessible label for the button. **Required** because the button only
|
|
15
|
+
* renders an icon.
|
|
16
|
+
*/
|
|
17
|
+
ariaLabel: string;
|
|
18
|
+
/**
|
|
19
|
+
* Whether the button is disabled.
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Whether to show a loading spinner instead of the slotted icon.
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
loading?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Native button `type`. Set `'submit'` when placed inside a `<form>`.
|
|
30
|
+
* @default 'button'
|
|
31
|
+
*/
|
|
32
|
+
type?: 'button' | 'submit';
|
|
33
|
+
}
|
|
@@ -52,13 +52,13 @@ describe('CkPromptStopButton', () => {
|
|
|
52
52
|
).toBeDisabled();
|
|
53
53
|
});
|
|
54
54
|
|
|
55
|
-
it('applies
|
|
55
|
+
it('applies secondary pill styling per Figma spec', () => {
|
|
56
56
|
render(CkPromptStopButton);
|
|
57
57
|
|
|
58
58
|
const button = screen.getByRole('button', { name: 'Stop generating' });
|
|
59
|
-
|
|
60
|
-
expect(button.className).toContain('
|
|
61
|
-
expect(button.className).toContain('
|
|
62
|
-
expect(button.className).toContain('!rounded-
|
|
59
|
+
// Secondary variant + icon size from UiButton + Figma pill override.
|
|
60
|
+
expect(button.className).toContain('bg-background-button-secondary-button');
|
|
61
|
+
expect(button.className).toContain('size-9');
|
|
62
|
+
expect(button.className).toContain('!rounded-full');
|
|
63
63
|
});
|
|
64
64
|
});
|
|
@@ -49,7 +49,7 @@ import { CkPromptStopButton, CkStopIcon } from '@aleph-alpha/chat-kit';
|
|
|
49
49
|
</template>`;
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
|
-
* Default stop button. Swap it in for `
|
|
52
|
+
* Default stop button. Swap it in for `CkPromptSendButton` while an
|
|
53
53
|
* assistant reply is streaming so users can cancel the response.
|
|
54
54
|
*/
|
|
55
55
|
export const Default: Story = {
|
|
@@ -17,9 +17,10 @@ defineEmits<{
|
|
|
17
17
|
<template>
|
|
18
18
|
<UiButton
|
|
19
19
|
v-bind="{ ariaLabel }"
|
|
20
|
-
|
|
20
|
+
variant="secondary"
|
|
21
|
+
size="icon"
|
|
21
22
|
:disabled="props.disabled"
|
|
22
|
-
class="!
|
|
23
|
+
class="!rounded-full"
|
|
23
24
|
@click="$emit('click', $event)"
|
|
24
25
|
>
|
|
25
26
|
<slot />
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Icon-only button used to stop an in-flight assistant generation.
|
|
3
|
-
*
|
|
2
|
+
* Icon-only button used to stop an in-flight assistant generation. Visually
|
|
3
|
+
* de-emphasized counterpart to `CkPromptSendButton` — uses UiButton's `secondary`
|
|
4
|
+
* variant (muted background) per Figma spec, so the user's eye doesn't read it
|
|
5
|
+
* as a primary call-to-action. Swap it in for `CkPromptSendButton` in the
|
|
4
6
|
* prompt toolbar while a response is streaming.
|
|
5
7
|
*
|
|
6
8
|
* @category Actions
|
|
7
9
|
* @useCases stop assistant generation, cancel streaming reply, abort in-flight request, halt llm response
|
|
8
|
-
* @keywords stop, cancel, abort, prompt,
|
|
9
|
-
* @related
|
|
10
|
+
* @keywords stop, cancel, abort, prompt, button, icon, streaming, secondary
|
|
11
|
+
* @related CkPromptSendButton, CkPromptMenuButton, CkPromptInput, CkInput, CkStopIcon
|
|
10
12
|
*/
|
|
11
13
|
export interface CkPromptStopButtonProps {
|
|
12
14
|
/**
|
|
@@ -1,22 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { UiIcon } from '@aleph-alpha/ui-library';
|
|
3
|
+
|
|
2
4
|
defineOptions({ name: 'CkSendIcon' });
|
|
3
5
|
</script>
|
|
4
6
|
|
|
5
7
|
<template>
|
|
6
|
-
<
|
|
7
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
-
width="16"
|
|
9
|
-
height="16"
|
|
10
|
-
viewBox="0 0 24 24"
|
|
11
|
-
fill="none"
|
|
12
|
-
stroke="currentColor"
|
|
13
|
-
stroke-width="2"
|
|
14
|
-
stroke-linecap="round"
|
|
15
|
-
stroke-linejoin="round"
|
|
16
|
-
>
|
|
17
|
-
<path
|
|
18
|
-
d="M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z"
|
|
19
|
-
/>
|
|
20
|
-
<path d="M6 12h16" />
|
|
21
|
-
</svg>
|
|
8
|
+
<UiIcon name="arrow-up-right" />
|
|
22
9
|
</template>
|
|
@@ -12,7 +12,7 @@ defineOptions({ name: 'CkStopIcon' });
|
|
|
12
12
|
>
|
|
13
13
|
<path
|
|
14
14
|
d="M13.3335 3.33301C13.3335 2.96482 13.035 2.66634 12.6668 2.66634H3.3335C2.96531 2.66634 2.66683 2.96482 2.66683 3.33301V12.6663C2.66683 13.0345 2.96531 13.333 3.3335 13.333H12.6668C13.035 13.333 13.3335 13.0345 13.3335 12.6663V3.33301ZM14.6668 12.6663C14.6668 13.7709 13.7714 14.6663 12.6668 14.6663H3.3335C2.22893 14.6663 1.3335 13.7709 1.3335 12.6663V3.33301C1.3335 2.22844 2.22893 1.33301 3.3335 1.33301H12.6668C13.7714 1.33301 14.6668 2.22844 14.6668 3.33301V12.6663Z"
|
|
15
|
-
fill="
|
|
15
|
+
fill="currentColor"
|
|
16
16
|
/>
|
|
17
17
|
</svg>
|
|
18
18
|
</template>
|
|
@@ -45,7 +45,9 @@ export type {
|
|
|
45
45
|
CkModelSelectorProps,
|
|
46
46
|
CkModelSelectorEmits,
|
|
47
47
|
} from './CkModelSelector';
|
|
48
|
-
export {
|
|
48
|
+
export { CkPromptSendButton } from './CkPromptSendButton';
|
|
49
|
+
export { CkPromptMenuButton } from './CkPromptMenuButton';
|
|
50
|
+
export type { CkPromptMenuButtonProps } from './CkPromptMenuButton';
|
|
49
51
|
export { CkPromptStopButton } from './CkPromptStopButton';
|
|
50
52
|
export { CkPromptInput } from './CkPromptInput';
|
|
51
53
|
export { CkPromptInputDisclaimer } from './CkPromptInputDisclaimer';
|
|
@@ -27,10 +27,6 @@ const meta: Meta<typeof CkInput> = {
|
|
|
27
27
|
description:
|
|
28
28
|
'Shows a spinner in the send button and blocks further input.',
|
|
29
29
|
},
|
|
30
|
-
maxHeight: {
|
|
31
|
-
control: 'number',
|
|
32
|
-
description: 'Max textarea height (px) before it becomes scrollable.',
|
|
33
|
-
},
|
|
34
30
|
ariaLabel: {
|
|
35
31
|
control: 'text',
|
|
36
32
|
description: 'Accessible label for the textarea.',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import
|
|
2
|
+
import CkPromptSendButton from '../../base/CkPromptSendButton/CkPromptSendButton.vue';
|
|
3
3
|
import CkPromptStopButton from '../../base/CkPromptStopButton/CkPromptStopButton.vue';
|
|
4
4
|
import CkPromptInput from '../../base/CkPromptInput/CkPromptInput.vue';
|
|
5
5
|
import CkPromptInputDisclaimer from '../../base/CkPromptInputDisclaimer/CkPromptInputDisclaimer.vue';
|
|
@@ -15,7 +15,6 @@ const props = withDefaults(defineProps<CkInputProps>(), {
|
|
|
15
15
|
placeholder: 'Ask me anything',
|
|
16
16
|
disabled: false,
|
|
17
17
|
loading: false,
|
|
18
|
-
maxHeight: 200,
|
|
19
18
|
ariaLabel: 'Chat message input',
|
|
20
19
|
stopAriaLabel: 'Stop generating',
|
|
21
20
|
disclaimer: undefined,
|
|
@@ -61,11 +60,14 @@ defineExpose({ focus, submit });
|
|
|
61
60
|
:model-value="modelValue"
|
|
62
61
|
:placeholder="placeholder"
|
|
63
62
|
:disabled="isDisabled"
|
|
64
|
-
:max-height="maxHeight"
|
|
65
63
|
:aria-label="ariaLabel"
|
|
66
64
|
@update:model-value="onUpdateModelValue"
|
|
67
65
|
@submit="onSubmit"
|
|
68
66
|
>
|
|
67
|
+
<template v-if="$slots['toolbar-top']" #toolbar-top>
|
|
68
|
+
<slot name="toolbar-top" />
|
|
69
|
+
</template>
|
|
70
|
+
|
|
69
71
|
<template v-if="$slots['toolbar-left']" #toolbar-left>
|
|
70
72
|
<slot name="toolbar-left" />
|
|
71
73
|
</template>
|
|
@@ -82,7 +84,7 @@ defineExpose({ focus, submit });
|
|
|
82
84
|
<CkStopIcon />
|
|
83
85
|
</slot>
|
|
84
86
|
</CkPromptStopButton>
|
|
85
|
-
<
|
|
87
|
+
<CkPromptSendButton
|
|
86
88
|
v-else
|
|
87
89
|
v-bind="{ ariaLabel: 'Send message' }"
|
|
88
90
|
type="submit"
|
|
@@ -91,7 +93,7 @@ defineExpose({ focus, submit });
|
|
|
91
93
|
<slot name="send-icon">
|
|
92
94
|
<CkSendIcon />
|
|
93
95
|
</slot>
|
|
94
|
-
</
|
|
96
|
+
</CkPromptSendButton>
|
|
95
97
|
</slot>
|
|
96
98
|
</template>
|
|
97
99
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Drop-in chat input: combines `CkPromptInput`, a `
|
|
2
|
+
* Drop-in chat input: combines `CkPromptInput`, a `CkPromptSendButton` send
|
|
3
3
|
* button, and a `CkPromptInputDisclaimer`. Supports `v-model`, loading and
|
|
4
4
|
* disabled states, and slots to customize the toolbar and footer.
|
|
5
5
|
*
|
|
6
6
|
* @category Form Inputs
|
|
7
7
|
* @useCases chat compose input, prompt box with send button, llm input with disclaimer, quick-start chat input, turnkey chat input
|
|
8
8
|
* @keywords input, prompt, chat, send, compose, disclaimer, loading, v-model, textarea
|
|
9
|
-
* @related CkPromptInput,
|
|
9
|
+
* @related CkPromptInput, CkPromptSendButton, CkPromptInputDisclaimer, CkConversation
|
|
10
10
|
*/
|
|
11
11
|
export interface CkInputProps {
|
|
12
12
|
/**
|
|
@@ -30,11 +30,6 @@ export interface CkInputProps {
|
|
|
30
30
|
* @default false
|
|
31
31
|
*/
|
|
32
32
|
loading?: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Max height (in px) of the underlying textarea before it becomes scrollable.
|
|
35
|
-
* @default 200
|
|
36
|
-
*/
|
|
37
|
-
maxHeight?: number;
|
|
38
33
|
/**
|
|
39
34
|
* Accessible label for the input.
|
|
40
35
|
* @default 'Chat message input'
|
package/src/components/index.ts
CHANGED
|
@@ -12,7 +12,8 @@ export {
|
|
|
12
12
|
CkMarkdownRenderer,
|
|
13
13
|
CkMessageActionButton,
|
|
14
14
|
CkModelSelector,
|
|
15
|
-
|
|
15
|
+
CkPromptSendButton,
|
|
16
|
+
CkPromptMenuButton,
|
|
16
17
|
CkPromptStopButton,
|
|
17
18
|
CkPromptInput,
|
|
18
19
|
CkPromptInputDisclaimer,
|
|
@@ -44,6 +45,7 @@ export type {
|
|
|
44
45
|
CkModelOption,
|
|
45
46
|
CkModelSelectorProps,
|
|
46
47
|
CkModelSelectorEmits,
|
|
48
|
+
CkPromptMenuButtonProps,
|
|
47
49
|
CkUserMessageProps,
|
|
48
50
|
} from './base';
|
|
49
51
|
|
package/src/index.ts
CHANGED
|
@@ -77,7 +77,8 @@ export {
|
|
|
77
77
|
CkMarkdownRenderer,
|
|
78
78
|
CkMessageActionButton,
|
|
79
79
|
CkModelSelector,
|
|
80
|
-
|
|
80
|
+
CkPromptSendButton,
|
|
81
|
+
CkPromptMenuButton,
|
|
81
82
|
CkPromptStopButton,
|
|
82
83
|
CkPromptInput,
|
|
83
84
|
CkPromptInputDisclaimer,
|
|
@@ -112,6 +113,7 @@ export type {
|
|
|
112
113
|
CkModelOption,
|
|
113
114
|
CkModelSelectorProps,
|
|
114
115
|
CkModelSelectorEmits,
|
|
116
|
+
CkPromptMenuButtonProps,
|
|
115
117
|
CkUserMessageProps,
|
|
116
118
|
} from './components';
|
|
117
119
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CkPromptActionButton.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkPromptActionButton/CkPromptActionButton.stories.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE3D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,oBAAoB,CA+B3C,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAiCnC;;;GAGG;AACH,eAAO,MAAM,OAAO,EAAE,KAarB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,QAAQ,EAAE,KAatB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,OAAO,EAAE,KAarB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CkPromptActionButton.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkPromptActionButton/CkPromptActionButton.vue"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAkEzD,QAAA,IAAI,OAAO,IAAW,CAAE;AACxB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAK/C,QAAA,MAAM,UAAU;;;;6EAGd,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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkPromptActionButton/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAC7E,mBAAmB,SAAS,CAAC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Icon-only call-to-action button styled for the chat prompt area (brand color).
|
|
3
|
-
* Typically used as the "send" button inside a prompt input toolbar, but works
|
|
4
|
-
* for any primary prompt-level action.
|
|
5
|
-
*
|
|
6
|
-
* @category Actions
|
|
7
|
-
* @useCases send message button, submit prompt, primary chat action, loading send button, disabled send button
|
|
8
|
-
* @keywords prompt, send, action, button, icon, submit, loading, brand
|
|
9
|
-
* @related CkPromptInput, CkInput, CkMessageActionButton
|
|
10
|
-
*/
|
|
11
|
-
export interface CkPromptActionButtonProps {
|
|
12
|
-
/**
|
|
13
|
-
* Accessible label for the button. **Required** because the button only
|
|
14
|
-
* renders an icon.
|
|
15
|
-
*/
|
|
16
|
-
ariaLabel: string;
|
|
17
|
-
/**
|
|
18
|
-
* Whether the button is disabled.
|
|
19
|
-
* @default false
|
|
20
|
-
*/
|
|
21
|
-
disabled?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Whether to show a loading spinner instead of the slotted icon.
|
|
24
|
-
* @default false
|
|
25
|
-
*/
|
|
26
|
-
loading?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Native button `type`. Set `'submit'` when placed inside a `<form>`.
|
|
29
|
-
* @default 'button'
|
|
30
|
-
*/
|
|
31
|
-
type?: 'button' | 'submit';
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkPromptActionButton/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAC5B"}
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import CkPromptActionButton from './CkPromptActionButton.vue';
|
|
2
|
-
import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
3
|
-
|
|
4
|
-
const meta: Meta<typeof CkPromptActionButton> = {
|
|
5
|
-
title: 'Base/CkPromptActionButton',
|
|
6
|
-
component: CkPromptActionButton,
|
|
7
|
-
tags: ['autodocs'],
|
|
8
|
-
argTypes: {
|
|
9
|
-
ariaLabel: {
|
|
10
|
-
control: 'text',
|
|
11
|
-
description:
|
|
12
|
-
'Accessible label for the button. Required because the button is icon-only.',
|
|
13
|
-
},
|
|
14
|
-
disabled: {
|
|
15
|
-
control: 'boolean',
|
|
16
|
-
description: 'Whether the button is disabled.',
|
|
17
|
-
},
|
|
18
|
-
loading: {
|
|
19
|
-
control: 'boolean',
|
|
20
|
-
description:
|
|
21
|
-
'Shows a spinner instead of the slotted icon and blocks clicks.',
|
|
22
|
-
},
|
|
23
|
-
type: {
|
|
24
|
-
control: 'radio',
|
|
25
|
-
options: ['button', 'submit'],
|
|
26
|
-
description: 'Native button type. Use `submit` inside a <form>.',
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
decorators: [
|
|
30
|
-
() => ({
|
|
31
|
-
template:
|
|
32
|
-
'<div style="max-width: 640px; margin: 0 auto; padding: 24px;"><story /></div>',
|
|
33
|
-
}),
|
|
34
|
-
],
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export default meta;
|
|
38
|
-
type Story = StoryObj<typeof meta>;
|
|
39
|
-
|
|
40
|
-
const defaultTemplateSource = `<script setup lang="ts">
|
|
41
|
-
import { CkPromptActionButton } from '@aleph-alpha/chat-kit';
|
|
42
|
-
import { CkSendIcon } from '@aleph-alpha/chat-kit';
|
|
43
|
-
</script>
|
|
44
|
-
|
|
45
|
-
<template>
|
|
46
|
-
<CkPromptActionButton ariaLabel="Send message">
|
|
47
|
-
<CkSendIcon />
|
|
48
|
-
</CkPromptActionButton>
|
|
49
|
-
</template>`;
|
|
50
|
-
|
|
51
|
-
const disabledTemplateSource = `<script setup lang="ts">
|
|
52
|
-
import { CkPromptActionButton, CkSendIcon } from '@aleph-alpha/chat-kit';
|
|
53
|
-
</script>
|
|
54
|
-
|
|
55
|
-
<template>
|
|
56
|
-
<CkPromptActionButton ariaLabel="Send message" disabled>
|
|
57
|
-
<CkSendIcon />
|
|
58
|
-
</CkPromptActionButton>
|
|
59
|
-
</template>`;
|
|
60
|
-
|
|
61
|
-
const loadingTemplateSource = `<script setup lang="ts">
|
|
62
|
-
import { CkPromptActionButton, CkSendIcon } from '@aleph-alpha/chat-kit';
|
|
63
|
-
</script>
|
|
64
|
-
|
|
65
|
-
<template>
|
|
66
|
-
<CkPromptActionButton ariaLabel="Send message" loading>
|
|
67
|
-
<CkSendIcon />
|
|
68
|
-
</CkPromptActionButton>
|
|
69
|
-
</template>`;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Default send-style button. Use in a prompt input toolbar to submit a message
|
|
73
|
-
* or trigger a primary chat action.
|
|
74
|
-
*/
|
|
75
|
-
export const Default: Story = {
|
|
76
|
-
render: () => ({
|
|
77
|
-
components: { CkPromptActionButton },
|
|
78
|
-
template: `
|
|
79
|
-
<CkPromptActionButton ariaLabel="Send message">
|
|
80
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
81
|
-
<path d="M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z" />
|
|
82
|
-
<path d="M6 12h16" />
|
|
83
|
-
</svg>
|
|
84
|
-
</CkPromptActionButton>
|
|
85
|
-
`,
|
|
86
|
-
}),
|
|
87
|
-
parameters: { docs: { source: { code: defaultTemplateSource } } },
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Disabled state — use when the input is empty or a submit is otherwise
|
|
92
|
-
* blocked (e.g. rate-limited).
|
|
93
|
-
*/
|
|
94
|
-
export const Disabled: Story = {
|
|
95
|
-
render: () => ({
|
|
96
|
-
components: { CkPromptActionButton },
|
|
97
|
-
template: `
|
|
98
|
-
<CkPromptActionButton ariaLabel="Send message" disabled>
|
|
99
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
100
|
-
<path d="M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z" />
|
|
101
|
-
<path d="M6 12h16" />
|
|
102
|
-
</svg>
|
|
103
|
-
</CkPromptActionButton>
|
|
104
|
-
`,
|
|
105
|
-
}),
|
|
106
|
-
parameters: { docs: { source: { code: disabledTemplateSource } } },
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Loading state — shows a spinner and blocks clicks. Use while the previous
|
|
111
|
-
* message is still streaming or the request is in flight.
|
|
112
|
-
*/
|
|
113
|
-
export const Loading: Story = {
|
|
114
|
-
render: () => ({
|
|
115
|
-
components: { CkPromptActionButton },
|
|
116
|
-
template: `
|
|
117
|
-
<CkPromptActionButton ariaLabel="Send message" loading>
|
|
118
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
119
|
-
<path d="M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z" />
|
|
120
|
-
<path d="M6 12h16" />
|
|
121
|
-
</svg>
|
|
122
|
-
</CkPromptActionButton>
|
|
123
|
-
`,
|
|
124
|
-
}),
|
|
125
|
-
parameters: { docs: { source: { code: loadingTemplateSource } } },
|
|
126
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Icon-only call-to-action button styled for the chat prompt area (brand color).
|
|
3
|
-
* Typically used as the "send" button inside a prompt input toolbar, but works
|
|
4
|
-
* for any primary prompt-level action.
|
|
5
|
-
*
|
|
6
|
-
* @category Actions
|
|
7
|
-
* @useCases send message button, submit prompt, primary chat action, loading send button, disabled send button
|
|
8
|
-
* @keywords prompt, send, action, button, icon, submit, loading, brand
|
|
9
|
-
* @related CkPromptInput, CkInput, CkMessageActionButton
|
|
10
|
-
*/
|
|
11
|
-
export interface CkPromptActionButtonProps {
|
|
12
|
-
/**
|
|
13
|
-
* Accessible label for the button. **Required** because the button only
|
|
14
|
-
* renders an icon.
|
|
15
|
-
*/
|
|
16
|
-
ariaLabel: string;
|
|
17
|
-
/**
|
|
18
|
-
* Whether the button is disabled.
|
|
19
|
-
* @default false
|
|
20
|
-
*/
|
|
21
|
-
disabled?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Whether to show a loading spinner instead of the slotted icon.
|
|
24
|
-
* @default false
|
|
25
|
-
*/
|
|
26
|
-
loading?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Native button `type`. Set `'submit'` when placed inside a `<form>`.
|
|
29
|
-
* @default 'button'
|
|
30
|
-
*/
|
|
31
|
-
type?: 'button' | 'submit';
|
|
32
|
-
}
|