@aleph-alpha/chat-kit 0.7.0 → 0.9.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.
Files changed (44) hide show
  1. package/dist/{CkInput.vue_vue_type_script_setup_true_lang-B6_ZF6rz.js → CkInput.vue_vue_type_script_setup_true_lang-DmcLXAgB.js} +258 -62
  2. package/dist/chat-kit.css +20 -0
  3. package/dist/components/base/CkCopyMessageActionButton/CkCopyMessageActionButton.stories.d.ts +8 -0
  4. package/dist/components/base/CkCopyMessageActionButton/CkCopyMessageActionButton.stories.d.ts.map +1 -0
  5. package/dist/components/base/CkCopyMessageActionButton/CkCopyMessageActionButton.vue.d.ts +31 -0
  6. package/dist/components/base/CkCopyMessageActionButton/CkCopyMessageActionButton.vue.d.ts.map +1 -0
  7. package/dist/components/base/CkCopyMessageActionButton/index.d.ts +2 -0
  8. package/dist/components/base/CkCopyMessageActionButton/index.d.ts.map +1 -0
  9. package/dist/components/base/CkMessageActionButton/CkMessageActionButton.stories.d.ts +7 -0
  10. package/dist/components/base/CkMessageActionButton/CkMessageActionButton.stories.d.ts.map +1 -0
  11. package/dist/components/base/CkMessageActionButton/CkMessageActionButton.vue.d.ts +20 -0
  12. package/dist/components/base/CkMessageActionButton/CkMessageActionButton.vue.d.ts.map +1 -0
  13. package/dist/components/base/CkMessageActionButton/index.d.ts +2 -0
  14. package/dist/components/base/CkMessageActionButton/index.d.ts.map +1 -0
  15. package/dist/components/base/CkPromptActionButton/CkPromptActionButton.vue.d.ts +1 -1
  16. package/dist/components/base/CkPromptActionButton/CkPromptActionButton.vue.d.ts.map +1 -1
  17. package/dist/components/base/CkPromptStopButton/CkPromptStopButton.stories.d.ts +8 -0
  18. package/dist/components/base/CkPromptStopButton/CkPromptStopButton.stories.d.ts.map +1 -0
  19. package/dist/components/base/CkPromptStopButton/CkPromptStopButton.vue.d.ts +25 -0
  20. package/dist/components/base/CkPromptStopButton/CkPromptStopButton.vue.d.ts.map +1 -0
  21. package/dist/components/base/CkPromptStopButton/index.d.ts +2 -0
  22. package/dist/components/base/CkPromptStopButton/index.d.ts.map +1 -0
  23. package/dist/components/base/icons/CkStopIcon.vue.d.ts +4 -0
  24. package/dist/components/base/icons/CkStopIcon.vue.d.ts.map +1 -0
  25. package/dist/components/base/icons/index.d.ts +1 -0
  26. package/dist/components/base/icons/index.d.ts.map +1 -1
  27. package/dist/components/base/index.d.ts +4 -0
  28. package/dist/components/base/index.d.ts.map +1 -1
  29. package/dist/components/composed/CkConversation/CkConversation.vue.d.ts.map +1 -1
  30. package/dist/components/composed/CkInput/CkInput.stories.d.ts +1 -1
  31. package/dist/components/composed/CkInput/CkInput.stories.d.ts.map +1 -1
  32. package/dist/components/composed/CkInput/CkInput.vue.d.ts +9 -3
  33. package/dist/components/composed/CkInput/CkInput.vue.d.ts.map +1 -1
  34. package/dist/components/index.d.ts +1 -1
  35. package/dist/components/index.d.ts.map +1 -1
  36. package/dist/components/index.js +10 -5
  37. package/dist/handlers/index.js +1 -1
  38. package/dist/handlers/useChatKitLabels.d.ts +4 -0
  39. package/dist/handlers/useChatKitLabels.d.ts.map +1 -1
  40. package/dist/index.d.ts +1 -1
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js +11 -6
  43. package/dist/{useChatKitLabels-xZXcnxZZ.js → useChatKitLabels-DNwoZ1x6.js} +116 -53
  44. package/package.json +3 -3
