@copilotkitnext/react 1.52.0-next.5 → 1.52.0-next.6

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 (127) hide show
  1. package/dist/components/WildcardToolCallRender.cjs +13 -13
  2. package/dist/components/WildcardToolCallRender.cjs.map +1 -1
  3. package/dist/components/WildcardToolCallRender.mjs +13 -13
  4. package/dist/components/WildcardToolCallRender.mjs.map +1 -1
  5. package/dist/components/chat/CopilotChat.cjs.map +1 -1
  6. package/dist/components/chat/CopilotChat.mjs.map +1 -1
  7. package/dist/components/chat/CopilotChatAssistantMessage.cjs +36 -28
  8. package/dist/components/chat/CopilotChatAssistantMessage.cjs.map +1 -1
  9. package/dist/components/chat/CopilotChatAssistantMessage.mjs +37 -29
  10. package/dist/components/chat/CopilotChatAssistantMessage.mjs.map +1 -1
  11. package/dist/components/chat/CopilotChatAudioRecorder.cjs +2 -2
  12. package/dist/components/chat/CopilotChatAudioRecorder.cjs.map +1 -1
  13. package/dist/components/chat/CopilotChatAudioRecorder.mjs +2 -2
  14. package/dist/components/chat/CopilotChatAudioRecorder.mjs.map +1 -1
  15. package/dist/components/chat/CopilotChatInput.cjs +59 -51
  16. package/dist/components/chat/CopilotChatInput.cjs.map +1 -1
  17. package/dist/components/chat/CopilotChatInput.d.cts.map +1 -1
  18. package/dist/components/chat/CopilotChatInput.d.mts.map +1 -1
  19. package/dist/components/chat/CopilotChatInput.mjs +59 -51
  20. package/dist/components/chat/CopilotChatInput.mjs.map +1 -1
  21. package/dist/components/chat/CopilotChatMessageView.cjs +12 -7
  22. package/dist/components/chat/CopilotChatMessageView.cjs.map +1 -1
  23. package/dist/components/chat/CopilotChatMessageView.d.cts.map +1 -1
  24. package/dist/components/chat/CopilotChatMessageView.d.mts.map +1 -1
  25. package/dist/components/chat/CopilotChatMessageView.mjs +12 -7
  26. package/dist/components/chat/CopilotChatMessageView.mjs.map +1 -1
  27. package/dist/components/chat/CopilotChatReasoningMessage.cjs +24 -20
  28. package/dist/components/chat/CopilotChatReasoningMessage.cjs.map +1 -1
  29. package/dist/components/chat/CopilotChatReasoningMessage.d.cts.map +1 -1
  30. package/dist/components/chat/CopilotChatReasoningMessage.d.mts.map +1 -1
  31. package/dist/components/chat/CopilotChatReasoningMessage.mjs +25 -21
  32. package/dist/components/chat/CopilotChatReasoningMessage.mjs.map +1 -1
  33. package/dist/components/chat/CopilotChatSuggestionPill.cjs +6 -5
  34. package/dist/components/chat/CopilotChatSuggestionPill.cjs.map +1 -1
  35. package/dist/components/chat/CopilotChatSuggestionPill.mjs +6 -5
  36. package/dist/components/chat/CopilotChatSuggestionPill.mjs.map +1 -1
  37. package/dist/components/chat/CopilotChatSuggestionView.cjs +24 -12
  38. package/dist/components/chat/CopilotChatSuggestionView.cjs.map +1 -1
  39. package/dist/components/chat/CopilotChatSuggestionView.d.cts.map +1 -1
  40. package/dist/components/chat/CopilotChatSuggestionView.d.mts.map +1 -1
  41. package/dist/components/chat/CopilotChatSuggestionView.mjs +25 -13
  42. package/dist/components/chat/CopilotChatSuggestionView.mjs.map +1 -1
  43. package/dist/components/chat/CopilotChatToggleButton.cjs +7 -6
  44. package/dist/components/chat/CopilotChatToggleButton.cjs.map +1 -1
  45. package/dist/components/chat/CopilotChatToggleButton.d.cts.map +1 -1
  46. package/dist/components/chat/CopilotChatToggleButton.d.mts.map +1 -1
  47. package/dist/components/chat/CopilotChatToggleButton.mjs +7 -6
  48. package/dist/components/chat/CopilotChatToggleButton.mjs.map +1 -1
  49. package/dist/components/chat/CopilotChatUserMessage.cjs +29 -24
  50. package/dist/components/chat/CopilotChatUserMessage.cjs.map +1 -1
  51. package/dist/components/chat/CopilotChatUserMessage.d.cts.map +1 -1
  52. package/dist/components/chat/CopilotChatUserMessage.d.mts.map +1 -1
  53. package/dist/components/chat/CopilotChatUserMessage.mjs +30 -25
  54. package/dist/components/chat/CopilotChatUserMessage.mjs.map +1 -1
  55. package/dist/components/chat/CopilotChatView.cjs +45 -35
  56. package/dist/components/chat/CopilotChatView.cjs.map +1 -1
  57. package/dist/components/chat/CopilotChatView.d.cts +1 -1
  58. package/dist/components/chat/CopilotChatView.d.cts.map +1 -1
  59. package/dist/components/chat/CopilotChatView.d.mts +1 -1
  60. package/dist/components/chat/CopilotChatView.d.mts.map +1 -1
  61. package/dist/components/chat/CopilotChatView.mjs +45 -35
  62. package/dist/components/chat/CopilotChatView.mjs.map +1 -1
  63. package/dist/components/chat/CopilotModalHeader.cjs +8 -8
  64. package/dist/components/chat/CopilotModalHeader.cjs.map +1 -1
  65. package/dist/components/chat/CopilotModalHeader.d.cts.map +1 -1
  66. package/dist/components/chat/CopilotModalHeader.d.mts.map +1 -1
  67. package/dist/components/chat/CopilotModalHeader.mjs +8 -8
  68. package/dist/components/chat/CopilotModalHeader.mjs.map +1 -1
  69. package/dist/components/chat/CopilotPopupView.cjs +20 -15
  70. package/dist/components/chat/CopilotPopupView.cjs.map +1 -1
  71. package/dist/components/chat/CopilotPopupView.d.cts.map +1 -1
  72. package/dist/components/chat/CopilotPopupView.d.mts.map +1 -1
  73. package/dist/components/chat/CopilotPopupView.mjs +20 -15
  74. package/dist/components/chat/CopilotPopupView.mjs.map +1 -1
  75. package/dist/components/chat/CopilotSidebarView.cjs +54 -43
  76. package/dist/components/chat/CopilotSidebarView.cjs.map +1 -1
  77. package/dist/components/chat/CopilotSidebarView.d.cts.map +1 -1
  78. package/dist/components/chat/CopilotSidebarView.d.mts.map +1 -1
  79. package/dist/components/chat/CopilotSidebarView.mjs +55 -44
  80. package/dist/components/chat/CopilotSidebarView.mjs.map +1 -1
  81. package/dist/components/ui/button.cjs +42 -42
  82. package/dist/components/ui/button.cjs.map +1 -1
  83. package/dist/components/ui/button.mjs +42 -42
  84. package/dist/components/ui/button.mjs.map +1 -1
  85. package/dist/components/ui/dropdown-menu.cjs +7 -6
  86. package/dist/components/ui/dropdown-menu.cjs.map +1 -1
  87. package/dist/components/ui/dropdown-menu.mjs +7 -6
  88. package/dist/components/ui/dropdown-menu.mjs.map +1 -1
  89. package/dist/components/ui/tooltip.cjs +3 -2
  90. package/dist/components/ui/tooltip.cjs.map +1 -1
  91. package/dist/components/ui/tooltip.mjs +3 -2
  92. package/dist/components/ui/tooltip.mjs.map +1 -1
  93. package/dist/hooks/use-component.cjs +18 -5
  94. package/dist/hooks/use-component.cjs.map +1 -1
  95. package/dist/hooks/use-component.d.cts +21 -7
  96. package/dist/hooks/use-component.d.cts.map +1 -1
  97. package/dist/hooks/use-component.d.mts +21 -7
  98. package/dist/hooks/use-component.d.mts.map +1 -1
  99. package/dist/hooks/use-component.mjs +18 -5
  100. package/dist/hooks/use-component.mjs.map +1 -1
  101. package/dist/hooks/use-default-render-tool.cjs +2 -2
  102. package/dist/hooks/use-default-render-tool.cjs.map +1 -1
  103. package/dist/hooks/use-default-render-tool.d.cts +3 -3
  104. package/dist/hooks/use-default-render-tool.d.cts.map +1 -1
  105. package/dist/hooks/use-default-render-tool.d.mts +3 -3
  106. package/dist/hooks/use-default-render-tool.d.mts.map +1 -1
  107. package/dist/hooks/use-default-render-tool.mjs +2 -2
  108. package/dist/hooks/use-default-render-tool.mjs.map +1 -1
  109. package/dist/hooks/use-render-tool.cjs +15 -9
  110. package/dist/hooks/use-render-tool.cjs.map +1 -1
  111. package/dist/hooks/use-render-tool.d.cts +9 -9
  112. package/dist/hooks/use-render-tool.d.cts.map +1 -1
  113. package/dist/hooks/use-render-tool.d.mts +9 -9
  114. package/dist/hooks/use-render-tool.d.mts.map +1 -1
  115. package/dist/hooks/use-render-tool.mjs +15 -9
  116. package/dist/hooks/use-render-tool.mjs.map +1 -1
  117. package/dist/index.umd.js +429 -339
  118. package/dist/index.umd.js.map +1 -1
  119. package/dist/lib/utils.cjs +2 -1
  120. package/dist/lib/utils.cjs.map +1 -1
  121. package/dist/lib/utils.mjs +3 -2
  122. package/dist/lib/utils.mjs.map +1 -1
  123. package/dist/styles.css +1 -1
  124. package/eslint-rules/README.md +52 -0
  125. package/eslint-rules/require-cpk-prefix.mjs +375 -0
  126. package/eslint.config.mjs +17 -0
  127. package/package.json +8 -7
@@ -6,12 +6,13 @@ let lucide_react = require("lucide-react");
6
6
  let react_jsx_runtime = require("react/jsx-runtime");
7
7
 
8
8
  //#region src/components/chat/CopilotChatSuggestionPill.tsx
9
- const baseClasses = "group inline-flex h-7 sm:h-8 items-center gap-1 sm:gap-1.5 rounded-full border border-border/60 bg-background px-2.5 sm:px-3 text-[11px] sm:text-xs leading-none text-foreground transition-colors cursor-pointer hover:bg-accent/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:text-muted-foreground disabled:hover:bg-background disabled:hover:text-muted-foreground pointer-events-auto";
10
- const labelClasses = "whitespace-nowrap font-medium leading-none";
9
+ const baseClasses = "group cpk:inline-flex cpk:h-7 cpk:sm:h-8 cpk:items-center cpk:gap-1 cpk:sm:gap-1.5 cpk:rounded-full cpk:border cpk:border-border/60 cpk:bg-background cpk:px-2.5 cpk:sm:px-3 cpk:text-[11px] cpk:sm:text-xs cpk:leading-none cpk:text-foreground cpk:transition-colors cpk:cursor-pointer cpk:hover:bg-accent/60 cpk:hover:text-foreground cpk:focus-visible:outline-none cpk:focus-visible:ring-2 cpk:focus-visible:ring-ring cpk:focus-visible:ring-offset-2 cpk:focus-visible:ring-offset-background cpk:disabled:cursor-not-allowed cpk:disabled:text-muted-foreground cpk:disabled:hover:bg-background cpk:disabled:hover:text-muted-foreground cpk:pointer-events-auto";
10
+ const labelClasses = "cpk:whitespace-nowrap cpk:font-medium cpk:leading-none";
11
11
  const CopilotChatSuggestionPill = react.default.forwardRef(function CopilotChatSuggestionPill({ className, children, icon, isLoading, type, ...props }, ref) {
12
12
  const showIcon = !isLoading && icon;
13
13
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
14
14
  ref,
15
+ "data-copilotkit": true,
15
16
  "data-slot": "suggestion-pill",
16
17
  className: require_utils.cn(baseClasses, className),
17
18
  type: type ?? "button",
@@ -19,13 +20,13 @@ const CopilotChatSuggestionPill = react.default.forwardRef(function CopilotChatS
19
20
  disabled: isLoading || props.disabled,
20
21
  ...props,
21
22
  children: [isLoading ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
22
- className: "flex h-3.5 sm:h-4 w-3.5 sm:w-4 items-center justify-center text-muted-foreground",
23
+ className: "cpk:flex cpk:h-3.5 cpk:sm:h-4 cpk:w-3.5 cpk:sm:w-4 cpk:items-center cpk:justify-center cpk:text-muted-foreground",
23
24
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Loader2, {
24
- className: "h-3.5 sm:h-4 w-3.5 sm:w-4 animate-spin",
25
+ className: "cpk:h-3.5 cpk:sm:h-4 cpk:w-3.5 cpk:sm:w-4 cpk:animate-spin",
25
26
  "aria-hidden": "true"
26
27
  })
27
28
  }) : showIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
28
- className: "flex h-3.5 sm:h-4 w-3.5 sm:w-4 items-center justify-center text-muted-foreground",
29
+ className: "cpk:flex cpk:h-3.5 cpk:sm:h-4 cpk:w-3.5 cpk:sm:w-4 cpk:items-center cpk:justify-center cpk:text-muted-foreground",
29
30
  children: icon
30
31
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
31
32
  className: labelClasses,
@@ -1 +1 @@
1
- {"version":3,"file":"CopilotChatSuggestionPill.cjs","names":["React","cn","Loader2"],"sources":["../../../src/components/chat/CopilotChatSuggestionPill.tsx"],"sourcesContent":["import React from \"react\";\nimport { Loader2 } from \"lucide-react\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface CopilotChatSuggestionPillProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Optional icon to render on the left side when not loading. */\n icon?: React.ReactNode;\n /** Whether the pill should display a loading spinner. */\n isLoading?: boolean;\n}\n\nconst baseClasses =\n \"group inline-flex h-7 sm:h-8 items-center gap-1 sm:gap-1.5 rounded-full border border-border/60 bg-background px-2.5 sm:px-3 text-[11px] sm:text-xs leading-none text-foreground transition-colors cursor-pointer hover:bg-accent/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:text-muted-foreground disabled:hover:bg-background disabled:hover:text-muted-foreground pointer-events-auto\";\n\nconst labelClasses = \"whitespace-nowrap font-medium leading-none\";\n\nexport const CopilotChatSuggestionPill = React.forwardRef<\n HTMLButtonElement,\n CopilotChatSuggestionPillProps\n>(function CopilotChatSuggestionPill(\n { className, children, icon, isLoading, type, ...props },\n ref,\n) {\n const showIcon = !isLoading && icon;\n\n return (\n <button\n ref={ref}\n data-slot=\"suggestion-pill\"\n className={cn(baseClasses, className)}\n type={type ?? \"button\"}\n aria-busy={isLoading || undefined}\n disabled={isLoading || props.disabled}\n {...props}\n >\n {isLoading ? (\n <span className=\"flex h-3.5 sm:h-4 w-3.5 sm:w-4 items-center justify-center text-muted-foreground\">\n <Loader2\n className=\"h-3.5 sm:h-4 w-3.5 sm:w-4 animate-spin\"\n aria-hidden=\"true\"\n />\n </span>\n ) : (\n showIcon && (\n <span className=\"flex h-3.5 sm:h-4 w-3.5 sm:w-4 items-center justify-center text-muted-foreground\">\n {icon}\n </span>\n )\n )}\n <span className={labelClasses}>{children}</span>\n </button>\n );\n});\n\nCopilotChatSuggestionPill.displayName = \"CopilotChatSuggestionPill\";\n\nexport default CopilotChatSuggestionPill;\n"],"mappings":";;;;;;;;AAWA,MAAM,cACJ;AAEF,MAAM,eAAe;AAErB,MAAa,4BAA4BA,cAAM,WAG7C,SAAS,0BACT,EAAE,WAAW,UAAU,MAAM,WAAW,MAAM,GAAG,SACjD,KACA;CACA,MAAM,WAAW,CAAC,aAAa;AAE/B,QACE,4CAAC;EACM;EACL,aAAU;EACV,WAAWC,iBAAG,aAAa,UAAU;EACrC,MAAM,QAAQ;EACd,aAAW,aAAa;EACxB,UAAU,aAAa,MAAM;EAC7B,GAAI;aAEH,YACC,2CAAC;GAAK,WAAU;aACd,2CAACC;IACC,WAAU;IACV,eAAY;KACZ;IACG,GAEP,YACE,2CAAC;GAAK,WAAU;aACb;IACI,EAGX,2CAAC;GAAK,WAAW;GAAe;IAAgB;GACzC;EAEX;AAEF,0BAA0B,cAAc"}
1
+ {"version":3,"file":"CopilotChatSuggestionPill.cjs","names":["React","cn","Loader2"],"sources":["../../../src/components/chat/CopilotChatSuggestionPill.tsx"],"sourcesContent":["import React from \"react\";\nimport { Loader2 } from \"lucide-react\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface CopilotChatSuggestionPillProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Optional icon to render on the left side when not loading. */\n icon?: React.ReactNode;\n /** Whether the pill should display a loading spinner. */\n isLoading?: boolean;\n}\n\nconst baseClasses =\n \"group cpk:inline-flex cpk:h-7 cpk:sm:h-8 cpk:items-center cpk:gap-1 cpk:sm:gap-1.5 cpk:rounded-full cpk:border cpk:border-border/60 cpk:bg-background cpk:px-2.5 cpk:sm:px-3 cpk:text-[11px] cpk:sm:text-xs cpk:leading-none cpk:text-foreground cpk:transition-colors cpk:cursor-pointer cpk:hover:bg-accent/60 cpk:hover:text-foreground cpk:focus-visible:outline-none cpk:focus-visible:ring-2 cpk:focus-visible:ring-ring cpk:focus-visible:ring-offset-2 cpk:focus-visible:ring-offset-background cpk:disabled:cursor-not-allowed cpk:disabled:text-muted-foreground cpk:disabled:hover:bg-background cpk:disabled:hover:text-muted-foreground cpk:pointer-events-auto\";\n\nconst labelClasses = \"cpk:whitespace-nowrap cpk:font-medium cpk:leading-none\";\n\nexport const CopilotChatSuggestionPill = React.forwardRef<\n HTMLButtonElement,\n CopilotChatSuggestionPillProps\n>(function CopilotChatSuggestionPill(\n { className, children, icon, isLoading, type, ...props },\n ref,\n) {\n const showIcon = !isLoading && icon;\n\n return (\n <button\n ref={ref}\n data-copilotkit\n data-slot=\"suggestion-pill\"\n className={cn(baseClasses, className)}\n type={type ?? \"button\"}\n aria-busy={isLoading || undefined}\n disabled={isLoading || props.disabled}\n {...props}\n >\n {isLoading ? (\n <span className=\"cpk:flex cpk:h-3.5 cpk:sm:h-4 cpk:w-3.5 cpk:sm:w-4 cpk:items-center cpk:justify-center cpk:text-muted-foreground\">\n <Loader2\n className=\"cpk:h-3.5 cpk:sm:h-4 cpk:w-3.5 cpk:sm:w-4 cpk:animate-spin\"\n aria-hidden=\"true\"\n />\n </span>\n ) : (\n showIcon && (\n <span className=\"cpk:flex cpk:h-3.5 cpk:sm:h-4 cpk:w-3.5 cpk:sm:w-4 cpk:items-center cpk:justify-center cpk:text-muted-foreground\">\n {icon}\n </span>\n )\n )}\n <span className={labelClasses}>{children}</span>\n </button>\n );\n});\n\nCopilotChatSuggestionPill.displayName = \"CopilotChatSuggestionPill\";\n\nexport default CopilotChatSuggestionPill;\n"],"mappings":";;;;;;;;AAWA,MAAM,cACJ;AAEF,MAAM,eAAe;AAErB,MAAa,4BAA4BA,cAAM,WAG7C,SAAS,0BACT,EAAE,WAAW,UAAU,MAAM,WAAW,MAAM,GAAG,SACjD,KACA;CACA,MAAM,WAAW,CAAC,aAAa;AAE/B,QACE,4CAAC;EACM;EACL;EACA,aAAU;EACV,WAAWC,iBAAG,aAAa,UAAU;EACrC,MAAM,QAAQ;EACd,aAAW,aAAa;EACxB,UAAU,aAAa,MAAM;EAC7B,GAAI;aAEH,YACC,2CAAC;GAAK,WAAU;aACd,2CAACC;IACC,WAAU;IACV,eAAY;KACZ;IACG,GAEP,YACE,2CAAC;GAAK,WAAU;aACb;IACI,EAGX,2CAAC;GAAK,WAAW;GAAe;IAAgB;GACzC;EAEX;AAEF,0BAA0B,cAAc"}
@@ -4,12 +4,13 @@ import { Loader2 } from "lucide-react";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
5
 
6
6
  //#region src/components/chat/CopilotChatSuggestionPill.tsx
7
- const baseClasses = "group inline-flex h-7 sm:h-8 items-center gap-1 sm:gap-1.5 rounded-full border border-border/60 bg-background px-2.5 sm:px-3 text-[11px] sm:text-xs leading-none text-foreground transition-colors cursor-pointer hover:bg-accent/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:text-muted-foreground disabled:hover:bg-background disabled:hover:text-muted-foreground pointer-events-auto";
8
- const labelClasses = "whitespace-nowrap font-medium leading-none";
7
+ const baseClasses = "group cpk:inline-flex cpk:h-7 cpk:sm:h-8 cpk:items-center cpk:gap-1 cpk:sm:gap-1.5 cpk:rounded-full cpk:border cpk:border-border/60 cpk:bg-background cpk:px-2.5 cpk:sm:px-3 cpk:text-[11px] cpk:sm:text-xs cpk:leading-none cpk:text-foreground cpk:transition-colors cpk:cursor-pointer cpk:hover:bg-accent/60 cpk:hover:text-foreground cpk:focus-visible:outline-none cpk:focus-visible:ring-2 cpk:focus-visible:ring-ring cpk:focus-visible:ring-offset-2 cpk:focus-visible:ring-offset-background cpk:disabled:cursor-not-allowed cpk:disabled:text-muted-foreground cpk:disabled:hover:bg-background cpk:disabled:hover:text-muted-foreground cpk:pointer-events-auto";
8
+ const labelClasses = "cpk:whitespace-nowrap cpk:font-medium cpk:leading-none";
9
9
  const CopilotChatSuggestionPill = React.forwardRef(function CopilotChatSuggestionPill({ className, children, icon, isLoading, type, ...props }, ref) {
10
10
  const showIcon = !isLoading && icon;
11
11
  return /* @__PURE__ */ jsxs("button", {
12
12
  ref,
13
+ "data-copilotkit": true,
13
14
  "data-slot": "suggestion-pill",
14
15
  className: cn(baseClasses, className),
15
16
  type: type ?? "button",
@@ -17,13 +18,13 @@ const CopilotChatSuggestionPill = React.forwardRef(function CopilotChatSuggestio
17
18
  disabled: isLoading || props.disabled,
18
19
  ...props,
19
20
  children: [isLoading ? /* @__PURE__ */ jsx("span", {
20
- className: "flex h-3.5 sm:h-4 w-3.5 sm:w-4 items-center justify-center text-muted-foreground",
21
+ className: "cpk:flex cpk:h-3.5 cpk:sm:h-4 cpk:w-3.5 cpk:sm:w-4 cpk:items-center cpk:justify-center cpk:text-muted-foreground",
21
22
  children: /* @__PURE__ */ jsx(Loader2, {
22
- className: "h-3.5 sm:h-4 w-3.5 sm:w-4 animate-spin",
23
+ className: "cpk:h-3.5 cpk:sm:h-4 cpk:w-3.5 cpk:sm:w-4 cpk:animate-spin",
23
24
  "aria-hidden": "true"
24
25
  })
25
26
  }) : showIcon && /* @__PURE__ */ jsx("span", {
26
- className: "flex h-3.5 sm:h-4 w-3.5 sm:w-4 items-center justify-center text-muted-foreground",
27
+ className: "cpk:flex cpk:h-3.5 cpk:sm:h-4 cpk:w-3.5 cpk:sm:w-4 cpk:items-center cpk:justify-center cpk:text-muted-foreground",
27
28
  children: icon
28
29
  }), /* @__PURE__ */ jsx("span", {
29
30
  className: labelClasses,
@@ -1 +1 @@
1
- {"version":3,"file":"CopilotChatSuggestionPill.mjs","names":[],"sources":["../../../src/components/chat/CopilotChatSuggestionPill.tsx"],"sourcesContent":["import React from \"react\";\nimport { Loader2 } from \"lucide-react\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface CopilotChatSuggestionPillProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Optional icon to render on the left side when not loading. */\n icon?: React.ReactNode;\n /** Whether the pill should display a loading spinner. */\n isLoading?: boolean;\n}\n\nconst baseClasses =\n \"group inline-flex h-7 sm:h-8 items-center gap-1 sm:gap-1.5 rounded-full border border-border/60 bg-background px-2.5 sm:px-3 text-[11px] sm:text-xs leading-none text-foreground transition-colors cursor-pointer hover:bg-accent/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:text-muted-foreground disabled:hover:bg-background disabled:hover:text-muted-foreground pointer-events-auto\";\n\nconst labelClasses = \"whitespace-nowrap font-medium leading-none\";\n\nexport const CopilotChatSuggestionPill = React.forwardRef<\n HTMLButtonElement,\n CopilotChatSuggestionPillProps\n>(function CopilotChatSuggestionPill(\n { className, children, icon, isLoading, type, ...props },\n ref,\n) {\n const showIcon = !isLoading && icon;\n\n return (\n <button\n ref={ref}\n data-slot=\"suggestion-pill\"\n className={cn(baseClasses, className)}\n type={type ?? \"button\"}\n aria-busy={isLoading || undefined}\n disabled={isLoading || props.disabled}\n {...props}\n >\n {isLoading ? (\n <span className=\"flex h-3.5 sm:h-4 w-3.5 sm:w-4 items-center justify-center text-muted-foreground\">\n <Loader2\n className=\"h-3.5 sm:h-4 w-3.5 sm:w-4 animate-spin\"\n aria-hidden=\"true\"\n />\n </span>\n ) : (\n showIcon && (\n <span className=\"flex h-3.5 sm:h-4 w-3.5 sm:w-4 items-center justify-center text-muted-foreground\">\n {icon}\n </span>\n )\n )}\n <span className={labelClasses}>{children}</span>\n </button>\n );\n});\n\nCopilotChatSuggestionPill.displayName = \"CopilotChatSuggestionPill\";\n\nexport default CopilotChatSuggestionPill;\n"],"mappings":";;;;;;AAWA,MAAM,cACJ;AAEF,MAAM,eAAe;AAErB,MAAa,4BAA4B,MAAM,WAG7C,SAAS,0BACT,EAAE,WAAW,UAAU,MAAM,WAAW,MAAM,GAAG,SACjD,KACA;CACA,MAAM,WAAW,CAAC,aAAa;AAE/B,QACE,qBAAC;EACM;EACL,aAAU;EACV,WAAW,GAAG,aAAa,UAAU;EACrC,MAAM,QAAQ;EACd,aAAW,aAAa;EACxB,UAAU,aAAa,MAAM;EAC7B,GAAI;aAEH,YACC,oBAAC;GAAK,WAAU;aACd,oBAAC;IACC,WAAU;IACV,eAAY;KACZ;IACG,GAEP,YACE,oBAAC;GAAK,WAAU;aACb;IACI,EAGX,oBAAC;GAAK,WAAW;GAAe;IAAgB;GACzC;EAEX;AAEF,0BAA0B,cAAc"}
1
+ {"version":3,"file":"CopilotChatSuggestionPill.mjs","names":[],"sources":["../../../src/components/chat/CopilotChatSuggestionPill.tsx"],"sourcesContent":["import React from \"react\";\nimport { Loader2 } from \"lucide-react\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface CopilotChatSuggestionPillProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Optional icon to render on the left side when not loading. */\n icon?: React.ReactNode;\n /** Whether the pill should display a loading spinner. */\n isLoading?: boolean;\n}\n\nconst baseClasses =\n \"group cpk:inline-flex cpk:h-7 cpk:sm:h-8 cpk:items-center cpk:gap-1 cpk:sm:gap-1.5 cpk:rounded-full cpk:border cpk:border-border/60 cpk:bg-background cpk:px-2.5 cpk:sm:px-3 cpk:text-[11px] cpk:sm:text-xs cpk:leading-none cpk:text-foreground cpk:transition-colors cpk:cursor-pointer cpk:hover:bg-accent/60 cpk:hover:text-foreground cpk:focus-visible:outline-none cpk:focus-visible:ring-2 cpk:focus-visible:ring-ring cpk:focus-visible:ring-offset-2 cpk:focus-visible:ring-offset-background cpk:disabled:cursor-not-allowed cpk:disabled:text-muted-foreground cpk:disabled:hover:bg-background cpk:disabled:hover:text-muted-foreground cpk:pointer-events-auto\";\n\nconst labelClasses = \"cpk:whitespace-nowrap cpk:font-medium cpk:leading-none\";\n\nexport const CopilotChatSuggestionPill = React.forwardRef<\n HTMLButtonElement,\n CopilotChatSuggestionPillProps\n>(function CopilotChatSuggestionPill(\n { className, children, icon, isLoading, type, ...props },\n ref,\n) {\n const showIcon = !isLoading && icon;\n\n return (\n <button\n ref={ref}\n data-copilotkit\n data-slot=\"suggestion-pill\"\n className={cn(baseClasses, className)}\n type={type ?? \"button\"}\n aria-busy={isLoading || undefined}\n disabled={isLoading || props.disabled}\n {...props}\n >\n {isLoading ? (\n <span className=\"cpk:flex cpk:h-3.5 cpk:sm:h-4 cpk:w-3.5 cpk:sm:w-4 cpk:items-center cpk:justify-center cpk:text-muted-foreground\">\n <Loader2\n className=\"cpk:h-3.5 cpk:sm:h-4 cpk:w-3.5 cpk:sm:w-4 cpk:animate-spin\"\n aria-hidden=\"true\"\n />\n </span>\n ) : (\n showIcon && (\n <span className=\"cpk:flex cpk:h-3.5 cpk:sm:h-4 cpk:w-3.5 cpk:sm:w-4 cpk:items-center cpk:justify-center cpk:text-muted-foreground\">\n {icon}\n </span>\n )\n )}\n <span className={labelClasses}>{children}</span>\n </button>\n );\n});\n\nCopilotChatSuggestionPill.displayName = \"CopilotChatSuggestionPill\";\n\nexport default CopilotChatSuggestionPill;\n"],"mappings":";;;;;;AAWA,MAAM,cACJ;AAEF,MAAM,eAAe;AAErB,MAAa,4BAA4B,MAAM,WAG7C,SAAS,0BACT,EAAE,WAAW,UAAU,MAAM,WAAW,MAAM,GAAG,SACjD,KACA;CACA,MAAM,WAAW,CAAC,aAAa;AAE/B,QACE,qBAAC;EACM;EACL;EACA,aAAU;EACV,WAAW,GAAG,aAAa,UAAU;EACrC,MAAM,QAAQ;EACd,aAAW,aAAa;EACxB,UAAU,aAAa,MAAM;EAC7B,GAAI;aAEH,YACC,oBAAC;GAAK,WAAU;aACd,oBAAC;IACC,WAAU;IACV,eAAY;KACZ;IACG,GAEP,YACE,oBAAC;GAAK,WAAU;aACb;IACI,EAGX,oBAAC;GAAK,WAAW;GAAe;IAAgB;GACzC;EAEX;AAEF,0BAA0B,cAAc"}
@@ -10,7 +10,8 @@ let react_jsx_runtime = require("react/jsx-runtime");
10
10
  const DefaultContainer = react.default.forwardRef(function DefaultContainer({ className, ...props }, ref) {
11
11
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
12
12
  ref,
13
- className: require_utils.cn("flex flex-wrap items-center gap-1.5 sm:gap-2 pl-0 pr-4 sm:px-0 pointer-events-none", className),
13
+ "data-copilotkit": true,
14
+ className: require_utils.cn("cpk:flex cpk:flex-wrap cpk:items-center cpk:gap-1.5 cpk:sm:gap-2 cpk:pl-0 cpk:pr-4 cpk:sm:px-0 cpk:pointer-events-none", className),
14
15
  ...props
15
16
  });
16
17
  });
@@ -35,20 +36,31 @@ const CopilotChatSuggestionView = react.default.forwardRef(function CopilotChatS
35
36
  return react.default.cloneElement(pill, { key: `${suggestion.title}-${index}` });
36
37
  });
37
38
  const boundContainer = react.default.cloneElement(ContainerElement, void 0, suggestionElements);
38
- if (typeof children === "function") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: children({
39
- container: boundContainer,
40
- suggestion: require_slots.renderSlot(suggestionSlot, require_CopilotChatSuggestionPill.default, {
39
+ if (typeof children === "function") {
40
+ const sampleSuggestion = require_slots.renderSlot(suggestionSlot, require_CopilotChatSuggestionPill.default, {
41
41
  children: suggestions[0]?.title ?? "",
42
42
  isLoading: suggestions.length > 0 ? loadingSet.has(0) || suggestions[0]?.isLoading === true : false,
43
43
  type: "button"
44
- }),
45
- suggestions,
46
- onSelectSuggestion,
47
- loadingIndexes,
48
- className,
49
- ...restProps
50
- }) });
51
- if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [boundContainer, children] });
44
+ });
45
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
46
+ "data-copilotkit": true,
47
+ style: { display: "contents" },
48
+ children: children({
49
+ container: boundContainer,
50
+ suggestion: sampleSuggestion,
51
+ suggestions,
52
+ onSelectSuggestion,
53
+ loadingIndexes,
54
+ className,
55
+ ...restProps
56
+ })
57
+ });
58
+ }
59
+ if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
60
+ "data-copilotkit": true,
61
+ style: { display: "contents" },
62
+ children: [boundContainer, children]
63
+ });
52
64
  return boundContainer;