@@ -1,6 +1,50 @@
1
- import { defineComponent, openBlock, createElementBlock, renderSlot, createCommentVNode, createElementVNode, ref, onMounted, nextTick, onUnmounted, watch, Fragment, renderList, normalizeStyle, toRefs, computed, h, createBlock, unref, mergeProps, withCtx, useId, useTemplateRef, withModifiers, toDisplayString, createTextVNode, useSlots, createVNode, createSlots, normalizeProps, guardReactiveProps, normalizeClass } from "vue";
2
- import { a as useMarkdownParser, u as useChatKitLabels } from "./useChatKitLabels-xZXcnxZZ.js";
3
- import { UiButton, UiAvatar, UiAvatarImage, UiSpinner, UiAvatarFallback } from "@aleph-alpha/ui-library";
1
+ import { defineComponent, openBlock, createElementBlock, createElementVNode, renderSlot, createCommentVNode, ref, onMounted, nextTick, onUnmounted, watch, Fragment, renderList, normalizeStyle, createBlock, unref, mergeProps, withCtx, createVNode, Transition, toDisplayString, toRefs, computed, h, useId, useTemplateRef, withModifiers, createTextVNode, useSlots, createSlots, normalizeProps, guardReactiveProps, normalizeClass } from "vue";
2
+ import { a as useMarkdownParser, u as useChatKitLabels } from "./useChatKitLabels-DNwoZ1x6.js";
3
+ import { UiIconButton, UiTooltip, UiIcon, UiButton, UiAvatar, UiAvatarImage, UiSpinner, UiAvatarFallback } from "@aleph-alpha/ui-library";
4
+ const _hoisted_1$7 = {
5
+ xmlns: "http://www.w3.org/2000/svg",
6
+ width: "16",
7
+ height: "16",
8
+ viewBox: "0 0 24 24",
9
+ fill: "none",
10
+ stroke: "currentColor",
11
+ "stroke-width": "2",
12
+ "stroke-linecap": "round",
13
+ "stroke-linejoin": "round"
14
+ };
15
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
16
+ ...{ name: "CkSendIcon" },
17
+ __name: "CkSendIcon",
18
+ setup(__props) {
19
+ return (_ctx, _cache) => {
20
+ return openBlock(), createElementBlock("svg", _hoisted_1$7, [..._cache[0] || (_cache[0] = [
21
+ createElementVNode("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" }, null, -1),
22
+ createElementVNode("path", { d: "M6 12h16" }, null, -1)
23
+ ])]);
24
+ };
25
+ }
26
+ });
27
+ const _hoisted_1$6 = {
28
+ xmlns: "http://www.w3.org/2000/svg",
29
+ width: "16",
30
+ height: "16",
31
+ viewBox: "0 0 16 16",
32
+ fill: "none"
33
+ };
34
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
35
+ ...{ name: "CkStopIcon" },
36
+ __name: "CkStopIcon",
37
+ setup(__props) {
38
+ return (_ctx, _cache) => {
39
+ return openBlock(), createElementBlock("svg", _hoisted_1$6, [..._cache[0] || (_cache[0] = [
40
+ createElementVNode("path", {
41
+ 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",
42
+ fill: "#1D1D1B"
43
+ }, null, -1)
44
+ ])]);
45
+ };
46
+ }
47
+ });
4
48
  const _hoisted_1$5 = { class: "flex w-full items-start gap-2" };
5
49
  const _hoisted_2$3 = {
6
50
  key: 0,
@@ -15,7 +59,7 @@ const _hoisted_5$1 = {
15
59
  key: 1,
16
60
  class: "flex items-center"
17
61
  };
18
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
62
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
19
63
  ...{ name: "CkAgentMessage" },
20
64
  __name: "CkAgentMessage",
21
65
  setup(__props) {
@@ -48,7 +92,7 @@ const _hoisted_3$1 = {
48
92
  key: 1,
49
93
  class: "flex justify-start"
50
94
  };
51
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
95
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
52
96
  ...{ name: "CkConversationLayout" },
53
97
  __name: "CkConversationLayout",
54
98
  props: {
@@ -197,6 +241,134 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
197
241
  };
198
242
  }
199
243
  });