53
65
  });
54
66
  CopilotChatSuggestionView.displayName = "CopilotChatSuggestionView";
@@ -1 +1 @@
1
- {"version":3,"file":"CopilotChatSuggestionView.cjs","names":["React","cn","renderSlot","CopilotChatSuggestionPill"],"sources":["../../../src/components/chat/CopilotChatSuggestionView.tsx"],"sourcesContent":["import React from \"react\";\nimport { Suggestion } from \"@copilotkitnext/core\";\nimport { renderSlot, WithSlots } from \"@/lib/slots\";\nimport { cn } from \"@/lib/utils\";\nimport CopilotChatSuggestionPill, {\n CopilotChatSuggestionPillProps,\n} from \"./CopilotChatSuggestionPill\";\n\nconst DefaultContainer = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(function DefaultContainer({ className, ...props }, ref) {\n return (\n <div\n ref={ref}\n className={cn(\n \"flex flex-wrap items-center gap-1.5 sm:gap-2 pl-0 pr-4 sm:px-0 pointer-events-none\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport type CopilotChatSuggestionViewProps = WithSlots<\n {\n container: typeof DefaultContainer;\n suggestion: typeof CopilotChatSuggestionPill;\n },\n {\n suggestions: Suggestion[];\n onSelectSuggestion?: (suggestion: Suggestion, index: number) => void;\n loadingIndexes?: ReadonlyArray<number>;\n } & React.HTMLAttributes<HTMLDivElement>\n>;\n\nexport const CopilotChatSuggestionView = React.forwardRef<\n HTMLDivElement,\n CopilotChatSuggestionViewProps\n>(function CopilotChatSuggestionView(\n {\n suggestions,\n onSelectSuggestion,\n loadingIndexes,\n container,\n suggestion: suggestionSlot,\n className,\n children,\n ...restProps\n },\n ref,\n) {\n const loadingSet = React.useMemo(() => {\n if (!loadingIndexes || loadingIndexes.length === 0) {\n return new Set<number>();\n }\n return new Set(loadingIndexes);\n }, [loadingIndexes]);\n\n const ContainerElement = renderSlot(container, DefaultContainer, {\n ref,\n className,\n ...restProps,\n });\n\n const suggestionElements = suggestions.map((suggestion, index) => {\n const isLoading = loadingSet.has(index) || suggestion.isLoading === true;\n const pill = renderSlot<\n typeof CopilotChatSuggestionPill,\n CopilotChatSuggestionPillProps\n >(suggestionSlot, CopilotChatSuggestionPill, {\n children: suggestion.title,\n isLoading,\n type: \"button\",\n onClick: () => onSelectSuggestion?.(suggestion, index),\n });\n\n return React.cloneElement(pill, {\n key: `${suggestion.title}-${index}`,\n });\n });\n\n const boundContainer = React.cloneElement(\n ContainerElement,\n undefined,\n suggestionElements,\n );\n\n if (typeof children === \"function\") {\n const sampleSuggestion = renderSlot<\n typeof CopilotChatSuggestionPill,\n CopilotChatSuggestionPillProps\n >(suggestionSlot, CopilotChatSuggestionPill, {\n children: suggestions[0]?.title ?? \"\",\n isLoading:\n suggestions.length > 0\n ? loadingSet.has(0) || suggestions[0]?.isLoading === true\n : false,\n type: \"button\",\n });\n\n return (\n <>\n {children({\n container: boundContainer,\n suggestion: sampleSuggestion,\n suggestions,\n onSelectSuggestion,\n loadingIndexes,\n className,\n ...restProps,\n })}\n </>\n );\n }\n\n if (children) {\n return (\n <>\n {boundContainer}\n {children}\n </>\n );\n }\n\n return boundContainer;\n});\n\nCopilotChatSuggestionView.displayName = \"CopilotChatSuggestionView\";\n\nexport default CopilotChatSuggestionView;\n"],"mappings":";;;;;;;;;AAQA,MAAM,mBAAmBA,cAAM,WAG7B,SAAS,iBAAiB,EAAE,WAAW,GAAG,SAAS,KAAK;AACxD,QACE,2CAAC;EACM;EACL,WAAWC,iBACT,sFACA,UACD;EACD,GAAI;GACJ;EAEJ;AAcF,MAAa,4BAA4BD,cAAM,WAG7C,SAAS,0BACT,EACE,aACA,oBACA,gBACA,WACA,YAAY,gBACZ,WACA,UACA,GAAG,aAEL,KACA;CACA,MAAM,aAAaA,cAAM,cAAc;AACrC,MAAI,CAAC,kBAAkB,eAAe,WAAW,EAC/C,wBAAO,IAAI,KAAa;AAE1B,SAAO,IAAI,IAAI,eAAe;IAC7B,CAAC,eAAe,CAAC;CAEpB,MAAM,mBAAmBE,yBAAW,WAAW,kBAAkB;EAC/D;EACA;EACA,GAAG;EACJ,CAAC;CAEF,MAAM,qBAAqB,YAAY,KAAK,YAAY,UAAU;EAChE,MAAM,YAAY,WAAW,IAAI,MAAM,IAAI,WAAW,cAAc;EACpE,MAAM,OAAOA,yBAGX,gBAAgBC,2CAA2B;GAC3C,UAAU,WAAW;GACrB;GACA,MAAM;GACN,eAAe,qBAAqB,YAAY,MAAM;GACvD,CAAC;AAEF,SAAOH,cAAM,aAAa,MAAM,EAC9B,KAAK,GAAG,WAAW,MAAM,GAAG,SAC7B,CAAC;GACF;CAEF,MAAM,iBAAiBA,cAAM,aAC3B,kBACA,QACA,mBACD;AAED,KAAI,OAAO,aAAa,WAatB,QACE,mFACG,SAAS;EACR,WAAW;EACX,YAhBmBE,yBAGvB,gBAAgBC,2CAA2B;GAC3C,UAAU,YAAY,IAAI,SAAS;GACnC,WACE,YAAY,SAAS,IACjB,WAAW,IAAI,EAAE,IAAI,YAAY,IAAI,cAAc,OACnD;GACN,MAAM;GACP,CAAC;EAOI;EACA;EACA;EACA;EACA,GAAG;EACJ,CAAC,GACD;AAIP,KAAI,SACF,QACE,qFACG,gBACA,YACA;AAIP,QAAO;EACP;AAEF,0BAA0B,cAAc"}
1
+ {"version":3,"file":"CopilotChatSuggestionView.cjs","names":["React","cn","renderSlot","CopilotChatSuggestionPill"],"sources":["../../../src/components/chat/CopilotChatSuggestionView.tsx"],"sourcesContent":["import React from \"react\";\nimport { Suggestion } from \"@copilotkitnext/core\";\nimport { renderSlot, WithSlots } from \"@/lib/slots\";\nimport { cn } from \"@/lib/utils\";\nimport CopilotChatSuggestionPill, {\n CopilotChatSuggestionPillProps,\n} from \"./CopilotChatSuggestionPill\";\n\nconst DefaultContainer = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(function DefaultContainer({ className, ...props }, ref) {\n return (\n <div\n ref={ref}\n data-copilotkit\n className={cn(\n \"cpk:flex cpk:flex-wrap cpk:items-center cpk:gap-1.5 cpk:sm:gap-2 cpk:pl-0 cpk:pr-4 cpk:sm:px-0 cpk:pointer-events-none\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport type CopilotChatSuggestionViewProps = WithSlots<\n {\n container: typeof DefaultContainer;\n suggestion: typeof CopilotChatSuggestionPill;\n },\n {\n suggestions: Suggestion[];\n onSelectSuggestion?: (suggestion: Suggestion, index: number) => void;\n loadingIndexes?: ReadonlyArray<number>;\n } & React.HTMLAttributes<HTMLDivElement>\n>;\n\nexport const CopilotChatSuggestionView = React.forwardRef<\n HTMLDivElement,\n CopilotChatSuggestionViewProps\n>(function CopilotChatSuggestionView(\n {\n suggestions,\n onSelectSuggestion,\n loadingIndexes,\n container,\n suggestion: suggestionSlot,\n className,\n children,\n ...restProps\n },\n ref,\n) {\n const loadingSet = React.useMemo(() => {\n if (!loadingIndexes || loadingIndexes.length === 0) {\n return new Set<number>();\n }\n return new Set(loadingIndexes);\n }, [loadingIndexes]);\n\n const ContainerElement = renderSlot(container, DefaultContainer, {\n ref,\n className,\n ...restProps,\n });\n\n const suggestionElements = suggestions.map((suggestion, index) => {\n const isLoading = loadingSet.has(index) || suggestion.isLoading === true;\n const pill = renderSlot<\n typeof CopilotChatSuggestionPill,\n CopilotChatSuggestionPillProps\n >(suggestionSlot, CopilotChatSuggestionPill, {\n children: suggestion.title,\n isLoading,\n type: \"button\",\n onClick: () => onSelectSuggestion?.(suggestion, index),\n });\n\n return React.cloneElement(pill, {\n key: `${suggestion.title}-${index}`,\n });\n });\n\n const boundContainer = React.cloneElement(\n ContainerElement,\n undefined,\n suggestionElements,\n );\n\n if (typeof children === \"function\") {\n const sampleSuggestion = renderSlot<\n typeof CopilotChatSuggestionPill,\n CopilotChatSuggestionPillProps\n >(suggestionSlot, CopilotChatSuggestionPill, {\n children: suggestions[0]?.title ?? \"\",\n isLoading:\n suggestions.length > 0\n ? loadingSet.has(0) || suggestions[0]?.isLoading === true\n : false,\n type: \"button\",\n });\n\n return (\n <div data-copilotkit style={{ display: \"contents\" }}>\n {children({\n container: boundContainer,\n suggestion: sampleSuggestion,\n suggestions,\n onSelectSuggestion,\n loadingIndexes,\n className,\n ...restProps,\n })}\n </div>\n );\n }\n\n if (children) {\n return (\n <div data-copilotkit style={{ display: \"contents\" }}>\n {boundContainer}\n {children}\n </div>\n );\n }\n\n return boundContainer;\n});\n\nCopilotChatSuggestionView.displayName = \"CopilotChatSuggestionView\";\n\nexport default CopilotChatSuggestionView;\n"],"mappings":";;;;;;;;;AAQA,MAAM,mBAAmBA,cAAM,WAG7B,SAAS,iBAAiB,EAAE,WAAW,GAAG,SAAS,KAAK;AACxD,QACE,2CAAC;EACM;EACL;EACA,WAAWC,iBACT,0HACA,UACD;EACD,GAAI;GACJ;EAEJ;AAcF,MAAa,4BAA4BD,cAAM,WAG7C,SAAS,0BACT,EACE,aACA,oBACA,gBACA,WACA,YAAY,gBACZ,WACA,UACA,GAAG,aAEL,KACA;CACA,MAAM,aAAaA,cAAM,cAAc;AACrC,MAAI,CAAC,kBAAkB,eAAe,WAAW,EAC/C,wBAAO,IAAI,KAAa;AAE1B,SAAO,IAAI,IAAI,eAAe;IAC7B,CAAC,eAAe,CAAC;CAEpB,MAAM,mBAAmBE,yBAAW,WAAW,kBAAkB;EAC/D;EACA;EACA,GAAG;EACJ,CAAC;CAEF,MAAM,qBAAqB,YAAY,KAAK,YAAY,UAAU;EAChE,MAAM,YAAY,WAAW,IAAI,MAAM,IAAI,WAAW,cAAc;EACpE,MAAM,OAAOA,yBAGX,gBAAgBC,2CAA2B;GAC3C,UAAU,WAAW;GACrB;GACA,MAAM;GACN,eAAe,qBAAqB,YAAY,MAAM;GACvD,CAAC;AAEF,SAAOH,cAAM,aAAa,MAAM,EAC9B,KAAK,GAAG,WAAW,MAAM,GAAG,SAC7B,CAAC;GACF;CAEF,MAAM,iBAAiBA,cAAM,aAC3B,kBACA,QACA,mBACD;AAED,KAAI,OAAO,aAAa,YAAY;EAClC,MAAM,mBAAmBE,yBAGvB,gBAAgBC,2CAA2B;GAC3C,UAAU,YAAY,IAAI,SAAS;GACnC,WACE,YAAY,SAAS,IACjB,WAAW,IAAI,EAAE,IAAI,YAAY,IAAI,cAAc,OACnD;GACN,MAAM;GACP,CAAC;AAEF,SACE,2CAAC;GAAI;GAAgB,OAAO,EAAE,SAAS,YAAY;aAChD,SAAS;IACR,WAAW;IACX,YAAY;IACZ;IACA;IACA;IACA;IACA,GAAG;IACJ,CAAC;IACE;;AAIV,KAAI,SACF,QACE,4CAAC;EAAI;EAAgB,OAAO,EAAE,SAAS,YAAY;aAChD,gBACA;GACG;AAIV,QAAO;EACP;AAEF,0BAA0B,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"CopilotChatSuggestionView.d.cts","names":[],"sources":["../../../src/components/chat/CopilotChatSuggestionView.tsx"],"mappings":";;;;;;cAQM,gBAAA,EAAgB,KAAA,CAAA,yBAAA,CAAA,KAAA,CAAA,cAAA,CAAA,cAAA,IAAA,KAAA,CAAA,aAAA,CAAA,cAAA;AAAA,KAgBV,8BAAA,GAAiC,SAAA;EAEzC,SAAA,SAAkB,gBAAA;EAClB,UAAA,SAAmB,yBAAA;AAAA;EAGnB,WAAA,EAAa,UAAA;EACb,kBAAA,IAAsB,UAAA,EAAY,UAAA,EAAY,KAAA;EAC9C,cAAA,GAAiB,aAAA;AAAA,IACf,KAAA,CAAM,cAAA,CAAe,cAAA;AAAA,cAGd,yBAAA,EAAyB,KAAA,CAAA,yBAAA;;;;;;;;iBANrB,UAAA;0BACS,UAAA,EAAY,UAAA,EAAY,KAAA;qBAC7B,aAAA;EAAA,6CAAN,KAAA,CAAO,SAAA;AAAA;eAFL,UAAA;wBACS,UAAA,EAAY,UAAA,EAAY,KAAA;mBAC7B,aAAA;AAAA"}
1
+ {"version":3,"file":"CopilotChatSuggestionView.d.cts","names":[],"sources":["../../../src/components/chat/CopilotChatSuggestionView.tsx"],"mappings":";;;;;;cAQM,gBAAA,EAAgB,KAAA,CAAA,yBAAA,CAAA,KAAA,CAAA,cAAA,CAAA,cAAA,IAAA,KAAA,CAAA,aAAA,CAAA,cAAA;AAAA,KAiBV,8BAAA,GAAiC,SAAA;EAEzC,SAAA,SAAkB,gBAAA;EAClB,UAAA,SAAmB,yBAAA;AAAA;EAGnB,WAAA,EAAa,UAAA;EACb,kBAAA,IAAsB,UAAA,EAAY,UAAA,EAAY,KAAA;EAC9C,cAAA,GAAiB,aAAA;AAAA,IACf,KAAA,CAAM,cAAA,CAAe,cAAA;AAAA,cAGd,yBAAA,EAAyB,KAAA,CAAA,yBAAA;;;;;;;;iBANrB,UAAA;0BACS,UAAA,EAAY,UAAA,EAAY,KAAA;qBAC7B,aAAA;EAAA,6CADU,KAAA,CAAO,SAAA;AAAA;eADrB,UAAA;wBACS,UAAA,EAAY,UAAA,EAAY,KAAA;mBAC7B,aAAA;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"CopilotChatSuggestionView.d.mts","names":[],"sources":["../../../src/components/chat/CopilotChatSuggestionView.tsx"],"mappings":";;;;;;cAQM,gBAAA,EAAgB,KAAA,CAAA,yBAAA,CAAA,KAAA,CAAA,cAAA,CAAA,cAAA,IAAA,KAAA,CAAA,aAAA,CAAA,cAAA;AAAA,KAgBV,8BAAA,GAAiC,SAAA;EAEzC,SAAA,SAAkB,gBAAA;EAClB,UAAA,SAAmB,yBAAA;AAAA;EAGnB,WAAA,EAAa,UAAA;EACb,kBAAA,IAAsB,UAAA,EAAY,UAAA,EAAY,KAAA;EAC9C,cAAA,GAAiB,aAAA;AAAA,IACf,KAAA,CAAM,cAAA,CAAe,cAAA;AAAA,cAGd,yBAAA,EAAyB,KAAA,CAAA,yBAAA;;;;;;;;iBANrB,UAAA;0BACS,UAAA,EAAY,UAAA,EAAY,KAAA;qBAC7B,aAAA;EAAA,6CAAN,KAAA,CAAO,SAAA;AAAA;eAFL,UAAA;wBACS,UAAA,EAAY,UAAA,EAAY,KAAA;mBAC7B,aAAA;AAAA"}
1
+ {"version":3,"file":"CopilotChatSuggestionView.d.mts","names":[],"sources":["../../../src/components/chat/CopilotChatSuggestionView.tsx"],"mappings":";;;;;;cAQM,gBAAA,EAAgB,KAAA,CAAA,yBAAA,CAAA,KAAA,CAAA,cAAA,CAAA,cAAA,IAAA,KAAA,CAAA,aAAA,CAAA,cAAA;AAAA,KAiBV,8BAAA,GAAiC,SAAA;EAEzC,SAAA,SAAkB,gBAAA;EAClB,UAAA,SAAmB,yBAAA;AAAA;EAGnB,WAAA,EAAa,UAAA;EACb,kBAAA,IAAsB,UAAA,EAAY,UAAA,EAAY,KAAA;EAC9C,cAAA,GAAiB,aAAA;AAAA,IACf,KAAA,CAAM,cAAA,CAAe,cAAA;AAAA,cAGd,yBAAA,EAAyB,KAAA,CAAA,yBAAA;;;;;;;;iBANrB,UAAA;0BACS,UAAA,EAAY,UAAA,EAAY,KAAA;qBAC7B,aAAA;EAAA,6CADU,KAAA,CAAO,SAAA;AAAA;eADrB,UAAA;wBACS,UAAA,EAAY,UAAA,EAAY,KAAA;mBAC7B,aAAA;AAAA"}
@@ -2,13 +2,14 @@ import { cn } from "../../lib/utils.mjs";
2
2
  import { renderSlot } from "../../lib/slots.mjs";
3
3
  import CopilotChatSuggestionPill from "./CopilotChatSuggestionPill.mjs";
4
4
  import React from "react";
5
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
6
 
7
7
  //#region src/components/chat/CopilotChatSuggestionView.tsx
8
8
  const DefaultContainer = React.forwardRef(function DefaultContainer({ className, ...props }, ref) {
9
9
  return /* @__PURE__ */ jsx("div", {
10
10
  ref,
11
- className: cn("flex flex-wrap items-center gap-1.5 sm:gap-2 pl-0 pr-4 sm:px-0 pointer-events-none", className),
11
+ "data-copilotkit": true,
12
+ className: cn("cpk:flex cpk:flex-wrap cpk:items-center cpk:gap-1.5 cpk:sm:gap-2 cpk:pl-0 cpk:pr-4 cpk:sm:px-0 cpk:pointer-events-none", className),
12
13
  ...props
13
14
  });
14
15
  });
@@ -33,20 +34,31 @@ const CopilotChatSuggestionView = React.forwardRef(function CopilotChatSuggestio
33
34
  return React.cloneElement(pill, { key: `${suggestion.title}-${index}` });
34
35
  });
35
36
  const boundContainer = React.cloneElement(ContainerElement, void 0, suggestionElements);
36
- if (typeof children === "function") return /* @__PURE__ */ jsx(Fragment, { children: children({
37
- container: boundContainer,
38
- suggestion: renderSlot(suggestionSlot, CopilotChatSuggestionPill, {
37
+ if (typeof children === "function") {
38
+ const sampleSuggestion = renderSlot(suggestionSlot, CopilotChatSuggestionPill, {
39
39
  children: suggestions[0]?.title ?? "",
40
40
  isLoading: suggestions.length > 0 ? loadingSet.has(0) || suggestions[0]?.isLoading === true : false,
41
41
  type: "button"
42
- }),
43
- suggestions,
44
- onSelectSuggestion,
45
- loadingIndexes,
46
- className,
47
- ...restProps
48
- }) });
49
- if (children) return /* @__PURE__ */ jsxs(Fragment, { children: [boundContainer, children] });
42
+ });
43
+ return /* @__PURE__ */ jsx("div", {
44
+ "data-copilotkit": true,
45
+ style: { display: "contents" },
46
+ children: children({
47
+ container: boundContainer,
48
+ suggestion: sampleSuggestion,
49
+ suggestions,
50
+ onSelectSuggestion,
51
+ loadingIndexes,
52
+ className,
53
+ ...restProps
54
+ })
55
+ });
56
+ }
57
+ if (children) return /* @__PURE__ */ jsxs("div", {
58
+ "data-copilotkit": true,
59
+ style: { display: "contents" },
60
+ children: [boundContainer, children]
61
+ });
50
62
  return boundContainer;
51
63
  });
52
64
  CopilotChatSuggestionView.displayName = "CopilotChatSuggestionView";
@@ -1 +1 @@
1
- {"version":3,"file":"CopilotChatSuggestionView.mjs","names":[],"sources":["../../../src/components/chat/CopilotChatSuggestionView.tsx"],"sourcesContent":["import React from \"react\";\nimport { Suggestion } from \"@copilotkitnext/core\";\nimport { renderSlot, WithSlots } from \"@/lib/slots\";\nimport { cn } from \"@/lib/utils\";\nimport CopilotChatSuggestionPill, {\n CopilotChatSuggestionPillProps,\n} from \"./CopilotChatSuggestionPill\";\n\nconst DefaultContainer = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(function DefaultContainer({ className, ...props }, ref) {\n return (\n <div\n ref={ref}\n className={cn(\n \"flex flex-wrap items-center gap-1.5 sm:gap-2 pl-0 pr-4 sm:px-0 pointer-events-none\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport type CopilotChatSuggestionViewProps = WithSlots<\n {\n container: typeof DefaultContainer;\n suggestion: typeof CopilotChatSuggestionPill;\n },\n {\n suggestions: Suggestion[];\n onSelectSuggestion?: (suggestion: Suggestion, index: number) => void;\n loadingIndexes?: ReadonlyArray<number>;\n } & React.HTMLAttributes<HTMLDivElement>\n>;\n\nexport const CopilotChatSuggestionView = React.forwardRef<\n HTMLDivElement,\n CopilotChatSuggestionViewProps\n>(function CopilotChatSuggestionView(\n {\n suggestions,\n onSelectSuggestion,\n loadingIndexes,\n container,\n suggestion: suggestionSlot,\n className,\n children,\n ...restProps\n },\n ref,\n) {\n const loadingSet = React.useMemo(() => {\n if (!loadingIndexes || loadingIndexes.length === 0) {\n return new Set<number>();\n }\n return new Set(loadingIndexes);\n }, [loadingIndexes]);\n\n const ContainerElement = renderSlot(container, DefaultContainer, {\n ref,\n className,\n ...restProps,\n });\n\n const suggestionElements = suggestions.map((suggestion, index) => {\n const isLoading = loadingSet.has(index) || suggestion.isLoading === true;\n const pill = renderSlot<\n typeof CopilotChatSuggestionPill,\n CopilotChatSuggestionPillProps\n >(suggestionSlot, CopilotChatSuggestionPill, {\n children: suggestion.title,\n isLoading,\n type: \"button\",\n onClick: () => onSelectSuggestion?.(suggestion, index),\n });\n\n return React.cloneElement(pill, {\n key: `${suggestion.title}-${index}`,\n });\n });\n\n const boundContainer = React.cloneElement(\n ContainerElement,\n undefined,\n suggestionElements,\n );\n\n if (typeof children === \"function\") {\n const sampleSuggestion = renderSlot<\n typeof CopilotChatSuggestionPill,\n CopilotChatSuggestionPillProps\n >(suggestionSlot, CopilotChatSuggestionPill, {\n children: suggestions[0]?.title ?? \"\",\n isLoading:\n suggestions.length > 0\n ? loadingSet.has(0) || suggestions[0]?.isLoading === true\n : false,\n type: \"button\",\n });\n\n return (\n <>\n {children({\n container: boundContainer,\n suggestion: sampleSuggestion,\n suggestions,\n onSelectSuggestion,\n loadingIndexes,\n className,\n ...restProps,\n })}\n </>\n );\n }\n\n if (children) {\n return (\n <>\n {boundContainer}\n {children}\n </>\n );\n }\n\n return boundContainer;\n});\n\nCopilotChatSuggestionView.displayName = \"CopilotChatSuggestionView\";\n\nexport default CopilotChatSuggestionView;\n"],"mappings":";;;;;;;AAQA,MAAM,mBAAmB,MAAM,WAG7B,SAAS,iBAAiB,EAAE,WAAW,GAAG,SAAS,KAAK;AACxD,QACE,oBAAC;EACM;EACL,WAAW,GACT,sFACA,UACD;EACD,GAAI;GACJ;EAEJ;AAcF,MAAa,4BAA4B,MAAM,WAG7C,SAAS,0BACT,EACE,aACA,oBACA,gBACA,WACA,YAAY,gBACZ,WACA,UACA,GAAG,aAEL,KACA;CACA,MAAM,aAAa,MAAM,cAAc;AACrC,MAAI,CAAC,kBAAkB,eAAe,WAAW,EAC/C,wBAAO,IAAI,KAAa;AAE1B,SAAO,IAAI,IAAI,eAAe;IAC7B,CAAC,eAAe,CAAC;CAEpB,MAAM,mBAAmB,WAAW,WAAW,kBAAkB;EAC/D;EACA;EACA,GAAG;EACJ,CAAC;CAEF,MAAM,qBAAqB,YAAY,KAAK,YAAY,UAAU;EAChE,MAAM,YAAY,WAAW,IAAI,MAAM,IAAI,WAAW,cAAc;EACpE,MAAM,OAAO,WAGX,gBAAgB,2BAA2B;GAC3C,UAAU,WAAW;GACrB;GACA,MAAM;GACN,eAAe,qBAAqB,YAAY,MAAM;GACvD,CAAC;AAEF,SAAO,MAAM,aAAa,MAAM,EAC9B,KAAK,GAAG,WAAW,MAAM,GAAG,SAC7B,CAAC;GACF;CAEF,MAAM,iBAAiB,MAAM,aAC3B,kBACA,QACA,mBACD;AAED,KAAI,OAAO,aAAa,WAatB,QACE,0CACG,SAAS;EACR,WAAW;EACX,YAhBmB,WAGvB,gBAAgB,2BAA2B;GAC3C,UAAU,YAAY,IAAI,SAAS;GACnC,WACE,YAAY,SAAS,IACjB,WAAW,IAAI,EAAE,IAAI,YAAY,IAAI,cAAc,OACnD;GACN,MAAM;GACP,CAAC;EAOI;EACA;EACA;EACA;EACA,GAAG;EACJ,CAAC,GACD;AAIP,KAAI,SACF,QACE,4CACG,gBACA,YACA;AAIP,QAAO;EACP;AAEF,0BAA0B,cAAc"}
1
+ {"version":3,"file":"CopilotChatSuggestionView.mjs","names":[],"sources":["../../../src/components/chat/CopilotChatSuggestionView.tsx"],"sourcesContent":["import React from \"react\";\nimport { Suggestion } from \"@copilotkitnext/core\";\nimport { renderSlot, WithSlots } from \"@/lib/slots\";\nimport { cn } from \"@/lib/utils\";\nimport CopilotChatSuggestionPill, {\n CopilotChatSuggestionPillProps,\n} from \"./CopilotChatSuggestionPill\";\n\nconst DefaultContainer = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(function DefaultContainer({ className, ...props }, ref) {\n return (\n <div\n ref={ref}\n data-copilotkit\n className={cn(\n \"cpk:flex cpk:flex-wrap cpk:items-center cpk:gap-1.5 cpk:sm:gap-2 cpk:pl-0 cpk:pr-4 cpk:sm:px-0 cpk:pointer-events-none\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport type CopilotChatSuggestionViewProps = WithSlots<\n {\n container: typeof DefaultContainer;\n suggestion: typeof CopilotChatSuggestionPill;\n },\n {\n suggestions: Suggestion[];\n onSelectSuggestion?: (suggestion: Suggestion, index: number) => void;\n loadingIndexes?: ReadonlyArray<number>;\n } & React.HTMLAttributes<HTMLDivElement>\n>;\n\nexport const CopilotChatSuggestionView = React.forwardRef<\n HTMLDivElement,\n CopilotChatSuggestionViewProps\n>(function CopilotChatSuggestionView(\n {\n suggestions,\n onSelectSuggestion,\n loadingIndexes,\n container,\n suggestion: suggestionSlot,\n className,\n children,\n ...restProps\n },\n ref,\n) {\n const loadingSet = React.useMemo(() => {\n if (!loadingIndexes || loadingIndexes.length === 0) {\n return new Set<number>();\n }\n return new Set(loadingIndexes);\n }, [loadingIndexes]);\n\n const ContainerElement = renderSlot(container, DefaultContainer, {\n ref,\n className,\n ...restProps,\n });\n\n const suggestionElements = suggestions.map((suggestion, index) => {\n const isLoading = loadingSet.has(index) || suggestion.isLoading === true;\n const pill = renderSlot<\n typeof CopilotChatSuggestionPill,\n CopilotChatSuggestionPillProps\n >(suggestionSlot, CopilotChatSuggestionPill, {\n children: suggestion.title,\n isLoading,\n type: \"button\",\n onClick: () => onSelectSuggestion?.(suggestion, index),\n });\n\n return React.cloneElement(pill, {\n key: `${suggestion.title}-${index}`,\n });\n });\n\n const boundContainer = React.cloneElement(\n ContainerElement,\n undefined,\n suggestionElements,\n );\n\n if (typeof children === \"function\") {\n const sampleSuggestion = renderSlot<\n typeof CopilotChatSuggestionPill,\n CopilotChatSuggestionPillProps\n >(suggestionSlot, CopilotChatSuggestionPill, {\n children: suggestions[0]?.title ?? \"\",\n isLoading:\n suggestions.length > 0\n ? loadingSet.has(0) || suggestions[0]?.isLoading === true\n : false,\n type: \"button\",\n });\n\n return (\n <div data-copilotkit style={{ display: \"contents\" }}>\n {children({\n container: boundContainer,\n suggestion: sampleSuggestion,\n suggestions,\n onSelectSuggestion,\n loadingIndexes,\n className,\n ...restProps,\n })}\n </div>\n );\n }\n\n if (children) {\n return (\n <div data-copilotkit style={{ display: \"contents\" }}>\n {boundContainer}\n {children}\n </div>\n );\n }\n\n return boundContainer;\n});\n\nCopilotChatSuggestionView.displayName = \"CopilotChatSuggestionView\";\n\nexport default CopilotChatSuggestionView;\n"],"mappings":";;;;;;;AAQA,MAAM,mBAAmB,MAAM,WAG7B,SAAS,iBAAiB,EAAE,WAAW,GAAG,SAAS,KAAK;AACxD,QACE,oBAAC;EACM;EACL;EACA,WAAW,GACT,0HACA,UACD;EACD,GAAI;GACJ;EAEJ;AAcF,MAAa,4BAA4B,MAAM,WAG7C,SAAS,0BACT,EACE,aACA,oBACA,gBACA,WACA,YAAY,gBACZ,WACA,UACA,GAAG,aAEL,KACA;CACA,MAAM,aAAa,MAAM,cAAc;AACrC,MAAI,CAAC,kBAAkB,eAAe,WAAW,EAC/C,wBAAO,IAAI,KAAa;AAE1B,SAAO,IAAI,IAAI,eAAe;IAC7B,CAAC,eAAe,CAAC;CAEpB,MAAM,mBAAmB,WAAW,WAAW,kBAAkB;EAC/D;EACA;EACA,GAAG;EACJ,CAAC;CAEF,MAAM,qBAAqB,YAAY,KAAK,YAAY,UAAU;EAChE,MAAM,YAAY,WAAW,IAAI,MAAM,IAAI,WAAW,cAAc;EACpE,MAAM,OAAO,WAGX,gBAAgB,2BAA2B;GAC3C,UAAU,WAAW;GACrB;GACA,MAAM;GACN,eAAe,qBAAqB,YAAY,MAAM;GACvD,CAAC;AAEF,SAAO,MAAM,aAAa,MAAM,EAC9B,KAAK,GAAG,WAAW,MAAM,GAAG,SAC7B,CAAC;GACF;CAEF,MAAM,iBAAiB,MAAM,aAC3B,kBACA,QACA,mBACD;AAED,KAAI,OAAO,aAAa,YAAY;EAClC,MAAM,mBAAmB,WAGvB,gBAAgB,2BAA2B;GAC3C,UAAU,YAAY,IAAI,SAAS;GACnC,WACE,YAAY,SAAS,IACjB,WAAW,IAAI,EAAE,IAAI,YAAY,IAAI,cAAc,OACnD;GACN,MAAM;GACP,CAAC;AAEF,SACE,oBAAC;GAAI;GAAgB,OAAO,EAAE,SAAS,YAAY;aAChD,SAAS;IACR,WAAW;IACX,YAAY;IACZ;IACA;IACA;IACA;IACA,GAAG;IACJ,CAAC;IACE;;AAIV,KAAI,SACF,QACE,qBAAC;EAAI;EAAgB,OAAO,EAAE,SAAS,YAAY;aAChD,gBACA;GACG;AAIV,QAAO;EACP;AAEF,0BAA0B,cAAc"}
@@ -9,21 +9,21 @@ let react_jsx_runtime = require("react/jsx-runtime");
9
9
 