244
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
245
+ ...{
246
+ name: "CkMessageActionButton"
247
+ },
248
+ __name: "CkMessageActionButton",
249
+ props: {
250
+ ariaLabel: {},
251
+ disabled: { type: Boolean, default: false }
252
+ },
253
+ setup(__props) {
254
+ return (_ctx, _cache) => {
255
+ return openBlock(), createBlock(unref(UiIconButton), mergeProps({ ariaLabel: __props.ariaLabel }, {
256
+ disabled: __props.disabled,
257
+ variant: "ghost",
258
+ class: "message-action-button box-border w-8 h-8 transition-colors hover:bg-background-surface-muted hover:border-border-button-outlined focus-visible:bg-background-surface-muted focus-visible:border-border-button-outlined active:bg-background-surface-muted active:border-border-button-outlined"
259
+ }), {
260
+ default: withCtx(() => [
261
+ renderSlot(_ctx.$slots, "default", {}, void 0, true)
262
+ ]),
263
+ _: 3
264
+ }, 16, ["disabled"]);
265
+ };
266
+ }
267
+ });
268
+ const _export_sfc = (sfc, props) => {
269
+ const target = sfc.__vccOpts || sfc;
270
+ for (const [key, val] of props) {
271
+ target[key] = val;
272
+ }
273
+ return target;
274
+ };
275
+ const CkMessageActionButton = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-ee7595cc"]]);
276
+ const _hoisted_1$3 = {
277
+ class: "sr-only",
278
+ "aria-live": "polite"
279
+ };
280
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
281
+ ...{
282
+ name: "CkCopyMessageActionButton"
283
+ },
284
+ __name: "CkCopyMessageActionButton",
285
+ props: {
286
+ text: {},
287
+ disabled: { type: Boolean, default: false },
288
+ durationMs: { default: 3e3 },
289
+ ariaLabelCopy: { default: "Copy message" },
290
+ ariaLabelCopied: { default: "Copied" },
291
+ writeToClipboard: { type: Function, default: void 0 }
292
+ },
293
+ emits: ["copy"],
294
+ setup(__props, { emit: __emit }) {
295
+ const props = __props;
296
+ const emit = __emit;
297
+ const copied = ref(false);
298
+ const tooltipOpen = ref(false);
299
+ let resetTimer;
300
+ onUnmounted(() => {
301
+ if (resetTimer !== void 0) {
302
+ clearTimeout(resetTimer);
303
+ }
304
+ });
305
+ async function handleClick() {
306
+ if (props.disabled) {
307
+ return;
308
+ }
309
+ tooltipOpen.value = true;
310
+ try {
311
+ const write = props.writeToClipboard ?? ((t) => globalThis.navigator.clipboard.writeText(t));
312
+ await write(props.text);
313
+ copied.value = true;
314
+ tooltipOpen.value = true;
315
+ emit("copy", { success: true });
316
+ if (resetTimer !== void 0) {
317
+ clearTimeout(resetTimer);
318
+ }
319
+ resetTimer = setTimeout(() => {
320
+ copied.value = false;
321
+ resetTimer = void 0;
322
+ }, props.durationMs);
323
+ } catch {
324
+ emit("copy", { success: false });
325
+ }
326
+ }
327
+ return (_ctx, _cache) => {
328
+ return openBlock(), createBlock(unref(UiTooltip), {
329
+ open: tooltipOpen.value,
330
+ "onUpdate:open": _cache[0] || (_cache[0] = ($event) => tooltipOpen.value = $event),
331
+ content: copied.value ? __props.ariaLabelCopied : __props.ariaLabelCopy,
332
+ side: "bottom",
333
+ align: "center",
334
+ "delay-duration": 0
335
+ }, {
336
+ default: withCtx(() => [
337
+ createVNode(unref(CkMessageActionButton), mergeProps({ ariaLabel: copied.value ? __props.ariaLabelCopied : __props.ariaLabelCopy }, {
338
+ disabled: __props.disabled,
339
+ onClick: handleClick
340
+ }), {
341
+ default: withCtx(() => [
342
+ createVNode(Transition, {
343
+ name: "copy-message-icon-fade",
344
+ mode: "out-in"
345
+ }, {
346
+ default: withCtx(() => [
347
+ !copied.value ? (openBlock(), createBlock(unref(UiIcon), {
348
+ key: "copy",
349
+ name: "copy",
350
+ size: 16,
351
+ "aria-hidden": "true"
352
+ })) : (openBlock(), createBlock(unref(UiIcon), {
353
+ key: "check",
354
+ name: "check",
355
+ size: 16,
356
+ "aria-hidden": "true"
357
+ }))
358
+ ]),
359
+ _: 1
360
+ })
361
+ ]),
362
+ _: 1
363
+ }, 16, ["disabled"]),
364
+ createElementVNode("span", _hoisted_1$3, toDisplayString(copied.value ? __props.ariaLabelCopied : __props.ariaLabelCopy), 1)
365
+ ]),
366
+ _: 1
367
+ }, 8, ["open", "content"]);
368
+ };
369
+ }
370
+ });
371
+ const CkCopyMessageActionButton = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-141343e6"]]);
200
372
  const defaultMarkdownClasses = {
201
373
  p: "my-1 leading-7",
202
374
  a: "underline underline-offset-4",
@@ -291,14 +463,38 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
291
463
  };