10
10
  //#region src/components/chat/CopilotChatToggleButton.tsx
11
11
  const DefaultOpenIcon = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.MessageCircle, {
12
- className: require_utils.cn("h-6 w-6", className),
12
+ className: require_utils.cn("cpk:h-6 cpk:w-6", className),
13
13
  strokeWidth: 1.75,
14
14
  fill: "currentColor",
15
15
  ...props
16
16
  });
17
17
  const DefaultCloseIcon = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.X, {
18
- className: require_utils.cn("h-6 w-6", className),
18
+ className: require_utils.cn("cpk:h-6 cpk:w-6", className),
19
19
  strokeWidth: 1.75,
20
20
  ...props
21
21
  });
22
22
  DefaultOpenIcon.displayName = "CopilotChatToggleButton.OpenIcon";
23
23
  DefaultCloseIcon.displayName = "CopilotChatToggleButton.CloseIcon";
24
24
  const ICON_TRANSITION_STYLE = Object.freeze({ transition: "opacity 120ms ease-out, transform 260ms cubic-bezier(0.22, 1, 0.36, 1)" });
25
- const ICON_WRAPPER_BASE = "pointer-events-none absolute inset-0 flex items-center justify-center will-change-transform";
26
- const BUTTON_BASE_CLASSES = require_utils.cn("fixed bottom-6 right-6 z-[1100] flex h-14 w-14 items-center justify-center", "rounded-full border border-primary bg-primary text-primary-foreground", "shadow-sm transition-all duration-200 ease-out", "hover:scale-[1.04] hover:shadow-md", "cursor-pointer", "active:scale-[0.96]", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background", "disabled:pointer-events-none disabled:opacity-60");
25
+ const ICON_WRAPPER_BASE = "cpk:pointer-events-none cpk:absolute cpk:inset-0 cpk:flex cpk:items-center cpk:justify-center cpk:will-change-transform";
26
+ const BUTTON_BASE_CLASSES = require_utils.cn("cpk:fixed cpk:bottom-6 cpk:right-6 cpk:z-[1100] cpk:flex cpk:h-14 cpk:w-14 cpk:items-center cpk:justify-center", "cpk:rounded-full cpk:border cpk:border-primary cpk:bg-primary cpk:text-primary-foreground", "cpk:shadow-sm cpk:transition-all cpk:duration-200 cpk:ease-out", "cpk:hover:scale-[1.04] cpk:hover:shadow-md", "cpk:cursor-pointer", "cpk:active:scale-[0.96]", "cpk:focus-visible:outline-none cpk:focus-visible:ring-2 cpk:focus-visible:ring-primary/50 cpk:focus-visible:ring-offset-2 cpk:focus-visible:ring-offset-background", "cpk:disabled:pointer-events-none cpk:disabled:opacity-60");
27
27
  const CopilotChatToggleButton = react.default.forwardRef(function CopilotChatToggleButton({ openIcon, closeIcon, className, ...buttonProps }, ref) {
28
28
  const { onClick, type, disabled, ...restProps } = buttonProps;
29
29
  const configuration = require_CopilotChatConfigurationProvider.useCopilotChatConfiguration();
@@ -38,12 +38,12 @@ const CopilotChatToggleButton = react.default.forwardRef(function CopilotChatTog
38
38
  setModalOpen(!isOpen);
39
39
  };
40
40
  const renderedOpenIcon = require_slots.renderSlot(openIcon, DefaultOpenIcon, {
41
- className: "h-6 w-6",
41
+ className: "cpk:h-6 cpk:w-6",
42
42
  "aria-hidden": true,
43
43
  focusable: false
44
44
  });
45
45
  const renderedCloseIcon = require_slots.renderSlot(closeIcon, DefaultCloseIcon, {
46
- className: "h-6 w-6",
46
+ className: "cpk:h-6 cpk:w-6",
47
47
  "aria-hidden": true,
48
48
  focusable: false
49
49
  });
@@ -72,6 +72,7 @@ const CopilotChatToggleButton = react.default.forwardRef(function CopilotChatTog
72
72
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
73
73
  ref,
74
74
  type: type ?? "button",
75
+ "data-copilotkit": true,
75
76
  "data-slot": "chat-toggle-button",
76
77
  "data-state": isOpen ? "open" : "closed",
77
78
  className: require_utils.cn(BUTTON_BASE_CLASSES, className),
@@ -1 +1 @@
1
- {"version":3,"file":"CopilotChatToggleButton.cjs","names":["MessageCircle","cn","X","React","useCopilotChatConfiguration","CopilotChatDefaultLabels","renderSlot"],"sources":["../../../src/components/chat/CopilotChatToggleButton.tsx"],"sourcesContent":["import React, { useState, MouseEvent } from \"react\";\nimport { MessageCircle, X } from \"lucide-react\";\n\nimport { renderSlot, SlotValue } from \"@/lib/slots\";\nimport { cn } from \"@/lib/utils\";\nimport {\n CopilotChatDefaultLabels,\n useCopilotChatConfiguration,\n} from \"@/providers/CopilotChatConfigurationProvider\";\n\nconst DefaultOpenIcon: React.FC<React.SVGProps<SVGSVGElement>> = ({\n className,\n ...props\n}) => (\n <MessageCircle\n className={cn(\"h-6 w-6\", className)}\n strokeWidth={1.75}\n fill=\"currentColor\"\n {...props}\n />\n);\n\nconst DefaultCloseIcon: React.FC<React.SVGProps<SVGSVGElement>> = ({\n className,\n ...props\n}) => <X className={cn(\"h-6 w-6\", className)} strokeWidth={1.75} {...props} />;\n\nDefaultOpenIcon.displayName = \"CopilotChatToggleButton.OpenIcon\";\nDefaultCloseIcon.displayName = \"CopilotChatToggleButton.CloseIcon\";\n\nexport interface CopilotChatToggleButtonProps extends Omit<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n \"children\"\n> {\n /** Optional slot override for the chat (closed) icon. */\n openIcon?: SlotValue<typeof DefaultOpenIcon>;\n /** Optional slot override for the close icon. */\n closeIcon?: SlotValue<typeof DefaultCloseIcon>;\n}\n\nconst ICON_TRANSITION_STYLE: React.CSSProperties = Object.freeze({\n transition:\n \"opacity 120ms ease-out, transform 260ms cubic-bezier(0.22, 1, 0.36, 1)\",\n});\n\nconst ICON_WRAPPER_BASE =\n \"pointer-events-none absolute inset-0 flex items-center justify-center will-change-transform\";\n\nconst BUTTON_BASE_CLASSES = cn(\n \"fixed bottom-6 right-6 z-[1100] flex h-14 w-14 items-center justify-center\",\n \"rounded-full border border-primary bg-primary text-primary-foreground\",\n \"shadow-sm transition-all duration-200 ease-out\",\n \"hover:scale-[1.04] hover:shadow-md\",\n \"cursor-pointer\",\n \"active:scale-[0.96]\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n \"disabled:pointer-events-none disabled:opacity-60\",\n);\n\nexport const CopilotChatToggleButton = React.forwardRef<\n HTMLButtonElement,\n CopilotChatToggleButtonProps\n>(function CopilotChatToggleButton(\n { openIcon, closeIcon, className, ...buttonProps },\n ref,\n) {\n const { onClick, type, disabled, ...restProps } = buttonProps;\n\n const configuration = useCopilotChatConfiguration();\n const labels = configuration?.labels ?? CopilotChatDefaultLabels;\n\n const [fallbackOpen, setFallbackOpen] = useState(false);\n\n const isOpen = configuration?.isModalOpen ?? fallbackOpen;\n const setModalOpen = configuration?.setModalOpen ?? setFallbackOpen;\n\n const handleClick = (event: MouseEvent<HTMLButtonElement>) => {\n if (disabled) {\n return;\n }\n\n if (onClick) {\n onClick(event);\n }\n\n if (event.defaultPrevented) {\n return;\n }\n\n const nextOpen = !isOpen;\n setModalOpen(nextOpen);\n };\n\n const renderedOpenIcon = renderSlot(openIcon, DefaultOpenIcon, {\n className: \"h-6 w-6\",\n \"aria-hidden\": true,\n focusable: false,\n });\n\n const renderedCloseIcon = renderSlot(closeIcon, DefaultCloseIcon, {\n className: \"h-6 w-6\",\n \"aria-hidden\": true,\n focusable: false,\n });\n\n const openIconElement = (\n <span\n aria-hidden=\"true\"\n data-slot=\"chat-toggle-button-open-icon\"\n className={ICON_WRAPPER_BASE}\n style={{\n ...ICON_TRANSITION_STYLE,\n opacity: isOpen ? 0 : 1,\n transform: `scale(${isOpen ? 0.75 : 1}) rotate(${isOpen ? 90 : 0}deg)`,\n }}\n >\n {renderedOpenIcon}\n </span>\n );\n\n const closeIconElement = (\n <span\n aria-hidden=\"true\"\n data-slot=\"chat-toggle-button-close-icon\"\n className={ICON_WRAPPER_BASE}\n style={{\n ...ICON_TRANSITION_STYLE,\n opacity: isOpen ? 1 : 0,\n transform: `scale(${isOpen ? 1 : 0.75}) rotate(${isOpen ? 0 : -90}deg)`,\n }}\n >\n {renderedCloseIcon}\n </span>\n );\n\n return (\n <button\n ref={ref}\n type={type ?? \"button\"}\n data-slot=\"chat-toggle-button\"\n data-state={isOpen ? \"open\" : \"closed\"}\n className={cn(BUTTON_BASE_CLASSES, className)}\n aria-label={\n isOpen ? labels.chatToggleCloseLabel : labels.chatToggleOpenLabel\n }\n aria-pressed={isOpen}\n disabled={disabled}\n onClick={handleClick}\n {...restProps}\n >\n {openIconElement}\n {closeIconElement}\n </button>\n );\n});\nCopilotChatToggleButton.displayName = \"CopilotChatToggleButton\";\nexport default CopilotChatToggleButton;\n\nexport {\n DefaultOpenIcon as CopilotChatToggleButtonOpenIcon,\n DefaultCloseIcon as CopilotChatToggleButtonCloseIcon,\n};\n"],"mappings":";;;;;;;;;;AAUA,MAAM,mBAA4D,EAChE,WACA,GAAG,YAEH,2CAACA;CACC,WAAWC,iBAAG,WAAW,UAAU;CACnC,aAAa;CACb,MAAK;CACL,GAAI;EACJ;AAGJ,MAAM,oBAA6D,EACjE,WACA,GAAG,YACC,2CAACC;CAAE,WAAWD,iBAAG,WAAW,UAAU;CAAE,aAAa;CAAM,GAAI;EAAS;AAE9E,gBAAgB,cAAc;AAC9B,iBAAiB,cAAc;AAY/B,MAAM,wBAA6C,OAAO,OAAO,EAC/D,YACE,0EACH,CAAC;AAEF,MAAM,oBACJ;AAEF,MAAM,sBAAsBA,iBAC1B,8EACA,yEACA,kDACA,sCACA,kBACA,uBACA,kJACA,mDACD;AAED,MAAa,0BAA0BE,cAAM,WAG3C,SAAS,wBACT,EAAE,UAAU,WAAW,WAAW,GAAG,eACrC,KACA;CACA,MAAM,EAAE,SAAS,MAAM,UAAU,GAAG,cAAc;CAElD,MAAM,gBAAgBC,sEAA6B;CACnD,MAAM,SAAS,eAAe,UAAUC;CAExC,MAAM,CAAC,cAAc,uCAA4B,MAAM;CAEvD,MAAM,SAAS,eAAe,eAAe;CAC7C,MAAM,eAAe,eAAe,gBAAgB;CAEpD,MAAM,eAAe,UAAyC;AAC5D,MAAI,SACF;AAGF,MAAI,QACF,SAAQ,MAAM;AAGhB,MAAI,MAAM,iBACR;AAIF,eADiB,CAAC,OACI;;CAGxB,MAAM,mBAAmBC,yBAAW,UAAU,iBAAiB;EAC7D,WAAW;EACX,eAAe;EACf,WAAW;EACZ,CAAC;CAEF,MAAM,oBAAoBA,yBAAW,WAAW,kBAAkB;EAChE,WAAW;EACX,eAAe;EACf,WAAW;EACZ,CAAC;CAEF,MAAM,kBACJ,2CAAC;EACC,eAAY;EACZ,aAAU;EACV,WAAW;EACX,OAAO;GACL,GAAG;GACH,SAAS,SAAS,IAAI;GACtB,WAAW,SAAS,SAAS,MAAO,EAAE,WAAW,SAAS,KAAK,EAAE;GAClE;YAEA;GACI;CAGT,MAAM,mBACJ,2CAAC;EACC,eAAY;EACZ,aAAU;EACV,WAAW;EACX,OAAO;GACL,GAAG;GACH,SAAS,SAAS,IAAI;GACtB,WAAW,SAAS,SAAS,IAAI,IAAK,WAAW,SAAS,IAAI,IAAI;GACnE;YAEA;GACI;AAGT,QACE,4CAAC;EACM;EACL,MAAM,QAAQ;EACd,aAAU;EACV,cAAY,SAAS,SAAS;EAC9B,WAAWL,iBAAG,qBAAqB,UAAU;EAC7C,cACE,SAAS,OAAO,uBAAuB,OAAO;EAEhD,gBAAc;EACJ;EACV,SAAS;EACT,GAAI;aAEH,iBACA;GACM;EAEX;AACF,wBAAwB,cAAc"}
1
+ {"version":3,"file":"CopilotChatToggleButton.cjs","names":["MessageCircle","cn","X","React","useCopilotChatConfiguration","CopilotChatDefaultLabels","renderSlot"],"sources":["../../../src/components/chat/CopilotChatToggleButton.tsx"],"sourcesContent":["import React, { useState, MouseEvent } from \"react\";\nimport { MessageCircle, X } from \"lucide-react\";\n\nimport { renderSlot, SlotValue } from \"@/lib/slots\";\nimport { cn } from \"@/lib/utils\";\nimport {\n CopilotChatDefaultLabels,\n useCopilotChatConfiguration,\n} from \"@/providers/CopilotChatConfigurationProvider\";\n\nconst DefaultOpenIcon: React.FC<React.SVGProps<SVGSVGElement>> = ({\n className,\n ...props\n}) => (\n <MessageCircle\n className={cn(\"cpk:h-6 cpk:w-6\", className)}\n strokeWidth={1.75}\n fill=\"currentColor\"\n {...props}\n />\n);\n\nconst DefaultCloseIcon: React.FC<React.SVGProps<SVGSVGElement>> = ({\n className,\n ...props\n}) => (\n <X\n className={cn(\"cpk:h-6 cpk:w-6\", className)}\n strokeWidth={1.75}\n {...props}\n />\n);\n\nDefaultOpenIcon.displayName = \"CopilotChatToggleButton.OpenIcon\";\nDefaultCloseIcon.displayName = \"CopilotChatToggleButton.CloseIcon\";\n\nexport interface CopilotChatToggleButtonProps extends Omit<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n \"children\"\n> {\n /** Optional slot override for the chat (closed) icon. */\n openIcon?: SlotValue<typeof DefaultOpenIcon>;\n /** Optional slot override for the close icon. */\n closeIcon?: SlotValue<typeof DefaultCloseIcon>;\n}\n\nconst ICON_TRANSITION_STYLE: React.CSSProperties = Object.freeze({\n transition:\n \"opacity 120ms ease-out, transform 260ms cubic-bezier(0.22, 1, 0.36, 1)\",\n});\n\nconst ICON_WRAPPER_BASE =\n \"cpk:pointer-events-none cpk:absolute cpk:inset-0 cpk:flex cpk:items-center cpk:justify-center cpk:will-change-transform\";\n\nconst BUTTON_BASE_CLASSES = cn(\n \"cpk:fixed cpk:bottom-6 cpk:right-6 cpk:z-[1100] cpk:flex cpk:h-14 cpk:w-14 cpk:items-center cpk:justify-center\",\n \"cpk:rounded-full cpk:border cpk:border-primary cpk:bg-primary cpk:text-primary-foreground\",\n \"cpk:shadow-sm cpk:transition-all cpk:duration-200 cpk:ease-out\",\n \"cpk:hover:scale-[1.04] cpk:hover:shadow-md\",\n \"cpk:cursor-pointer\",\n \"cpk:active:scale-[0.96]\",\n \"cpk:focus-visible:outline-none cpk:focus-visible:ring-2 cpk:focus-visible:ring-primary/50 cpk:focus-visible:ring-offset-2 cpk:focus-visible:ring-offset-background\",\n \"cpk:disabled:pointer-events-none cpk:disabled:opacity-60\",\n);\n\nexport const CopilotChatToggleButton = React.forwardRef<\n HTMLButtonElement,\n CopilotChatToggleButtonProps\n>(function CopilotChatToggleButton(\n { openIcon, closeIcon, className, ...buttonProps },\n ref,\n) {\n const { onClick, type, disabled, ...restProps } = buttonProps;\n\n const configuration = useCopilotChatConfiguration();\n const labels = configuration?.labels ?? CopilotChatDefaultLabels;\n\n const [fallbackOpen, setFallbackOpen] = useState(false);\n\n const isOpen = configuration?.isModalOpen ?? fallbackOpen;\n const setModalOpen = configuration?.setModalOpen ?? setFallbackOpen;\n\n const handleClick = (event: MouseEvent<HTMLButtonElement>) => {\n if (disabled) {\n return;\n }\n\n if (onClick) {\n onClick(event);\n }\n\n if (event.defaultPrevented) {\n return;\n }\n\n const nextOpen = !isOpen;\n setModalOpen(nextOpen);\n };\n\n const renderedOpenIcon = renderSlot(openIcon, DefaultOpenIcon, {\n className: \"cpk:h-6 cpk:w-6\",\n \"aria-hidden\": true,\n focusable: false,\n });\n\n const renderedCloseIcon = renderSlot(closeIcon, DefaultCloseIcon, {\n className: \"cpk:h-6 cpk:w-6\",\n \"aria-hidden\": true,\n focusable: false,\n });\n\n const openIconElement = (\n <span\n aria-hidden=\"true\"\n data-slot=\"chat-toggle-button-open-icon\"\n className={ICON_WRAPPER_BASE}\n style={{\n ...ICON_TRANSITION_STYLE,\n opacity: isOpen ? 0 : 1,\n transform: `scale(${isOpen ? 0.75 : 1}) rotate(${isOpen ? 90 : 0}deg)`,\n }}\n >\n {renderedOpenIcon}\n </span>\n );\n\n const closeIconElement = (\n <span\n aria-hidden=\"true\"\n data-slot=\"chat-toggle-button-close-icon\"\n className={ICON_WRAPPER_BASE}\n style={{\n ...ICON_TRANSITION_STYLE,\n opacity: isOpen ? 1 : 0,\n transform: `scale(${isOpen ? 1 : 0.75}) rotate(${isOpen ? 0 : -90}deg)`,\n }}\n >\n {renderedCloseIcon}\n </span>\n );\n\n return (\n <button\n ref={ref}\n type={type ?? \"button\"}\n data-copilotkit\n data-slot=\"chat-toggle-button\"\n data-state={isOpen ? \"open\" : \"closed\"}\n className={cn(BUTTON_BASE_CLASSES, className)}\n aria-label={\n isOpen ? labels.chatToggleCloseLabel : labels.chatToggleOpenLabel\n }\n aria-pressed={isOpen}\n disabled={disabled}\n onClick={handleClick}\n {...restProps}\n >\n {openIconElement}\n {closeIconElement}\n </button>\n );\n});\nCopilotChatToggleButton.displayName = \"CopilotChatToggleButton\";\nexport default CopilotChatToggleButton;\n\nexport {\n DefaultOpenIcon as CopilotChatToggleButtonOpenIcon,\n DefaultCloseIcon as CopilotChatToggleButtonCloseIcon,\n};\n"],"mappings":";;;;;;;;;;AAUA,MAAM,mBAA4D,EAChE,WACA,GAAG,YAEH,2CAACA;CACC,WAAWC,iBAAG,mBAAmB,UAAU;CAC3C,aAAa;CACb,MAAK;CACL,GAAI;EACJ;AAGJ,MAAM,oBAA6D,EACjE,WACA,GAAG,YAEH,2CAACC;CACC,WAAWD,iBAAG,mBAAmB,UAAU;CAC3C,aAAa;CACb,GAAI;EACJ;AAGJ,gBAAgB,cAAc;AAC9B,iBAAiB,cAAc;AAY/B,MAAM,wBAA6C,OAAO,OAAO,EAC/D,YACE,0EACH,CAAC;AAEF,MAAM,oBACJ;AAEF,MAAM,sBAAsBA,iBAC1B,kHACA,6FACA,kEACA,8CACA,sBACA,2BACA,sKACA,2DACD;AAED,MAAa,0BAA0BE,cAAM,WAG3C,SAAS,wBACT,EAAE,UAAU,WAAW,WAAW,GAAG,eACrC,KACA;CACA,MAAM,EAAE,SAAS,MAAM,UAAU,GAAG,cAAc;CAElD,MAAM,gBAAgBC,sEAA6B;CACnD,MAAM,SAAS,eAAe,UAAUC;CAExC,MAAM,CAAC,cAAc,uCAA4B,MAAM;CAEvD,MAAM,SAAS,eAAe,eAAe;CAC7C,MAAM,eAAe,eAAe,gBAAgB;CAEpD,MAAM,eAAe,UAAyC;AAC5D,MAAI,SACF;AAGF,MAAI,QACF,SAAQ,MAAM;AAGhB,MAAI,MAAM,iBACR;AAIF,eADiB,CAAC,OACI;;CAGxB,MAAM,mBAAmBC,yBAAW,UAAU,iBAAiB;EAC7D,WAAW;EACX,eAAe;EACf,WAAW;EACZ,CAAC;CAEF,MAAM,oBAAoBA,yBAAW,WAAW,kBAAkB;EAChE,WAAW;EACX,eAAe;EACf,WAAW;EACZ,CAAC;CAEF,MAAM,kBACJ,2CAAC;EACC,eAAY;EACZ,aAAU;EACV,WAAW;EACX,OAAO;GACL,GAAG;GACH,SAAS,SAAS,IAAI;GACtB,WAAW,SAAS,SAAS,MAAO,EAAE,WAAW,SAAS,KAAK,EAAE;GAClE;YAEA;GACI;CAGT,MAAM,mBACJ,2CAAC;EACC,eAAY;EACZ,aAAU;EACV,WAAW;EACX,OAAO;GACL,GAAG;GACH,SAAS,SAAS,IAAI;GACtB,WAAW,SAAS,SAAS,IAAI,IAAK,WAAW,SAAS,IAAI,IAAI;GACnE;YAEA;GACI;AAGT,QACE,4CAAC;EACM;EACL,MAAM,QAAQ;EACd;EACA,aAAU;EACV,cAAY,SAAS,SAAS;EAC9B,WAAWL,iBAAG,qBAAqB,UAAU;EAC7C,cACE,SAAS,OAAO,uBAAuB,OAAO;EAEhD,gBAAc;EACJ;EACV,SAAS;EACT,GAAI;aAEH,iBACA;GACM;EAEX;AACF,wBAAwB,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"CopilotChatToggleButton.d.cts","names":[],"sources":["../../../src/components/chat/CopilotChatToggleButton.tsx"],"mappings":";;;;cAUM,eAAA,EAAiB,KAAA,CAAM,EAAA,CAAG,KAAA,CAAM,QAAA,CAAS,aAAA;AAAA,cAYzC,gBAAA,EAAkB,KAAA,CAAM,EAAA,CAAG,KAAA,CAAM,QAAA,CAAS,aAAA;AAAA,UAQ/B,4BAAA,SAAqC,IAAA,CACpD,KAAA,CAAM,oBAAA,CAAqB,iBAAA;EAX5B;EAeC,QAAA,GAAW,SAAA,QAAiB,eAAA;EAzBiB;EA2B7C,SAAA,GAAY,SAAA,QAAiB,gBAAA;AAAA;AAAA,cAsBlB,uBAAA,EAAuB,KAAA,CAAA,yBAAA,CAAA,4BAAA,GAAA,KAAA,CAAA,aAAA,CAAA,iBAAA"}
1
+ {"version":3,"file":"CopilotChatToggleButton.d.cts","names":[],"sources":["../../../src/components/chat/CopilotChatToggleButton.tsx"],"mappings":";;;;cAUM,eAAA,EAAiB,KAAA,CAAM,EAAA,CAAG,KAAA,CAAM,QAAA,CAAS,aAAA;AAAA,cAYzC,gBAAA,EAAkB,KAAA,CAAM,EAAA,CAAG,KAAA,CAAM,QAAA,CAAS,aAAA;AAAA,UAc/B,4BAAA,SAAqC,IAAA,CACpD,KAAA,CAAM,oBAAA,CAAqB,iBAAA;EAjB5B;EAqBC,QAAA,GAAW,SAAA,QAAiB,eAAA;EA/BiB;EAiC7C,SAAA,GAAY,SAAA,QAAiB,gBAAA;AAAA;AAAA,cAsBlB,uBAAA,EAAuB,KAAA,CAAA,yBAAA,CAAA,4BAAA,GAAA,KAAA,CAAA,aAAA,CAAA,iBAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"CopilotChatToggleButton.d.mts","names":[],"sources":["../../../src/components/chat/CopilotChatToggleButton.tsx"],"mappings":";;;;cAUM,eAAA,EAAiB,KAAA,CAAM,EAAA,CAAG,KAAA,CAAM,QAAA,CAAS,aAAA;AAAA,cAYzC,gBAAA,EAAkB,KAAA,CAAM,EAAA,CAAG,KAAA,CAAM,QAAA,CAAS,aAAA;AAAA,UAQ/B,4BAAA,SAAqC,IAAA,CACpD,KAAA,CAAM,oBAAA,CAAqB,iBAAA;EAX5B;EAeC,QAAA,GAAW,SAAA,QAAiB,eAAA;EAzBiB;EA2B7C,SAAA,GAAY,SAAA,QAAiB,gBAAA;AAAA;AAAA,cAsBlB,uBAAA,EAAuB,KAAA,CAAA,yBAAA,CAAA,4BAAA,GAAA,KAAA,CAAA,aAAA,CAAA,iBAAA"}
1
+ {"version":3,"file":"CopilotChatToggleButton.d.mts","names":[],"sources":["../../../src/components/chat/CopilotChatToggleButton.tsx"],"mappings":";;;;cAUM,eAAA,EAAiB,KAAA,CAAM,EAAA,CAAG,KAAA,CAAM,QAAA,CAAS,aAAA;AAAA,cAYzC,gBAAA,EAAkB,KAAA,CAAM,EAAA,CAAG,KAAA,CAAM,QAAA,CAAS,aAAA;AAAA,UAc/B,4BAAA,SAAqC,IAAA,CACpD,KAAA,CAAM,oBAAA,CAAqB,iBAAA;EAjB5B;EAqBC,QAAA,GAAW,SAAA,QAAiB,eAAA;EA/BiB;EAiC7C,SAAA,GAAY,SAAA,QAAiB,gBAAA;AAAA;AAAA,cAsBlB,uBAAA,EAAuB,KAAA,CAAA,yBAAA,CAAA,4BAAA,GAAA,KAAA,CAAA,aAAA,CAAA,iBAAA"}
@@ -7,21 +7,21 @@ import { jsx, jsxs } from "react/jsx-runtime";
7
7
 
8
8
  //#region src/components/chat/CopilotChatToggleButton.tsx
9
9
  const DefaultOpenIcon = ({ className, ...props }) => /* @__PURE__ */ jsx(MessageCircle, {
10
- className: cn("h-6 w-6", className),
10
+ className: cn("cpk:h-6 cpk:w-6", className),
11
11
  strokeWidth: 1.75,
12
12
  fill: "currentColor",
13
13
  ...props
14
14
  });
15
15
  const DefaultCloseIcon = ({ className, ...props }) => /* @__PURE__ */ jsx(X, {
16
- className: cn("h-6 w-6", className),
16
+ className: cn("cpk:h-6 cpk:w-6", className),
17
17
  strokeWidth: 1.75,
18
18
  ...props
19
19
  });
20
20
  DefaultOpenIcon.displayName = "CopilotChatToggleButton.OpenIcon";
21
21
  DefaultCloseIcon.displayName = "CopilotChatToggleButton.CloseIcon";
22
22
  const ICON_TRANSITION_STYLE = Object.freeze({ transition: "opacity 120ms ease-out, transform 260ms cubic-bezier(0.22, 1, 0.36, 1)" });
23
- const ICON_WRAPPER_BASE = "pointer-events-none absolute inset-0 flex items-center justify-center will-change-transform";
24
- const BUTTON_BASE_CLASSES = cn("fixed bottom-6 right-6 z-[1100] flex h-14 w-14 items-center justify-center", "rounded-full border border-primary bg-primary text-primary-foreground", "shadow-sm transition-all duration-200 ease-out", "hover:scale-[1.04] hover:shadow-md", "cursor-pointer", "active:scale-[0.96]", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background", "disabled:pointer-events-none disabled:opacity-60");
23
+ const ICON_WRAPPER_BASE = "cpk:pointer-events-none cpk:absolute cpk:inset-0 cpk:flex cpk:items-center cpk:justify-center cpk:will-change-transform";
24
+ const BUTTON_BASE_CLASSES = cn("cpk:fixed cpk:bottom-6 cpk:right-6 cpk:z-[1100] cpk:flex cpk:h-14 cpk:w-14 cpk:items-center cpk:justify-center", "cpk:rounded-full cpk:border cpk:border-primary cpk:bg-primary cpk:text-primary-foreground", "cpk:shadow-sm cpk:transition-all cpk:duration-200 cpk:ease-out", "cpk:hover:scale-[1.04] cpk:hover:shadow-md", "cpk:cursor-pointer", "cpk:active:scale-[0.96]", "cpk:focus-visible:outline-none cpk:focus-visible:ring-2 cpk:focus-visible:ring-primary/50 cpk:focus-visible:ring-offset-2 cpk:focus-visible:ring-offset-background", "cpk:disabled:pointer-events-none cpk:disabled:opacity-60");
25
25
  const CopilotChatToggleButton = React.forwardRef(function CopilotChatToggleButton({ openIcon, closeIcon, className, ...buttonProps }, ref) {
26
26
  const { onClick, type, disabled, ...restProps } = buttonProps;
27
27
  const configuration = useCopilotChatConfiguration();
@@ -36,12 +36,12 @@ const CopilotChatToggleButton = React.forwardRef(function CopilotChatToggleButto
36
36
  setModalOpen(!isOpen);
37
37
  };
38
38
  const renderedOpenIcon = renderSlot(openIcon, DefaultOpenIcon, {
39
- className: "h-6 w-6",
39
+ className: "cpk:h-6 cpk:w-6",
40
40
  "aria-hidden": true,
41
41
  focusable: false
42
42
  });
43
43
  const renderedCloseIcon = renderSlot(closeIcon, DefaultCloseIcon, {
44
- className: "h-6 w-6",
44
+ className: "cpk:h-6 cpk:w-6",
45
45
  "aria-hidden": true,
46
46
  focusable: false
47
47
  });
@@ -70,6 +70,7 @@ const CopilotChatToggleButton = React.forwardRef(function CopilotChatToggleButto
70
70
  return /* @__PURE__ */ jsxs("button", {
71
71
  ref,
72
72
  type: type ?? "button",
73
+ "data-copilotkit": true,
73
74
  "data-slot": "chat-toggle-button",
74
75
  "data-state": isOpen ? "open" : "closed",
75
76
  className: cn(BUTTON_BASE_CLASSES, className),
@@ -1 +1 @@
1
- {"version":3,"file":"CopilotChatToggleButton.mjs","names":[],"sources":["../../../src/components/chat/CopilotChatToggleButton.tsx"],"sourcesContent":["import React, { useState, MouseEvent } from \"react\";\nimport { MessageCircle, X } from \"lucide-react\";\n\nimport { renderSlot, SlotValue } from \"@/lib/slots\";\nimport { cn } from \"@/lib/utils\";\nimport {\n CopilotChatDefaultLabels,\n useCopilotChatConfiguration,\n} from \"@/providers/CopilotChatConfigurationProvider\";\n\nconst DefaultOpenIcon: React.FC<React.SVGProps<SVGSVGElement>> = ({\n className,\n ...props\n}) => (\n <MessageCircle\n className={cn(\"h-6 w-6\", className)}\n strokeWidth={1.75}\n fill=\"currentColor\"\n {...props}\n />\n);\n\nconst DefaultCloseIcon: React.FC<React.SVGProps<SVGSVGElement>> = ({\n className,\n ...props\n}) => <X className={cn(\"h-6 w-6\", className)} strokeWidth={1.75} {...props} />;\n\nDefaultOpenIcon.displayName = \"CopilotChatToggleButton.OpenIcon\";\nDefaultCloseIcon.displayName = \"CopilotChatToggleButton.CloseIcon\";\n\nexport interface CopilotChatToggleButtonProps extends Omit<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n \"children\"\n> {\n /** Optional slot override for the chat (closed) icon. */\n openIcon?: SlotValue<typeof DefaultOpenIcon>;\n /** Optional slot override for the close icon. */\n closeIcon?: SlotValue<typeof DefaultCloseIcon>;\n}\n\nconst ICON_TRANSITION_STYLE: React.CSSProperties = Object.freeze({\n transition:\n \"opacity 120ms ease-out, transform 260ms cubic-bezier(0.22, 1, 0.36, 1)\",\n});\n\nconst ICON_WRAPPER_BASE =\n \"pointer-events-none absolute inset-0 flex items-center justify-center will-change-transform\";\n\nconst BUTTON_BASE_CLASSES = cn(\n \"fixed bottom-6 right-6 z-[1100] flex h-14 w-14 items-center justify-center\",\n \"rounded-full border border-primary bg-primary text-primary-foreground\",\n \"shadow-sm transition-all duration-200 ease-out\",\n \"hover:scale-[1.04] hover:shadow-md\",\n \"cursor-pointer\",\n \"active:scale-[0.96]\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n \"disabled:pointer-events-none disabled:opacity-60\",\n);\n\nexport const CopilotChatToggleButton = React.forwardRef<\n HTMLButtonElement,\n CopilotChatToggleButtonProps\n>(function CopilotChatToggleButton(\n { openIcon, closeIcon, className, ...buttonProps },\n ref,\n) {\n const { onClick, type, disabled, ...restProps } = buttonProps;\n\n const configuration = useCopilotChatConfiguration();\n const labels = configuration?.labels ?? CopilotChatDefaultLabels;\n\n const [fallbackOpen, setFallbackOpen] = useState(false);\n\n const isOpen = configuration?.isModalOpen ?? fallbackOpen;\n const setModalOpen = configuration?.setModalOpen ?? setFallbackOpen;\n\n const handleClick = (event: MouseEvent<HTMLButtonElement>) => {\n if (disabled) {\n return;\n }\n\n if (onClick) {\n onClick(event);\n }\n\n if (event.defaultPrevented) {\n return;\n }\n\n const nextOpen = !isOpen;\n setModalOpen(nextOpen);\n };\n\n const renderedOpenIcon = renderSlot(openIcon, DefaultOpenIcon, {\n className: \"h-6 w-6\",\n \"aria-hidden\": true,\n focusable: false,\n });\n\n const renderedCloseIcon = renderSlot(closeIcon, DefaultCloseIcon, {\n className: \"h-6 w-6\",\n \"aria-hidden\": true,\n focusable: false,\n });\n\n const openIconElement = (\n <span\n aria-hidden=\"true\"\n data-slot=\"chat-toggle-button-open-icon\"\n className={ICON_WRAPPER_BASE}\n style={{\n ...ICON_TRANSITION_STYLE,\n opacity: isOpen ? 0 : 1,\n transform: `scale(${isOpen ? 0.75 : 1}) rotate(${isOpen ? 90 : 0}deg)`,\n }}\n >\n {renderedOpenIcon}\n </span>\n );\n\n const closeIconElement = (\n <span\n aria-hidden=\"true\"\n data-slot=\"chat-toggle-button-close-icon\"\n className={ICON_WRAPPER_BASE}\n style={{\n ...ICON_TRANSITION_STYLE,\n opacity: isOpen ? 1 : 0,\n transform: `scale(${isOpen ? 1 : 0.75}) rotate(${isOpen ? 0 : -90}deg)`,\n }}\n >\n {renderedCloseIcon}\n </span>\n );\n\n return (\n <button\n ref={ref}\n type={type ?? \"button\"}\n data-slot=\"chat-toggle-button\"\n data-state={isOpen ? \"open\" : \"closed\"}\n className={cn(BUTTON_BASE_CLASSES, className)}\n aria-label={\n isOpen ? labels.chatToggleCloseLabel : labels.chatToggleOpenLabel\n }\n aria-pressed={isOpen}\n disabled={disabled}\n onClick={handleClick}\n {...restProps}\n >\n {openIconElement}\n {closeIconElement}\n </button>\n );\n});\nCopilotChatToggleButton.displayName = \"CopilotChatToggleButton\";\nexport default CopilotChatToggleButton;\n\nexport {\n DefaultOpenIcon as CopilotChatToggleButtonOpenIcon,\n DefaultCloseIcon as CopilotChatToggleButtonCloseIcon,\n};\n"],"mappings":";;;;;;;;AAUA,MAAM,mBAA4D,EAChE,WACA,GAAG,YAEH,oBAAC;CACC,WAAW,GAAG,WAAW,UAAU;CACnC,aAAa;CACb,MAAK;CACL,GAAI;EACJ;AAGJ,MAAM,oBAA6D,EACjE,WACA,GAAG,YACC,oBAAC;CAAE,WAAW,GAAG,WAAW,UAAU;CAAE,aAAa;CAAM,GAAI;EAAS;AAE9E,gBAAgB,cAAc;AAC9B,iBAAiB,cAAc;AAY/B,MAAM,wBAA6C,OAAO,OAAO,EAC/D,YACE,0EACH,CAAC;AAEF,MAAM,oBACJ;AAEF,MAAM,sBAAsB,GAC1B,8EACA,yEACA,kDACA,sCACA,kBACA,uBACA,kJACA,mDACD;AAED,MAAa,0BAA0B,MAAM,WAG3C,SAAS,wBACT,EAAE,UAAU,WAAW,WAAW,GAAG,eACrC,KACA;CACA,MAAM,EAAE,SAAS,MAAM,UAAU,GAAG,cAAc;CAElD,MAAM,gBAAgB,6BAA6B;CACnD,MAAM,SAAS,eAAe,UAAU;CAExC,MAAM,CAAC,cAAc,mBAAmB,SAAS,MAAM;CAEvD,MAAM,SAAS,eAAe,eAAe;CAC7C,MAAM,eAAe,eAAe,gBAAgB;CAEpD,MAAM,eAAe,UAAyC;AAC5D,MAAI,SACF;AAGF,MAAI,QACF,SAAQ,MAAM;AAGhB,MAAI,MAAM,iBACR;AAIF,eADiB,CAAC,OACI;;CAGxB,MAAM,mBAAmB,WAAW,UAAU,iBAAiB;EAC7D,WAAW;EACX,eAAe;EACf,WAAW;EACZ,CAAC;CAEF,MAAM,oBAAoB,WAAW,WAAW,kBAAkB;EAChE,WAAW;EACX,eAAe;EACf,WAAW;EACZ,CAAC;CAEF,MAAM,kBACJ,oBAAC;EACC,eAAY;EACZ,aAAU;EACV,WAAW;EACX,OAAO;GACL,GAAG;GACH,SAAS,SAAS,IAAI;GACtB,WAAW,SAAS,SAAS,MAAO,EAAE,WAAW,SAAS,KAAK,EAAE;GAClE;YAEA;GACI;CAGT,MAAM,mBACJ,oBAAC;EACC,eAAY;EACZ,aAAU;EACV,WAAW;EACX,OAAO;GACL,GAAG;GACH,SAAS,SAAS,IAAI;GACtB,WAAW,SAAS,SAAS,IAAI,IAAK,WAAW,SAAS,IAAI,IAAI;GACnE;YAEA;GACI;AAGT,QACE,qBAAC;EACM;EACL,MAAM,QAAQ;EACd,aAAU;EACV,cAAY,SAAS,SAAS;EAC9B,WAAW,GAAG,qBAAqB,UAAU;EAC7C,cACE,SAAS,OAAO,uBAAuB,OAAO;EAEhD,gBAAc;EACJ;EACV,SAAS;EACT,GAAI;aAEH,iBACA;GACM;EAEX;AACF,wBAAwB,cAAc"}
1
+ {"version":3,"file":"CopilotChatToggleButton.mjs","names":[],"sources":["../../../src/components/chat/CopilotChatToggleButton.tsx"],"sourcesContent":["import React, { useState, MouseEvent } from \"react\";\nimport { MessageCircle, X } from \"lucide-react\";\n\nimport { renderSlot, SlotValue } from \"@/lib/slots\";\nimport { cn } from \"@/lib/utils\";\nimport {\n CopilotChatDefaultLabels,\n useCopilotChatConfiguration,\n} from \"@/providers/CopilotChatConfigurationProvider\";\n\nconst DefaultOpenIcon: React.FC<React.SVGProps<SVGSVGElement>> = ({\n className,\n ...props\n}) => (\n <MessageCircle\n className={cn(\"cpk:h-6 cpk:w-6\", className)}\n strokeWidth={1.75}\n fill=\"currentColor\"\n {...props}\n />\n);\n\nconst DefaultCloseIcon: React.FC<React.SVGProps<SVGSVGElement>> = ({\n className,\n ...props\n}) => (\n <X\n className={cn(\"cpk:h-6 cpk:w-6\", className)}\n strokeWidth={1.75}\n {...props}\n />\n);\n\nDefaultOpenIcon.displayName = \"CopilotChatToggleButton.OpenIcon\";\nDefaultCloseIcon.displayName = \"CopilotChatToggleButton.CloseIcon\";\n\nexport interface CopilotChatToggleButtonProps extends Omit<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n \"children\"\n> {\n /** Optional slot override for the chat (closed) icon. */\n openIcon?: SlotValue<typeof DefaultOpenIcon>;\n /** Optional slot override for the close icon. */\n closeIcon?: SlotValue<typeof DefaultCloseIcon>;\n}\n\nconst ICON_TRANSITION_STYLE: React.CSSProperties = Object.freeze({\n transition:\n \"opacity 120ms ease-out, transform 260ms cubic-bezier(0.22, 1, 0.36, 1)\",\n});\n\nconst ICON_WRAPPER_BASE =\n \"cpk:pointer-events-none cpk:absolute cpk:inset-0 cpk:flex cpk:items-center cpk:justify-center cpk:will-change-transform\";\n\nconst BUTTON_BASE_CLASSES = cn(\n \"cpk:fixed cpk:bottom-6 cpk:right-6 cpk:z-[1100] cpk:flex cpk:h-14 cpk:w-14 cpk:items-center cpk:justify-center\",\n \"cpk:rounded-full cpk:border cpk:border-primary cpk:bg-primary cpk:text-primary-foreground\",\n \"cpk:shadow-sm cpk:transition-all cpk:duration-200 cpk:ease-out\",\n \"cpk:hover:scale-[1.04] cpk:hover:shadow-md\",\n \"cpk:cursor-pointer\",\n \"cpk:active:scale-[0.96]\",\n \"cpk:focus-visible:outline-none cpk:focus-visible:ring-2 cpk:focus-visible:ring-primary/50 cpk:focus-visible:ring-offset-2 cpk:focus-visible:ring-offset-background\",\n \"cpk:disabled:pointer-events-none cpk:disabled:opacity-60\",\n);\n\nexport const CopilotChatToggleButton = React.forwardRef<\n HTMLButtonElement,\n CopilotChatToggleButtonProps\n>(function CopilotChatToggleButton(\n { openIcon, closeIcon, className, ...buttonProps },\n ref,\n) {\n const { onClick, type, disabled, ...restProps } = buttonProps;\n\n const configuration = useCopilotChatConfiguration();\n const labels = configuration?.labels ?? CopilotChatDefaultLabels;\n\n const [fallbackOpen, setFallbackOpen] = useState(false);\n\n const isOpen = configuration?.isModalOpen ?? fallbackOpen;\n const setModalOpen = configuration?.setModalOpen ?? setFallbackOpen;\n\n const handleClick = (event: MouseEvent<HTMLButtonElement>) => {\n if (disabled) {\n return;\n }\n\n if (onClick) {\n onClick(event);\n }\n\n if (event.defaultPrevented) {\n return;\n }\n\n const nextOpen = !isOpen;\n setModalOpen(nextOpen);\n };\n\n const renderedOpenIcon = renderSlot(openIcon, DefaultOpenIcon, {\n className: \"cpk:h-6 cpk:w-6\",\n \"aria-hidden\": true,\n focusable: false,\n });\n\n const renderedCloseIcon = renderSlot(closeIcon, DefaultCloseIcon, {\n className: \"cpk:h-6 cpk:w-6\",\n \"aria-hidden\": true,\n focusable: false,\n });\n\n const openIconElement = (\n <span\n aria-hidden=\"true\"\n data-slot=\"chat-toggle-button-open-icon\"\n className={ICON_WRAPPER_BASE}\n style={{\n ...ICON_TRANSITION_STYLE,\n opacity: isOpen ? 0 : 1,\n transform: `scale(${isOpen ? 0.75 : 1}) rotate(${isOpen ? 90 : 0}deg)`,\n }}\n >\n {renderedOpenIcon}\n </span>\n );\n\n const closeIconElement = (\n <span\n aria-hidden=\"true\"\n data-slot=\"chat-toggle-button-close-icon\"\n className={ICON_WRAPPER_BASE}\n style={{\n ...ICON_TRANSITION_STYLE,\n opacity: isOpen ? 1 : 0,\n transform: `scale(${isOpen ? 1 : 0.75}) rotate(${isOpen ? 0 : -90}deg)`,\n }}\n >\n {renderedCloseIcon}\n </span>\n );\n\n return (\n <button\n ref={ref}\n type={type ?? \"button\"}\n data-copilotkit\n data-slot=\"chat-toggle-button\"\n data-state={isOpen ? \"open\" : \"closed\"}\n className={cn(BUTTON_BASE_CLASSES, className)}\n aria-label={\n isOpen ? labels.chatToggleCloseLabel : labels.chatToggleOpenLabel\n }\n aria-pressed={isOpen}\n disabled={disabled}\n onClick={handleClick}\n {...restProps}\n >\n {openIconElement}\n {closeIconElement}\n </button>\n );\n});\nCopilotChatToggleButton.displayName = \"CopilotChatToggleButton\";\nexport default CopilotChatToggleButton;\n\nexport {\n DefaultOpenIcon as CopilotChatToggleButtonOpenIcon,\n DefaultCloseIcon as CopilotChatToggleButtonCloseIcon,\n};\n"],"mappings":";;;;;;;;AAUA,MAAM,mBAA4D,EAChE,WACA,GAAG,YAEH,oBAAC;CACC,WAAW,GAAG,mBAAmB,UAAU;CAC3C,aAAa;CACb,MAAK;CACL,GAAI;EACJ;AAGJ,MAAM,oBAA6D,EACjE,WACA,GAAG,YAEH,oBAAC;CACC,WAAW,GAAG,mBAAmB,UAAU;CAC3C,aAAa;CACb,GAAI;EACJ;AAGJ,gBAAgB,cAAc;AAC9B,iBAAiB,cAAc;AAY/B,MAAM,wBAA6C,OAAO,OAAO,EAC/D,YACE,0EACH,CAAC;AAEF,MAAM,oBACJ;AAEF,MAAM,sBAAsB,GAC1B,kHACA,6FACA,kEACA,8CACA,sBACA,2BACA,sKACA,2DACD;AAED,MAAa,0BAA0B,MAAM,WAG3C,SAAS,wBACT,EAAE,UAAU,WAAW,WAAW,GAAG,eACrC,KACA;CACA,MAAM,EAAE,SAAS,MAAM,UAAU,GAAG,cAAc;CAElD,MAAM,gBAAgB,6BAA6B;CACnD,MAAM,SAAS,eAAe,UAAU;CAExC,MAAM,CAAC,cAAc,mBAAmB,SAAS,MAAM;CAEvD,MAAM,SAAS,eAAe,eAAe;CAC7C,MAAM,eAAe,eAAe,gBAAgB;CAEpD,MAAM,eAAe,UAAyC;AAC5D,MAAI,SACF;AAGF,MAAI,QACF,SAAQ,MAAM;AAGhB,MAAI,MAAM,iBACR;AAIF,eADiB,CAAC,OACI;;CAGxB,MAAM,mBAAmB,WAAW,UAAU,iBAAiB;EAC7D,WAAW;EACX,eAAe;EACf,WAAW;EACZ,CAAC;CAEF,MAAM,oBAAoB,WAAW,WAAW,kBAAkB;EAChE,WAAW;EACX,eAAe;EACf,WAAW;EACZ,CAAC;CAEF,MAAM,kBACJ,oBAAC;EACC,eAAY;EACZ,aAAU;EACV,WAAW;EACX,OAAO;GACL,GAAG;GACH,SAAS,SAAS,IAAI;GACtB,WAAW,SAAS,SAAS,MAAO,EAAE,WAAW,SAAS,KAAK,EAAE;GAClE;YAEA;GACI;CAGT,MAAM,mBACJ,oBAAC;EACC,eAAY;EACZ,aAAU;EACV,WAAW;EACX,OAAO;GACL,GAAG;GACH,SAAS,SAAS,IAAI;GACtB,WAAW,SAAS,SAAS,IAAI,IAAK,WAAW,SAAS,IAAI,IAAI;GACnE;YAEA;GACI;AAGT,QACE,qBAAC;EACM;EACL,MAAM,QAAQ;EACd;EACA,aAAU;EACV,cAAY,SAAS,SAAS;EAC9B,WAAW,GAAG,qBAAqB,UAAU;EAC7C,cACE,SAAS,OAAO,uBAAuB,OAAO;EAEhD,gBAAc;EACJ;EACV,SAAS;EACT,GAAI;aAEH,iBACA;GACM;EAEX;AACF,wBAAwB,cAAc"}
@@ -36,7 +36,7 @@ function CopilotChatUserMessage({ message, onEditMessage, branchIndex, numberOfB
36
36
  });
37
37
  const showBranchNavigation = numberOfBranches && numberOfBranches > 1 && onSwitchToBranch;
38
38
  const BoundToolbar = require_slots.renderSlot(toolbar, CopilotChatUserMessage.Toolbar, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
39
- className: "flex items-center gap-1 justify-end",
39
+ className: "cpk:flex cpk:items-center cpk:gap-1 cpk:justify-end",
40
40
  children: [
41
41
  additionalToolbarItems,
42
42
  BoundCopyButton,
@@ -44,19 +44,24 @@ function CopilotChatUserMessage({ message, onEditMessage, branchIndex, numberOfB
44
44
  showBranchNavigation && BoundBranchNavigation
45
45
  ]
46
46
  }) });
47
- if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: children({
48
- messageRenderer: BoundMessageRenderer,
49
- toolbar: BoundToolbar,
50
- copyButton: BoundCopyButton,
51
- editButton: BoundEditButton,
52
- branchNavigation: BoundBranchNavigation,
53
- message,
54
- branchIndex,
55
- numberOfBranches,
56
- additionalToolbarItems
57
- }) });
47
+ if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
48
+ "data-copilotkit": true,
49
+ style: { display: "contents" },
50
+ children: children({
51
+ messageRenderer: BoundMessageRenderer,
52
+ toolbar: BoundToolbar,
53
+ copyButton: BoundCopyButton,
54
+ editButton: BoundEditButton,
55
+ branchNavigation: BoundBranchNavigation,
56
+ message,
57
+ branchIndex,
58
+ numberOfBranches,
59
+ additionalToolbarItems
60
+ })
61
+ });
58
62
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
59
- className: (0, tailwind_merge.twMerge)("flex flex-col items-end group pt-10", className),
63
+ "data-copilotkit": true,
64
+ className: (0, tailwind_merge.twMerge)("cpk:flex cpk:flex-col cpk:items-end cpk:group cpk:pt-10", className),
60
65
  "data-message-id": message.id,
61
66
  ...props,
62
67
  children: [BoundMessageRenderer, BoundToolbar]
@@ -64,16 +69,16 @@ function CopilotChatUserMessage({ message, onEditMessage, branchIndex, numberOfB
64
69
  }
65
70
  (function(_CopilotChatUserMessage) {
66
71
  _CopilotChatUserMessage.Container = ({ children, className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
67
- className: (0, tailwind_merge.twMerge)("flex flex-col items-end group", className),
72
+ className: (0, tailwind_merge.twMerge)("cpk:flex cpk:flex-col cpk:items-end cpk:group", className),
68
73
  ...props,
69
74
  children
70
75
  });
71
76
  _CopilotChatUserMessage.MessageRenderer = ({ content, className }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
72
- className: (0, tailwind_merge.twMerge)("prose dark:prose-invert bg-muted relative max-w-[80%] rounded-[18px] px-4 py-1.5 data-[multiline]:py-3 inline-block whitespace-pre-wrap", className),
77
+ className: (0, tailwind_merge.twMerge)("cpk:prose cpk:dark:prose-invert cpk:bg-muted cpk:relative cpk:max-w-[80%] cpk:rounded-[18px] cpk:px-4 cpk:py-1.5 cpk:data-[multiline]:py-3 cpk:inline-block cpk:whitespace-pre-wrap", className),
73
78
  children: content
74
79
  });
75
80
  _CopilotChatUserMessage.Toolbar = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
76
- className: (0, tailwind_merge.twMerge)("w-full bg-transparent flex items-center justify-end -mr-[5px] mt-[4px] invisible group-hover:visible", className),
81
+ className: (0, tailwind_merge.twMerge)("cpk:w-full cpk:bg-transparent cpk:flex cpk:items-center cpk:justify-end cpk:-mr-[5px] cpk:mt-[4px] cpk:invisible cpk:group-hover:visible", className),
77
82
  ...props
78
83
  });
79
84
  const ToolbarButton = _CopilotChatUserMessage.ToolbarButton = ({ title, children, className, ...props }) => {
@@ -105,7 +110,7 @@ function CopilotChatUserMessage({ message, onEditMessage, branchIndex, numberOfB
105
110
  onClick: handleClick,
106
111
  className,
107
112
  ...props,
108
- children: copied ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, { className: "size-[18px]" }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Copy, { className: "size-[18px]" })
113
+ children: copied ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, { className: "cpk:size-[18px]" }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Copy, { className: "cpk:size-[18px]" })
109
114
  });
110
115
  };
111
116
  _CopilotChatUserMessage.EditButton = ({ className, title, ...props }) => {
@@ -114,7 +119,7 @@ function CopilotChatUserMessage({ message, onEditMessage, branchIndex, numberOfB
114
119
  title: title || labels.userMessageToolbarEditMessageLabel,
115
120
  className,
116
121
  ...props,
117
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Edit, { className: "size-[18px]" })
122
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Edit, { className: "cpk:size-[18px]" })
118
123
  });
119
124
  };
120
125
  _CopilotChatUserMessage.BranchNavigation = ({ className, currentBranch = 0, numberOfBranches = 1, onSwitchToBranch, message, ...props }) => {
@@ -122,7 +127,7 @@ function CopilotChatUserMessage({ message, onEditMessage, branchIndex, numberOfB
122
127
  const canGoPrev = currentBranch > 0;
123
128
  const canGoNext = currentBranch < numberOfBranches - 1;
124
129
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
125
- className: (0, tailwind_merge.twMerge)("flex items-center gap-1", className),
130
+ className: (0, tailwind_merge.twMerge)("cpk:flex cpk:items-center cpk:gap-1", className),
126
131
  ...props,
127
132
  children: [
128
133
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_button.Button, {
@@ -134,11 +139,11 @@ function CopilotChatUserMessage({ message, onEditMessage, branchIndex, numberOfB
134
139
  message
135
140
  }),
136
141
  disabled: !canGoPrev,
137
- className: "h-6 w-6 p-0",
138
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronLeft, { className: "size-[20px]" })
142
+ className: "cpk:h-6 cpk:w-6 cpk:p-0",
143
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronLeft, { className: "cpk:size-[20px]" })
139
144
  }),
140
145
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
141
- className: "text-sm text-muted-foreground px-0 font-medium",
146
+ className: "cpk:text-sm cpk:text-muted-foreground cpk:px-0 cpk:font-medium",
142
147
  children: [
143
148
  currentBranch + 1,
144
149
  "/",
@@ -154,8 +159,8 @@ function CopilotChatUserMessage({ message, onEditMessage, branchIndex, numberOfB
154
159
  message
155
160
  }),
156
161
  disabled: !canGoNext,
157
- className: "h-6 w-6 p-0",
158
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronRight, { className: "size-[20px]" })
162
+ className: "cpk:h-6 cpk:w-6 cpk:p-0",
163
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronRight, { className: "cpk:size-[20px]" })
159
164
  })
160
165
  ]
161
166
  });