292
464
  }
293
465
  });
294
- const _hoisted_1$3 = { class: "flex flex-col gap-2" };
466
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
467
+ ...{ name: "CkPromptStopButton" },
468
+ __name: "CkPromptStopButton",
469
+ props: {
470
+ ariaLabel: { default: "Stop generating" },
471
+ disabled: { type: Boolean, default: false }
472
+ },
473
+ emits: ["click"],
474
+ setup(__props) {
475
+ const props = __props;
476
+ return (_ctx, _cache) => {
477
+ return openBlock(), createBlock(unref(UiIconButton), mergeProps({ ariaLabel: __props.ariaLabel }, {
478
+ disabled: props.disabled,
479
+ class: "!bg-brand-bg-brand hover:!bg-brand-bg-brand-hover !text-brand-content-default !rounded-md",
480
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("click", $event))
481
+ }), {
482
+ default: withCtx(() => [
483
+ renderSlot(_ctx.$slots, "default")
484
+ ]),
485
+ _: 3
486
+ }, 16, ["disabled"]);
487
+ };
488
+ }
489
+ });
490
+ const _hoisted_1$2 = { class: "flex flex-col gap-2" };
295
491
  const _hoisted_2$1 = ["for"];
296
492
  const _hoisted_3 = ["id", "value", "placeholder", "disabled"];
297
493
  const _hoisted_4 = { class: "flex items-center justify-between" };
298
494
  const _hoisted_5 = { key: 0 };
299
495
  const _hoisted_6 = { key: 1 };
300
496
  const _hoisted_7 = { class: "ml-auto" };
301
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
497
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
302
498
  ...{ name: "CkPromptInput" },
303
499
  __name: "CkPromptInput",
304
500
  props: {
@@ -350,7 +546,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
350
546
  );
351
547
  __expose({ focus, submit });
352
548
  return (_ctx, _cache) => {
353
- return openBlock(), createElementBlock("div", _hoisted_1$3, [
549
+ return openBlock(), createElementBlock("div", _hoisted_1$2, [
354
550
  createElementVNode("form", {
355
551
  class: "border-core-border-default bg-core-bg-primary [&:has(textarea:focus)]:ring-core-border-focus flex flex-col gap-3 rounded-xl border px-4 pt-3 pb-3 shadow-sm [&:has(textarea:focus)]:ring-2",
356
552
  onSubmit: withModifiers(submit, ["prevent"])
@@ -390,11 +586,11 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
390
586
  };
391
587
  }
392
588
  });
393
- const _hoisted_1$2 = {
589
+ const _hoisted_1$1 = {
394
590
  key: 0,
395
591
  class: "text-core-content-tertiary text-center text-xs leading-3.5"
396
592
  };
397
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
593
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
398
594
  ...{ name: "CkPromptInputDisclaimer" },
399
595
  __name: "CkPromptInputDisclaimer",
400
596
  props: {
@@ -402,7 +598,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
402
598
  },
403
599
  setup(__props) {
404
600
  return (_ctx, _cache) => {
405
- return _ctx.$slots.default || __props.text ? (openBlock(), createElementBlock("p", _hoisted_1$2, [
601
+ return _ctx.$slots.default || __props.text ? (openBlock(), createElementBlock("p", _hoisted_1$1, [
406
602
  renderSlot(_ctx.$slots, "default", {}, () => [
407
603
  createTextVNode(toDisplayString(__props.text), 1)
408
604
  ])
@@ -410,9 +606,9 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
410
606
  };
411
607
  }
412
608
  });
413
- const _hoisted_1$1 = { class: "bg-background-surface-primary inline-flex max-w-[600px] flex-col items-end justify-start gap-4 rounded-xl p-6" };
609
+ const _hoisted_1 = { class: "bg-background-surface-primary inline-flex max-w-[600px] flex-col items-end justify-start gap-4 rounded-xl p-6" };
414
610
  const _hoisted_2 = { class: "text-content-on-surface-primary justify-start self-stretch text-base leading-6 font-normal" };
415
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
611
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
416
612
  ...{ name: "CkUserMessage" },
417
613
  __name: "CkUserMessage",
418
614
  props: {
@@ -420,7 +616,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
420
616
  },
421
617
  setup(__props) {
422
618
  return (_ctx, _cache) => {
423
- return openBlock(), createElementBlock("div", _hoisted_1$1, [
619
+ return openBlock(), createElementBlock("div", _hoisted_1, [
424
620
  createElementVNode("div", _hoisted_2, [
425
621
  renderSlot(_ctx.$slots, "default", {}, () => [
426
622
  createTextVNode(toDisplayString(__props.message), 1)
@@ -430,7 +626,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
430
626
  };
431
627
  }
432
628
  });
433
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
629
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
434
630
  ...{ name: "CkConversation" },
435
631
  __name: "CkConversation",
436
632
  props: {
@@ -449,13 +645,13 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
449
645
  );
450
646
  const isLoading = (message) => message.status === "started" || message.status === "sending";
451
647
  return (_ctx, _cache) => {
452
- return openBlock(), createBlock(_sfc_main$8, { messages: __props.messages }, {
648
+ return openBlock(), createBlock(_sfc_main$a, { messages: __props.messages }, {
453
649
  "user-message": withCtx(({ message }) => [
454
650
  createElementVNode("div", {
455
651
  class: normalizeClass({ "ml-8": hasIcon.value })
456
652
  }, [
457
653
  renderSlot(_ctx.$slots, "user-message", { message }, () => [
458
- createVNode(_sfc_main$3, {
654
+ createVNode(_sfc_main$2, {
459
655
  message: message.content
460
656
  }, {
461
657
  default: withCtx(() => [
@@ -470,7 +666,17 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
470
666
  ]),
471
667
  "agent-message": withCtx(({ message }) => [
472
668
  renderSlot(_ctx.$slots, "agent-message", { message }, () => [
473
- createVNode(_sfc_main$9, null, createSlots({
669
+ createVNode(_sfc_main$b, null, createSlots({
670
+ footer: withCtx(() => [
671
+ renderSlot(_ctx.$slots, "agent-message-footer", { message }, () => [
672
+ message.content && !isLoading(message) ? (openBlock(), createBlock(CkCopyMessageActionButton, {
673
+ key: 0,
674
+ text: message.content,
675
+ "aria-label-copy": unref(labels).copyMessageAction,
676
+ "aria-label-copied": unref(labels).copyMessageActionCopied
677
+ }, null, 8, ["text", "aria-label-copy", "aria-label-copied"])) : createCommentVNode("", true)
678
+ ])
679
+ ]),
474
680
  default: withCtx(() => [
475
681
  renderSlot(_ctx.$slots, "agent-message-content", { message }, () => [
476
682
  createVNode(_sfc_main$7, {
@@ -542,13 +748,6 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
542
748
  renderSlot(_ctx.$slots, "agent-message-header", { message })
543
749
  ]),
544
750
  key: "1"
545
- } : void 0,
546
- _ctx.$slots["agent-message-footer"] ? {
547
- name: "footer",
548
- fn: withCtx(() => [
549
- renderSlot(_ctx.$slots, "agent-message-footer", { message })
550
- ]),
551
- key: "2"
552
751
  } : void 0
553
752
  ]), 1024)
554
753
  ])
@@ -558,29 +757,6 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
558
757
  };
559
758
  }
560
759
  });
561
- const _hoisted_1 = {
562
- xmlns: "http://www.w3.org/2000/svg",
563
- width: "16",
564
- height: "16",
565
- viewBox: "0 0 24 24",
566
- fill: "none",
567
- stroke: "currentColor",
568
- "stroke-width": "2",
569
- "stroke-linecap": "round",
570
- "stroke-linejoin": "round"
571
- };
572
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
573
- ...{ name: "CkSendIcon" },
574
- __name: "CkSendIcon",
575
- setup(__props) {
576
- return (_ctx, _cache) => {
577
- return openBlock(), createElementBlock("svg", _hoisted_1, [..._cache[0] || (_cache[0] = [
578
- createElementVNode("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" }, null, -1),
579
- createElementVNode("path", { d: "M6 12h16" }, null, -1)
580
- ])]);
581
- };
582
- }
583
- });
584
760
  const _sfc_main = /* @__PURE__ */ defineComponent({
585
761
  ...{ name: "CkInput" },
586
762
  __name: "CkInput",
@@ -591,9 +767,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
591
767
  loading: { type: Boolean, default: false },
592
768
  maxHeight: { default: 200 },
593
769
  ariaLabel: { default: "Chat message input" },
770
+ stopAriaLabel: { default: "Stop generating" },
594
771
  disclaimer: { default: void 0 }
595
772
  },
596
- emits: ["update:modelValue", "submit"],
773
+ emits: ["update:modelValue", "submit", "stop"],
597
774
  setup(__props, { expose: __expose, emit: __emit }) {
598
775
  const props = __props;
599
776
  const emit = __emit;
@@ -605,6 +782,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
605
782
  function onSubmit(value) {
606
783
  emit("submit", value);
607
784
  }
785
+ function onStop() {
786
+ emit("stop");
787
+ }
608
788
  function focus() {
609
789
  promptInputRef.value?.focus();
610
790
  }
@@ -613,7 +793,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
613
793
  }
614
794
  __expose({ focus, submit });
615
795
  return (_ctx, _cache) => {
616
- return openBlock(), createBlock(_sfc_main$5, {
796
+ return openBlock(), createBlock(_sfc_main$4, {
617
797
  ref_key: "promptInputRef",
618
798
  ref: promptInputRef,
619
799
  "model-value": __props.modelValue,
@@ -626,23 +806,34 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
626
806
  }, createSlots({
627
807
  "toolbar-right": withCtx((scope) => [
628
808
  renderSlot(_ctx.$slots, "toolbar-right", normalizeProps(guardReactiveProps(scope)), () => [
629
- createVNode(_sfc_main$6, mergeProps({ ariaLabel: "Send message" }, {
809
+ __props.loading ? (openBlock(), createBlock(_sfc_main$5, {
810
+ key: 0,
811
+ "aria-label": __props.stopAriaLabel,
812
+ disabled: __props.disabled,
813
+ onClick: onStop
814
+ }, {
815
+ default: withCtx(() => [
816
+ renderSlot(_ctx.$slots, "stop-icon", {}, () => [
817
+ createVNode(_sfc_main$c)
818
+ ])
819
+ ]),
820
+ _: 3
821
+ }, 8, ["aria-label", "disabled"])) : (openBlock(), createBlock(_sfc_main$6, mergeProps({ key: 1 }, { ariaLabel: "Send message" }, {
630
822
  type: "submit",
631
- disabled: scope.disabled,
632
- loading: __props.loading
823
+ disabled: scope.disabled
633
824
  }), {
634
825
  default: withCtx(() => [
635
826
  renderSlot(_ctx.$slots, "send-icon", {}, () => [
636
- createVNode(_sfc_main$1)
827
+ createVNode(_sfc_main$d)
637
828
  ])
638
829
  ]),
639
830
  _: 3
640
- }, 16, ["disabled", "loading"])
831
+ }, 16, ["disabled"]))
641
832
  ])
642
833
  ]),
643
834
  footer: withCtx(() => [
644
835
  renderSlot(_ctx.$slots, "footer", {}, () => [
645
- __props.disclaimer ? (openBlock(), createBlock(_sfc_main$4, {
836
+ __props.disclaimer ? (openBlock(), createBlock(_sfc_main$3, {
646
837
  key: 0,
647
838
  text: __props.disclaimer
648
839
  }, null, 8, ["text"])) : createCommentVNode("", true)
@@ -662,13 +853,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
662
853
  }
663
854
  });
664
855
  export {
665
- _sfc_main$9 as _,
666
- _sfc_main$2 as a,
667
- _sfc_main$8 as b,
856
+ CkCopyMessageActionButton as C,
857
+ _sfc_main$b as _,
858
+ _sfc_main$1 as a,
859
+ _sfc_main$a as b,
668
860
  _sfc_main as c,
669
861
  _sfc_main$7 as d,
670
- _sfc_main$6 as e,
671
- _sfc_main$5 as f,
862
+ CkMessageActionButton as e,
863
+ _sfc_main$6 as f,
672
864
  _sfc_main$4 as g,
673
- _sfc_main$3 as h
865
+ _sfc_main$3 as h,
866
+ _sfc_main$5 as i,
867
+ _sfc_main$d as j,
868
+ _sfc_main$c as k,
869
+ _sfc_main$2 as l
674
870
  };
@@ -0,0 +1,20 @@
1
+
2
+ /* Ghost buttons inject a dark v-hover overlay; suppress it so token bg/border show through. */
3
+ .message-action-button[data-v-ee7595cc] .v-hover-overlay {
4
+ opacity: 0 !important;
5
+ }
6
+
7
+ .copy-message-icon-fade-enter-active[data-v-141343e6],
8
+ .copy-message-icon-fade-leave-active[data-v-141343e6] {
9
+ transition: opacity 0.15s ease-out;
10
+ }
11
+ .copy-message-icon-fade-enter-from[data-v-141343e6],
12
+ .copy-message-icon-fade-leave-to[data-v-141343e6] {
13
+ opacity: 0;
14
+ }
15
+ @media (prefers-reduced-motion: reduce) {
16
+ .copy-message-icon-fade-enter-active[data-v-141343e6],
17
+ .copy-message-icon-fade-leave-active[data-v-141343e6] {
18
+ transition-duration: 0.01ms;
19
+ }
20
+ }
@@ -0,0 +1,8 @@
1
+ import CkCopyMessageActionButton from './CkCopyMessageActionButton.vue';
2
+ import type { Meta, StoryObj } from '@storybook/vue3-vite';
3
+ declare const meta: Meta<typeof CkCopyMessageActionButton>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof meta>;
6
+ export declare const Default: Story;
7
+ export declare const Disabled: Story;
8
+ //# sourceMappingURL=CkCopyMessageActionButton.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CkCopyMessageActionButton.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkCopyMessageActionButton/CkCopyMessageActionButton.stories.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE3D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,yBAAyB,CAShD,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAIrB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAKtB,CAAC"}
@@ -0,0 +1,31 @@
1
+ type __VLS_Props = {
2
+ /** Plain text to copy to the clipboard */
3
+ text: string;
4
+ disabled?: boolean;
5
+ /** How long to show the checkmark before reverting (ms) */
6
+ durationMs?: number;
7
+ ariaLabelCopy?: string;
8
+ ariaLabelCopied?: string;
9
+ /**
10
+ * Optional writer (e.g. tests). When omitted, uses `navigator.clipboard.writeText`.
11
+ */
12
+ writeToClipboard?: (text: string) => Promise<void>;
13
+ };
14
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
15
+ copy: (payload: {
16
+ success: boolean;
17
+ }) => any;
18
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
19
+ onCopy?: ((payload: {
20
+ success: boolean;
21
+ }) => any) | undefined;
22
+ }>, {
23
+ disabled: boolean;
24
+ durationMs: number;
25
+ ariaLabelCopy: string;
26
+ ariaLabelCopied: string;
27
+ writeToClipboard: (text: string) => Promise<void>;
28
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
29
+ declare const _default: typeof __VLS_export;
30
+ export default _default;
31
+ //# sourceMappingURL=CkCopyMessageActionButton.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CkCopyMessageActionButton.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkCopyMessageActionButton/CkCopyMessageActionButton.vue"],"names":[],"mappings":"AAgIE,KAAK,WAAW,GAAG;IACf,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACpD,CAAC;AAyMN,QAAA,MAAM,YAAY;;iBA5La,OAAO;;;;iBAAP,OAAO;;;cAtBrB,OAAO;gBAEL,MAAM;mBACH,MAAM;qBACJ,MAAM;sBAIL,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC;6EA8MtD,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -0,0 +1,2 @@
1
+ export { default as CkCopyMessageActionButton } from './CkCopyMessageActionButton.vue';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkCopyMessageActionButton/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,iCAAiC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import CkMessageActionButton from './CkMessageActionButton.vue';
2
+ import type { Meta, StoryObj } from '@storybook/vue3-vite';
3
+ declare const meta: Meta<typeof CkMessageActionButton>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof meta>;
6
+ export declare const Default: Story;
7
+ //# sourceMappingURL=CkMessageActionButton.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CkMessageActionButton.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkMessageActionButton/CkMessageActionButton.stories.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAG3D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,qBAAqB,CAS5C,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KASrB,CAAC"}
@@ -0,0 +1,20 @@
1
+ type __VLS_Props = {
2
+ ariaLabel: string;
3
+ disabled?: boolean;
4
+ };
5
+ declare var __VLS_8: {};
6
+ type __VLS_Slots = {} & {
7
+ default?: (props: typeof __VLS_8) => any;
8
+ };
9
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
10
+ disabled: boolean;
11
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
13
+ declare const _default: typeof __VLS_export;
14
+ export default _default;
15
+ type __VLS_WithSlots<T, S> = T & {
16
+ new (): {
17
+ $slots: S;
18
+ };
19
+ };
20
+ //# sourceMappingURL=CkMessageActionButton.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CkMessageActionButton.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkMessageActionButton/CkMessageActionButton.vue"],"names":[],"mappings":"AA4CE,KAAK,WAAW,GAAG;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAkEN,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;cA1EC,OAAO;6EA6EtB,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,2 @@
1
+ export { default as CkMessageActionButton } from './CkMessageActionButton.vue';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkMessageActionButton/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,6BAA6B,CAAC"}
@@ -9,8 +9,8 @@ type __VLS_Slots = {} & {
9
9
  default?: (props: typeof __VLS_8) => any;
10
10
  };
11
11
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
12
- type: "button" | "submit";
13
12
  disabled: boolean;
13
+ type: "button" | "submit";
14
14
  loading: boolean;
15
15
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
16
16
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -1 +1 @@
1
- {"version":3,"file":"CkPromptActionButton.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkPromptActionButton/CkPromptActionButton.vue"],"names":[],"mappings":"AAuCE,KAAK,WAAW,GAAG;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAC5B,CAAC;AAgEN,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;UAxEH,QAAQ,GAAG,QAAQ;cAFf,OAAO;aACR,OAAO;6EA4ErB,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
+ {"version":3,"file":"CkPromptActionButton.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkPromptActionButton/CkPromptActionButton.vue"],"names":[],"mappings":"AAuCE,KAAK,WAAW,GAAG;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAC5B,CAAC;AAgEN,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;cA1EC,OAAO;UAEX,QAAQ,GAAG,QAAQ;aADhB,OAAO;6EA4ErB,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,8 @@
1
+ import CkPromptStopButton from './CkPromptStopButton.vue';
2
+ import type { Meta, StoryObj } from '@storybook/vue3-vite';
3
+ declare const meta: Meta<typeof CkPromptStopButton>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof meta>;
6
+ export declare const Default: Story;
7
+ export declare const Disabled: Story;
8
+ //# sourceMappingURL=CkPromptStopButton.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CkPromptStopButton.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkPromptStopButton/CkPromptStopButton.stories.ts"],"names":[],"mappings":"AACA,OAAO,kBAAkB,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE3D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,kBAAkB,CASzC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KASrB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAStB,CAAC"}
@@ -0,0 +1,25 @@
1
+ type __VLS_Props = {
2
+ ariaLabel?: string;
3
+ disabled?: boolean;
4
+ };
5
+ declare var __VLS_10: {};
6
+ type __VLS_Slots = {} & {
7
+ default?: (props: typeof __VLS_10) => any;
8
+ };
9
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
10
+ click: (event: MouseEvent) => any;
11
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
12
+ onClick?: ((event: MouseEvent) => any) | undefined;
13
+ }>, {
14
+ ariaLabel: string;
15
+ disabled: boolean;
16
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
17
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
18
+ declare const _default: typeof __VLS_export;
19
+ export default _default;
20
+ type __VLS_WithSlots<T, S> = T & {
21
+ new (): {
22
+ $slots: S;
23
+ };
24
+ };
25
+ //# sourceMappingURL=CkPromptStopButton.vue.d.ts.map