@mieweb/ui 0.7.1-dev.9 → 0.7.2-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/dist/ag-grid.cjs +5 -5
  2. package/dist/ag-grid.js +1 -1
  3. package/dist/{chunk-XCVBCY7L.cjs → chunk-26DPQUSB.cjs} +4 -4
  4. package/dist/{chunk-XCVBCY7L.cjs.map → chunk-26DPQUSB.cjs.map} +1 -1
  5. package/dist/{chunk-YTLTI5Q2.js → chunk-3D4ITDLO.js} +3 -3
  6. package/dist/{chunk-YTLTI5Q2.js.map → chunk-3D4ITDLO.js.map} +1 -1
  7. package/dist/{chunk-KZ7QKUJS.cjs → chunk-3IAA3KCE.cjs} +13 -4
  8. package/dist/chunk-3IAA3KCE.cjs.map +1 -0
  9. package/dist/chunk-3PXOIAF6.js +3 -0
  10. package/dist/{chunk-DHKYGVP7.js.map → chunk-3PXOIAF6.js.map} +1 -1
  11. package/dist/{chunk-7OIUA7PW.js → chunk-3SRBIXQX.js} +9 -9
  12. package/dist/{chunk-7OIUA7PW.js.map → chunk-3SRBIXQX.js.map} +1 -1
  13. package/dist/{chunk-7V6SUOBV.js → chunk-3YSIZ2CK.js} +13 -4
  14. package/dist/chunk-3YSIZ2CK.js.map +1 -0
  15. package/dist/{chunk-3OME4UHL.cjs → chunk-54OW6ZPL.cjs} +99 -3
  16. package/dist/chunk-54OW6ZPL.cjs.map +1 -0
  17. package/dist/{chunk-IVDIT3TJ.js → chunk-5BDCQBYW.js} +3 -3
  18. package/dist/{chunk-IVDIT3TJ.js.map → chunk-5BDCQBYW.js.map} +1 -1
  19. package/dist/{chunk-5PHGIWDN.cjs → chunk-6ECKH4DJ.cjs} +3 -3
  20. package/dist/{chunk-5PHGIWDN.cjs.map → chunk-6ECKH4DJ.cjs.map} +1 -1
  21. package/dist/{chunk-2GQ7VPCS.cjs → chunk-6J7UGYT5.cjs} +6 -6
  22. package/dist/{chunk-2GQ7VPCS.cjs.map → chunk-6J7UGYT5.cjs.map} +1 -1
  23. package/dist/{chunk-HIAUNNOW.cjs → chunk-AIJAFPGJ.cjs} +3 -3
  24. package/dist/{chunk-HIAUNNOW.cjs.map → chunk-AIJAFPGJ.cjs.map} +1 -1
  25. package/dist/{chunk-BS5NOKZD.js → chunk-AQ564XO7.js} +5 -5
  26. package/dist/chunk-AQ564XO7.js.map +1 -0
  27. package/dist/{chunk-JJNCQMR5.js → chunk-BMRQ4VME.js} +3 -3
  28. package/dist/{chunk-JJNCQMR5.js.map → chunk-BMRQ4VME.js.map} +1 -1
  29. package/dist/{chunk-REPZI2YO.js → chunk-BMSG4NBH.js} +3 -3
  30. package/dist/{chunk-REPZI2YO.js.map → chunk-BMSG4NBH.js.map} +1 -1
  31. package/dist/{chunk-QA6ZDHFP.js → chunk-BOOJDRJO.js} +35 -11
  32. package/dist/chunk-BOOJDRJO.js.map +1 -0
  33. package/dist/{chunk-34LGPMO4.js → chunk-DLBV42JD.js} +3 -3
  34. package/dist/{chunk-34LGPMO4.js.map → chunk-DLBV42JD.js.map} +1 -1
  35. package/dist/{chunk-2YDKLURF.js → chunk-DWIF6VXZ.js} +99 -3
  36. package/dist/chunk-DWIF6VXZ.js.map +1 -0
  37. package/dist/{chunk-KQGGKE36.js → chunk-EGWWTIWS.js} +118 -74
  38. package/dist/chunk-EGWWTIWS.js.map +1 -0
  39. package/dist/{chunk-IXWRD4AP.js → chunk-EKRT7K2K.js} +3 -3
  40. package/dist/{chunk-IXWRD4AP.js.map → chunk-EKRT7K2K.js.map} +1 -1
  41. package/dist/{chunk-MHD5HZ4X.js → chunk-FDV7EQWH.js} +3 -3
  42. package/dist/{chunk-MHD5HZ4X.js.map → chunk-FDV7EQWH.js.map} +1 -1
  43. package/dist/{chunk-STCRP652.cjs → chunk-FKLUSYFP.cjs} +4 -4
  44. package/dist/{chunk-STCRP652.cjs.map → chunk-FKLUSYFP.cjs.map} +1 -1
  45. package/dist/{chunk-DKICBJTM.js → chunk-HIDV32ZX.js} +4 -4
  46. package/dist/{chunk-DKICBJTM.js.map → chunk-HIDV32ZX.js.map} +1 -1
  47. package/dist/{chunk-XPNKDFRL.js → chunk-I3WGZPI6.js} +3 -3
  48. package/dist/{chunk-XPNKDFRL.js.map → chunk-I3WGZPI6.js.map} +1 -1
  49. package/dist/{chunk-62TFTZWT.cjs → chunk-IJYTASQQ.cjs} +5 -5
  50. package/dist/{chunk-62TFTZWT.cjs.map → chunk-IJYTASQQ.cjs.map} +1 -1
  51. package/dist/{chunk-SAJSA4TS.js → chunk-LMBXJZLG.js} +8 -4
  52. package/dist/chunk-LMBXJZLG.js.map +1 -0
  53. package/dist/{chunk-CPUDOVWH.cjs → chunk-MJWFNV3L.cjs} +12 -8
  54. package/dist/chunk-MJWFNV3L.cjs.map +1 -0
  55. package/dist/{chunk-ZDEYV373.cjs → chunk-MYFZYUPR.cjs} +35 -11
  56. package/dist/chunk-MYFZYUPR.cjs.map +1 -0
  57. package/dist/{chunk-QNUPTRW7.js → chunk-NGLI2MSM.js} +24 -14
  58. package/dist/chunk-NGLI2MSM.js.map +1 -0
  59. package/dist/{chunk-PGETZ2FP.cjs → chunk-OAHORW4N.cjs} +120 -76
  60. package/dist/chunk-OAHORW4N.cjs.map +1 -0
  61. package/dist/{chunk-G45PAVQI.js → chunk-P6L74SKG.js} +4 -4
  62. package/dist/{chunk-G45PAVQI.js.map → chunk-P6L74SKG.js.map} +1 -1
  63. package/dist/chunk-PAM5UUBL.cjs +740 -0
  64. package/dist/{chunk-UTYUT5YY.cjs.map → chunk-PAM5UUBL.cjs.map} +1 -1
  65. package/dist/{chunk-JY4U2QWO.cjs → chunk-PLMXN23Q.cjs} +5 -5
  66. package/dist/chunk-PLMXN23Q.cjs.map +1 -0
  67. package/dist/{chunk-PNJAFZDC.cjs → chunk-Q5VBO3I5.cjs} +30 -20
  68. package/dist/chunk-Q5VBO3I5.cjs.map +1 -0
  69. package/dist/{chunk-XD6GRTH2.cjs → chunk-QI2SB6U3.cjs} +7 -7
  70. package/dist/{chunk-XD6GRTH2.cjs.map → chunk-QI2SB6U3.cjs.map} +1 -1
  71. package/dist/{chunk-6XGESZ4S.js → chunk-QYSUYB3S.js} +12 -8
  72. package/dist/chunk-QYSUYB3S.js.map +1 -0
  73. package/dist/{chunk-Y5F2OASC.cjs → chunk-RBS3GHDZ.cjs} +6 -6
  74. package/dist/{chunk-Y5F2OASC.cjs.map → chunk-RBS3GHDZ.cjs.map} +1 -1
  75. package/dist/{chunk-NGPEXCC7.cjs → chunk-RS5VA6QU.cjs} +8 -4
  76. package/dist/chunk-RS5VA6QU.cjs.map +1 -0
  77. package/dist/{chunk-YXHX2DAK.cjs → chunk-RYQ3S3KO.cjs} +5 -5
  78. package/dist/{chunk-YXHX2DAK.cjs.map → chunk-RYQ3S3KO.cjs.map} +1 -1
  79. package/dist/{chunk-QKKYMNR2.js → chunk-RZJXCI53.js} +189 -202
  80. package/dist/chunk-RZJXCI53.js.map +1 -0
  81. package/dist/{chunk-ET5JGGVL.js → chunk-TNUL4LGG.js} +5 -5
  82. package/dist/{chunk-ET5JGGVL.js.map → chunk-TNUL4LGG.js.map} +1 -1
  83. package/dist/{chunk-C2NNNOSU.cjs → chunk-VVI32P7L.cjs} +4 -4
  84. package/dist/{chunk-C2NNNOSU.cjs.map → chunk-VVI32P7L.cjs.map} +1 -1
  85. package/dist/{chunk-X732DPW4.cjs → chunk-VWCMOWGH.cjs} +77 -77
  86. package/dist/{chunk-X732DPW4.cjs.map → chunk-VWCMOWGH.cjs.map} +1 -1
  87. package/dist/{chunk-HEV52I7A.cjs → chunk-XS35KPBZ.cjs} +190 -202
  88. package/dist/chunk-XS35KPBZ.cjs.map +1 -0
  89. package/dist/{chunk-EFEKAPS2.cjs → chunk-YVL3XATO.cjs} +3 -3
  90. package/dist/{chunk-EFEKAPS2.cjs.map → chunk-YVL3XATO.cjs.map} +1 -1
  91. package/dist/{chunk-EJPV3QY3.js → chunk-YXCE2HSK.js} +3 -3
  92. package/dist/{chunk-EJPV3QY3.js.map → chunk-YXCE2HSK.js.map} +1 -1
  93. package/dist/{chunk-OJEXXH5D.cjs → chunk-ZBI52NP2.cjs} +4 -4
  94. package/dist/{chunk-OJEXXH5D.cjs.map → chunk-ZBI52NP2.cjs.map} +1 -1
  95. package/dist/components/Autocomplete/index.cjs +4 -4
  96. package/dist/components/Autocomplete/index.js +3 -3
  97. package/dist/components/Badge/index.cjs +3 -3
  98. package/dist/components/Badge/index.js +1 -1
  99. package/dist/components/Card/index.cjs +15 -15
  100. package/dist/components/Card/index.d.cts +8 -3
  101. package/dist/components/Card/index.d.ts +8 -3
  102. package/dist/components/Card/index.js +1 -1
  103. package/dist/components/CountryCodeDropdown/index.cjs +5 -5
  104. package/dist/components/CountryCodeDropdown/index.js +2 -2
  105. package/dist/components/DateInput/index.cjs +4 -4
  106. package/dist/components/DateInput/index.d.cts +3 -1
  107. package/dist/components/DateInput/index.d.ts +3 -1
  108. package/dist/components/DateInput/index.js +3 -3
  109. package/dist/components/Dropdown/index.cjs +9 -9
  110. package/dist/components/Dropdown/index.d.cts +1 -1
  111. package/dist/components/Dropdown/index.d.ts +1 -1
  112. package/dist/components/Dropdown/index.js +3 -3
  113. package/dist/components/Input/index.cjs +3 -3
  114. package/dist/components/Input/index.js +1 -1
  115. package/dist/components/Label/index.cjs +3 -3
  116. package/dist/components/Label/index.js +1 -1
  117. package/dist/components/MediaEditor/index.cjs +9 -9
  118. package/dist/components/MediaEditor/index.js +4 -4
  119. package/dist/components/PhoneInput/index.cjs +4 -4
  120. package/dist/components/PhoneInput/index.js +2 -2
  121. package/dist/components/RichTextEditor/index.cjs +7 -7
  122. package/dist/components/RichTextEditor/index.js +4 -4
  123. package/dist/components/Select/index.cjs +4 -4
  124. package/dist/components/Select/index.js +2 -2
  125. package/dist/components/Sheet/index.cjs +10 -10
  126. package/dist/components/Sheet/index.d.cts +1 -1
  127. package/dist/components/Sheet/index.d.ts +1 -1
  128. package/dist/components/Sheet/index.js +1 -1
  129. package/dist/components/SuperChat/index.cjs +17 -17
  130. package/dist/components/SuperChat/index.d.cts +4 -4
  131. package/dist/components/SuperChat/index.d.ts +4 -4
  132. package/dist/components/SuperChat/index.js +6 -6
  133. package/dist/components/SuperChat/plugins/index.cjs +4 -4
  134. package/dist/components/SuperChat/plugins/index.d.cts +3 -3
  135. package/dist/components/SuperChat/plugins/index.d.ts +3 -3
  136. package/dist/components/SuperChat/plugins/index.js +3 -3
  137. package/dist/components/Switch/index.cjs +4 -4
  138. package/dist/components/Switch/index.js +1 -1
  139. package/dist/components/Table/index.cjs +9 -9
  140. package/dist/components/Table/index.js +1 -1
  141. package/dist/components/Text/index.cjs +4 -4
  142. package/dist/components/Text/index.d.cts +1 -1
  143. package/dist/components/Text/index.d.ts +1 -1
  144. package/dist/components/Text/index.js +1 -1
  145. package/dist/datavis.cjs +2 -2
  146. package/dist/datavis.js +1 -1
  147. package/dist/esheet.cjs +12 -12
  148. package/dist/esheet.js +9 -9
  149. package/dist/hooks/index.cjs +2 -2
  150. package/dist/hooks/index.d.cts +1 -1
  151. package/dist/hooks/index.d.ts +1 -1
  152. package/dist/hooks/index.js +1 -1
  153. package/dist/index.cjs +2294 -776
  154. package/dist/index.cjs.map +1 -1
  155. package/dist/index.d.cts +104 -17
  156. package/dist/index.d.ts +104 -17
  157. package/dist/index.js +860 -67
  158. package/dist/index.js.map +1 -1
  159. package/dist/styles.css +1 -1
  160. package/dist/tailwind-preset.cjs +4 -4
  161. package/dist/tailwind-preset.js +1 -1
  162. package/dist/{types-BYnLjEFg.d.cts → types-B2RLmdVd.d.cts} +3 -1
  163. package/dist/{types-BYnLjEFg.d.ts → types-B2RLmdVd.d.ts} +3 -1
  164. package/dist/{types-CyCwYBlr.d.ts → types-BoTeTPdH.d.ts} +1 -1
  165. package/dist/{types-CBh8Zlje.d.cts → types-DyIB9HYT.d.cts} +1 -1
  166. package/dist/{useAnchoredPosition-nXdSFKHf.d.ts → useAnchoredPosition-C7PNglzD.d.cts} +6 -2
  167. package/dist/{useAnchoredPosition-nXdSFKHf.d.cts → useAnchoredPosition-C7PNglzD.d.ts} +6 -2
  168. package/package.json +6 -6
  169. package/dist/chunk-2YDKLURF.js.map +0 -1
  170. package/dist/chunk-3OME4UHL.cjs.map +0 -1
  171. package/dist/chunk-6XGESZ4S.js.map +0 -1
  172. package/dist/chunk-7V6SUOBV.js.map +0 -1
  173. package/dist/chunk-BS5NOKZD.js.map +0 -1
  174. package/dist/chunk-CPUDOVWH.cjs.map +0 -1
  175. package/dist/chunk-DHKYGVP7.js +0 -3
  176. package/dist/chunk-HEV52I7A.cjs.map +0 -1
  177. package/dist/chunk-JY4U2QWO.cjs.map +0 -1
  178. package/dist/chunk-KQGGKE36.js.map +0 -1
  179. package/dist/chunk-KZ7QKUJS.cjs.map +0 -1
  180. package/dist/chunk-NGPEXCC7.cjs.map +0 -1
  181. package/dist/chunk-PGETZ2FP.cjs.map +0 -1
  182. package/dist/chunk-PNJAFZDC.cjs.map +0 -1
  183. package/dist/chunk-QA6ZDHFP.js.map +0 -1
  184. package/dist/chunk-QKKYMNR2.js.map +0 -1
  185. package/dist/chunk-QNUPTRW7.js.map +0 -1
  186. package/dist/chunk-SAJSA4TS.js.map +0 -1
  187. package/dist/chunk-UTYUT5YY.cjs +0 -240
  188. package/dist/chunk-ZDEYV373.cjs.map +0 -1
@@ -1,7 +1,7 @@
1
1
  import { AudioPlayer } from './chunk-XO3WLK65.js';
2
2
  import { cn } from './chunk-TQONQSJO.js';
3
3
  import { jsx, jsxs } from 'react/jsx-runtime';
4
- import * as React from 'react';
4
+ import * as React2 from 'react';
5
5
  import { cva } from 'class-variance-authority';
6
6
 
7
7
  var sizeClasses = {
@@ -204,6 +204,68 @@ function SpinnerIcon({ className }) {
204
204
  }
205
205
  );
206
206
  }
207
+ function CollapsiblePill({
208
+ label,
209
+ leadingIcon,
210
+ density = "standard",
211
+ defaultOpen = false,
212
+ pillClassName,
213
+ className,
214
+ title,
215
+ children
216
+ }) {
217
+ const hasContent = Boolean(children);
218
+ const [isOpen, setIsOpen] = React2.useState(defaultOpen);
219
+ const contentId = React2.useId();
220
+ React2.useEffect(() => {
221
+ setIsOpen(defaultOpen);
222
+ }, [defaultOpen]);
223
+ const toggle = () => {
224
+ setIsOpen((open) => !open);
225
+ };
226
+ return /* @__PURE__ */ jsxs("div", { "data-slot": "collapsible-pill", className, children: [
227
+ /* @__PURE__ */ jsxs(
228
+ "button",
229
+ {
230
+ type: "button",
231
+ onClick: hasContent ? toggle : void 0,
232
+ "aria-expanded": hasContent ? isOpen : void 0,
233
+ "aria-controls": hasContent ? contentId : void 0,
234
+ title,
235
+ disabled: !hasContent,
236
+ className: cn(
237
+ "focus-visible:ring-ring inline-flex items-center gap-1.5 border font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1",
238
+ density === "condensed" ? "rounded-[8px] px-2 py-0.5 text-[10px]" : "rounded-[10px] px-[11px] py-1 text-[11px]",
239
+ pillClassName
240
+ ),
241
+ children: [
242
+ leadingIcon,
243
+ /* @__PURE__ */ jsx("span", { children: label }),
244
+ hasContent && /* @__PURE__ */ jsx(
245
+ ChevronIcon,
246
+ {
247
+ direction: isOpen ? "down" : "right",
248
+ className: density === "condensed" ? "h-2.5 w-2.5 opacity-60" : "h-3 w-3 opacity-60"
249
+ }
250
+ )
251
+ ]
252
+ }
253
+ ),
254
+ hasContent && /* @__PURE__ */ jsx(
255
+ "div",
256
+ {
257
+ id: contentId,
258
+ "aria-hidden": !isOpen,
259
+ inert: !isOpen || void 0,
260
+ className: cn(
261
+ "overflow-hidden transition-[max-height,opacity] duration-300 ease-in-out",
262
+ isOpen ? "max-h-[500px] overflow-y-auto opacity-100" : "max-h-0 opacity-0"
263
+ ),
264
+ children: /* @__PURE__ */ jsx("div", { className: "mt-1.5", children })
265
+ }
266
+ )
267
+ ] });
268
+ }
207
269
  var statusIconVariants = cva(
208
270
  "flex h-5 w-5 items-center justify-center rounded-full",
209
271
  {
@@ -671,10 +733,8 @@ function ResourceLink({ link, onClick, className }) {
671
733
  function ToolResultDisplay({
672
734
  result,
673
735
  onLinkClick,
674
- showRawData = false,
675
736
  className
676
737
  }) {
677
- const [showJson, setShowJson] = React.useState(false);
678
738
  if (result.type === "error") {
679
739
  return /* @__PURE__ */ jsx(
680
740
  "div",
@@ -687,7 +747,6 @@ function ToolResultDisplay({
687
747
  }
688
748
  );
689
749
  }
690
- const hasRawData = result.type === "json" && result.data !== void 0 && result.data !== null;
691
750
  return /* @__PURE__ */ jsxs("div", { className: cn("space-y-2", className), children: [
692
751
  result.summary && /* @__PURE__ */ jsx("p", { className: "text-sm text-neutral-700 dark:text-neutral-300", children: result.summary }),
693
752
  result.link && /* @__PURE__ */ jsx(ResourceLink, { link: result.link, onClick: onLinkClick }),
@@ -702,67 +761,9 @@ function ToolResultDisplay({
702
761
  onClick: onLinkClick
703
762
  },
704
763
  resource.id
705
- )) }),
706
- hasRawData && showRawData && /* @__PURE__ */ jsxs("div", { className: "mt-2", children: [
707
- /* @__PURE__ */ jsxs(
708
- "button",
709
- {
710
- onClick: () => setShowJson(!showJson),
711
- className: "flex items-center gap-1 text-xs text-neutral-600 hover:text-neutral-700 dark:text-neutral-400 dark:hover:text-neutral-300",
712
- children: [
713
- /* @__PURE__ */ jsx(
714
- "svg",
715
- {
716
- "aria-hidden": "true",
717
- className: cn(
718
- "h-3 w-3 transition-transform",
719
- showJson && "rotate-90"
720
- ),
721
- fill: "none",
722
- viewBox: "0 0 24 24",
723
- stroke: "currentColor",
724
- strokeWidth: "2",
725
- children: /* @__PURE__ */ jsx(
726
- "path",
727
- {
728
- strokeLinecap: "round",
729
- strokeLinejoin: "round",
730
- d: "M9 5l7 7-7 7"
731
- }
732
- )
733
- }
734
- ),
735
- showJson ? "Hide" : "Show",
736
- " raw data"
737
- ]
738
- }
739
- ),
740
- showJson && /* @__PURE__ */ jsx("pre", { className: "mt-2 max-h-40 overflow-auto rounded-md bg-neutral-100 p-2 text-xs dark:bg-neutral-800", children: JSON.stringify(result.data, null, 2) })
741
- ] })
764
+ )) })
742
765
  ] });
743
766
  }
744
- var toolCallVariants = cva(
745
- ["rounded-lg border", "overflow-hidden", "transition-all duration-200"],
746
- {
747
- variants: {
748
- status: {
749
- pending: "border-neutral-200 bg-neutral-50 dark:border-neutral-700 dark:bg-neutral-800/50",
750
- running: "border-primary-200 bg-primary-50/50 dark:border-primary-800 dark:bg-primary-900/20",
751
- success: "border-green-200 bg-green-50/50 dark:border-green-800 dark:bg-green-900/20",
752
- error: "border-red-200 bg-red-50/50 dark:border-red-800 dark:bg-red-900/20",
753
- cancelled: "border-neutral-200 bg-neutral-50 dark:border-neutral-700 dark:bg-neutral-800/50 opacity-60"
754
- },
755
- compact: {
756
- true: "p-2",
757
- false: "p-3"
758
- }
759
- },
760
- defaultVariants: {
761
- status: "pending",
762
- compact: false
763
- }
764
- }
765
- );
766
767
  var TOOL_FRIENDLY_NAMES = {
767
768
  create_patient: "Creating patient",
768
769
  get_patient: "Looking up patient",
@@ -827,120 +828,113 @@ function getParameterSummary(toolName, params) {
827
828
  }
828
829
  return null;
829
830
  }
831
+ var statusPillClasses = {
832
+ pending: "bg-neutral-100 border-neutral-200 text-neutral-600 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-400",
833
+ running: "bg-primary-50 border-primary-200 text-primary-800 dark:bg-primary-900/20 dark:border-primary-800 dark:text-primary-300",
834
+ success: "bg-green-50 border-green-200 text-green-700 dark:bg-green-900/20 dark:border-green-800 dark:text-green-300",
835
+ error: "bg-red-50 border-red-200 text-red-700 dark:bg-red-900/20 dark:border-red-800 dark:text-red-300",
836
+ cancelled: "bg-neutral-100 border-neutral-200 text-neutral-400 opacity-60 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-400"
837
+ };
830
838
  function MCPToolCallDisplay({
831
839
  toolCall,
832
840
  showParameters = true,
833
841
  collapsible = true,
834
- defaultCollapsed = true,
842
+ defaultCollapsed,
835
843
  compact,
844
+ hidden = false,
836
845
  onLinkClick,
837
846
  className
838
847
  }) {
839
- const [showDetails, setShowDetails] = React.useState(!defaultCollapsed);
840
848
  const formatDuration = (ms) => {
841
849
  if (!ms) return null;
842
850
  if (ms < 1e3) return `${ms}ms`;
843
851
  return `${(ms / 1e3).toFixed(1)}s`;
844
852
  };
845
853
  const friendlyName = getToolFriendlyName(toolCall.toolName, toolCall.status);
854
+ const durationLabel = formatDuration(toolCall.duration);
846
855
  const paramSummary = getParameterSummary(
847
856
  toolCall.toolName,
848
857
  toolCall.parameters
849
858
  );
850
- return /* @__PURE__ */ jsx(
859
+ const detailBit = toolCall.status === "success" ? durationLabel : paramSummary ?? durationLabel;
860
+ const pillLabel = detailBit ? `${friendlyName} \xB7 ${detailBit}` : friendlyName;
861
+ const hasParams = showParameters && toolCall.parameters.length > 0;
862
+ const hasBoxContent = Boolean(toolCall.result || toolCall.error || hasParams);
863
+ const isCompleted = toolCall.status === "success" || toolCall.status === "error";
864
+ const effectiveDefaultCollapsed = defaultCollapsed ?? !isCompleted;
865
+ if (hidden) return null;
866
+ const box = /* @__PURE__ */ jsxs(
851
867
  "div",
852
868
  {
853
- "data-slot": "ai-tool-call",
854
869
  className: cn(
855
- toolCallVariants({ status: toolCall.status, compact }),
856
- className
870
+ "w-full max-w-md space-y-2 rounded-lg border border-neutral-200 bg-neutral-50 dark:border-neutral-700 dark:bg-neutral-800/50",
871
+ compact ? "p-2" : "p-3"
857
872
  ),
858
- children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
859
- /* @__PURE__ */ jsx(
873
+ children: [
874
+ toolCall.result && /* @__PURE__ */ jsx("div", { "data-slot": "ai-tool-result", children: /* @__PURE__ */ jsx(
875
+ ToolResultDisplay,
876
+ {
877
+ result: toolCall.result,
878
+ onLinkClick
879
+ }
880
+ ) }),
881
+ toolCall.error && /* @__PURE__ */ jsx("div", { className: "rounded-md bg-red-100 p-2 dark:bg-red-900/30", children: /* @__PURE__ */ jsx("p", { className: "text-sm text-red-700 dark:text-red-300", children: toolCall.error }) }),
882
+ hasParams && /* @__PURE__ */ jsxs(
860
883
  "div",
861
884
  {
862
- "data-slot": "ai-tool-icon",
863
- className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-white/50 text-neutral-600 dark:bg-neutral-700/50 dark:text-neutral-400",
864
- children: getToolIcon(toolCall.toolName)
885
+ "data-slot": "ai-tool-parameters",
886
+ className: "rounded-md bg-neutral-100 p-2 dark:bg-neutral-800",
887
+ children: [
888
+ /* @__PURE__ */ jsx("h4", { className: "mb-1.5 text-xs font-medium tracking-wide text-neutral-600 uppercase dark:text-neutral-400", children: "Parameters" }),
889
+ /* @__PURE__ */ jsx("div", { className: "space-y-0.5", children: toolCall.parameters.map((param) => /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2 text-xs", children: [
890
+ /* @__PURE__ */ jsxs("span", { className: "font-mono text-neutral-600 dark:text-neutral-400", children: [
891
+ param.name,
892
+ ":"
893
+ ] }),
894
+ /* @__PURE__ */ jsx("span", { className: "font-mono text-neutral-700 dark:text-neutral-300", children: typeof param.value === "string" ? param.value : JSON.stringify(param.value) })
895
+ ] }, param.name)) })
896
+ ]
865
897
  }
866
- ),
867
- /* @__PURE__ */ jsxs("div", { "data-slot": "ai-tool-content", className: "min-w-0 flex-1", children: [
868
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
869
- /* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-neutral-900 dark:text-white", children: friendlyName }),
870
- /* @__PURE__ */ jsx(ToolStatusIcon, { status: toolCall.status }),
871
- toolCall.duration && /* @__PURE__ */ jsx("span", { className: "text-xs text-neutral-600 dark:text-neutral-400", children: formatDuration(toolCall.duration) })
872
- ] }),
873
- paramSummary && toolCall.status !== "success" && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground mt-0.5 text-sm", children: paramSummary }),
874
- toolCall.result && /* @__PURE__ */ jsx("div", { "data-slot": "ai-tool-result", className: "mt-2", children: /* @__PURE__ */ jsx(
875
- ToolResultDisplay,
876
- {
877
- result: toolCall.result,
878
- onLinkClick,
879
- showRawData: showDetails
880
- }
881
- ) }),
882
- toolCall.error && /* @__PURE__ */ jsx("div", { className: "mt-2 rounded-md bg-red-100 p-2 dark:bg-red-900/30", children: /* @__PURE__ */ jsx("p", { className: "text-sm text-red-700 dark:text-red-300", children: toolCall.error }) }),
883
- collapsible && showParameters && toolCall.parameters.length > 0 && /* @__PURE__ */ jsxs(
884
- "button",
885
- {
886
- onClick: () => setShowDetails(!showDetails),
887
- className: "mt-2 flex items-center gap-1 text-xs text-neutral-600 hover:text-neutral-700 dark:text-neutral-400 dark:hover:text-neutral-300",
888
- children: [
889
- /* @__PURE__ */ jsx(
890
- "svg",
891
- {
892
- "aria-hidden": "true",
893
- className: cn(
894
- "h-3 w-3 transition-transform",
895
- showDetails && "rotate-90"
896
- ),
897
- fill: "none",
898
- viewBox: "0 0 24 24",
899
- stroke: "currentColor",
900
- strokeWidth: "2",
901
- children: /* @__PURE__ */ jsx(
902
- "path",
903
- {
904
- strokeLinecap: "round",
905
- strokeLinejoin: "round",
906
- d: "M9 5l7 7-7 7"
907
- }
908
- )
909
- }
910
- ),
911
- showDetails ? "Hide" : "Show",
912
- " details"
913
- ]
914
- }
915
- ),
916
- showDetails && showParameters && toolCall.parameters.length > 0 && /* @__PURE__ */ jsxs(
917
- "div",
918
- {
919
- "data-slot": "ai-tool-parameters",
920
- className: "mt-3 rounded-md bg-neutral-100 p-2 dark:bg-neutral-800",
921
- children: [
922
- /* @__PURE__ */ jsx("h4", { className: "mb-1.5 text-xs font-medium tracking-wide text-neutral-600 uppercase dark:text-neutral-400", children: "Parameters" }),
923
- /* @__PURE__ */ jsx("div", { className: "space-y-0.5", children: toolCall.parameters.map((param) => /* @__PURE__ */ jsxs(
924
- "div",
925
- {
926
- className: "flex items-start gap-2 text-xs",
927
- children: [
928
- /* @__PURE__ */ jsxs("span", { className: "font-mono text-neutral-600 dark:text-neutral-400", children: [
929
- param.name,
930
- ":"
931
- ] }),
932
- /* @__PURE__ */ jsx("span", { className: "font-mono text-neutral-700 dark:text-neutral-300", children: typeof param.value === "string" ? param.value : JSON.stringify(param.value) })
933
- ]
934
- },
935
- param.name
936
- )) })
937
- ]
938
- }
939
- )
940
- ] })
941
- ] })
898
+ )
899
+ ]
900
+ }
901
+ );
902
+ const staticPill = /* @__PURE__ */ jsxs(
903
+ "span",
904
+ {
905
+ "data-slot": "ai-tool-pill",
906
+ className: cn(
907
+ "inline-flex items-center gap-1.5 border font-medium",
908
+ compact ? "rounded-[8px] px-2 py-0.5 text-[10px]" : "rounded-[10px] px-[11px] py-1 text-[11px]",
909
+ statusPillClasses[toolCall.status]
910
+ ),
911
+ children: [
912
+ /* @__PURE__ */ jsx(ToolStatusIcon, { status: toolCall.status }),
913
+ /* @__PURE__ */ jsx("span", { children: pillLabel })
914
+ ]
942
915
  }
943
916
  );
917
+ return /* @__PURE__ */ jsx("div", { "data-slot": "ai-tool-call", className, children: !hasBoxContent ? staticPill : collapsible ? (
918
+ // Pill click reveals the whole box (result + params) in one go.
919
+ /* @__PURE__ */ jsx(
920
+ CollapsiblePill,
921
+ {
922
+ label: pillLabel,
923
+ leadingIcon: /* @__PURE__ */ jsx(ToolStatusIcon, { status: toolCall.status }),
924
+ density: compact ? "condensed" : "standard",
925
+ defaultOpen: !effectiveDefaultCollapsed,
926
+ pillClassName: statusPillClasses[toolCall.status],
927
+ title: "Toggle details",
928
+ children: box
929
+ }
930
+ )
931
+ ) : (
932
+ // Non-collapsible: pill + box always visible.
933
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
934
+ staticPill,
935
+ box
936
+ ] })
937
+ ) });
944
938
  }
945
939
  var avatarVariants = cva(
946
940
  "flex shrink-0 items-center justify-center rounded-full",
@@ -1075,6 +1069,39 @@ function AITypingIndicator({ className }) {
1075
1069
  }
1076
1070
  );
1077
1071
  }
1072
+ function ThinkingBlock({
1073
+ text,
1074
+ streaming,
1075
+ defaultCollapsed = false
1076
+ }) {
1077
+ const startedAt = React2.useRef(Date.now());
1078
+ const [elapsed, setElapsed] = React2.useState(null);
1079
+ const prevStreaming = React2.useRef(streaming);
1080
+ React2.useEffect(() => {
1081
+ if (prevStreaming.current && !streaming) {
1082
+ setElapsed(Math.round((Date.now() - startedAt.current) / 1e3));
1083
+ }
1084
+ prevStreaming.current = streaming;
1085
+ }, [streaming]);
1086
+ const label = streaming ? "Thinking" : elapsed !== null && elapsed > 0 ? `Thought for ${elapsed}s` : "Thought";
1087
+ const dot = streaming ? /* @__PURE__ */ jsx(
1088
+ "span",
1089
+ {
1090
+ "aria-hidden": "true",
1091
+ className: "inline-block h-1.5 w-1.5 animate-pulse rounded-full bg-violet-500 dark:bg-violet-400"
1092
+ }
1093
+ ) : null;
1094
+ return /* @__PURE__ */ jsx("div", { "data-slot": "ai-message-thinking", children: /* @__PURE__ */ jsx(
1095
+ CollapsiblePill,
1096
+ {
1097
+ label,
1098
+ leadingIcon: dot,
1099
+ defaultOpen: !defaultCollapsed,
1100
+ pillClassName: "bg-violet-50 border-violet-200 text-violet-600 hover:bg-violet-100 dark:bg-violet-950/30 dark:border-violet-800 dark:text-violet-400 dark:hover:bg-violet-950/50 focus-visible:ring-violet-500",
1101
+ children: /* @__PURE__ */ jsx("div", { className: "border-s-2 border-violet-200 ps-3 text-[13px] leading-relaxed text-neutral-600 italic dark:border-violet-700 dark:text-neutral-400", children: text })
1102
+ }
1103
+ ) });
1104
+ }
1078
1105
  function ContentBlock({
1079
1106
  content,
1080
1107
  onLinkClick,
@@ -1083,9 +1110,6 @@ function ContentBlock({
1083
1110
  role,
1084
1111
  renderTextContent
1085
1112
  }) {
1086
- const [isCollapsed, setIsCollapsed] = React.useState(
1087
- content.collapsed ?? false
1088
- );
1089
1113
  if (content.type === "text" && content.text) {
1090
1114
  if (renderTextContent) {
1091
1115
  return /* @__PURE__ */ jsx("div", { className: "prose prose-sm dark:prose-invert max-w-none", children: renderTextContent(content.text, { messageId, streaming, role }) });
@@ -1103,52 +1127,12 @@ function ContentBlock({
1103
1127
  );
1104
1128
  }
1105
1129
  if (content.type === "thinking" && content.text) {
1106
- return /* @__PURE__ */ jsxs(
1107
- "div",
1130
+ return /* @__PURE__ */ jsx(
1131
+ ThinkingBlock,
1108
1132
  {
1109
- "data-slot": "ai-message-thinking",
1110
- className: "rounded-lg border border-neutral-200 bg-neutral-50 dark:border-neutral-700 dark:bg-neutral-800/50",
1111
- children: [
1112
- /* @__PURE__ */ jsxs(
1113
- "button",
1114
- {
1115
- onClick: () => setIsCollapsed(!isCollapsed),
1116
- className: "flex w-full items-center justify-between px-3 py-2 text-left",
1117
- children: [
1118
- /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground flex items-center gap-2 text-sm", children: [
1119
- /* @__PURE__ */ jsx(
1120
- "svg",
1121
- {
1122
- "aria-hidden": "true",
1123
- className: "h-4 w-4",
1124
- fill: "none",
1125
- viewBox: "0 0 24 24",
1126
- stroke: "currentColor",
1127
- strokeWidth: "1.5",
1128
- children: /* @__PURE__ */ jsx(
1129
- "path",
1130
- {
1131
- strokeLinecap: "round",
1132
- strokeLinejoin: "round",
1133
- d: "M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 00-2.456 2.456zM16.894 20.567L16.5 21.75l-.394-1.183a2.25 2.25 0 00-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 001.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 001.423 1.423l1.183.394-1.183.394a2.25 2.25 0 00-1.423 1.423z"
1134
- }
1135
- )
1136
- }
1137
- ),
1138
- "Thinking..."
1139
- ] }),
1140
- /* @__PURE__ */ jsx(
1141
- ChevronIcon,
1142
- {
1143
- direction: isCollapsed ? "right" : "down",
1144
- className: "text-neutral-400"
1145
- }
1146
- )
1147
- ]
1148
- }
1149
- ),
1150
- !isCollapsed && /* @__PURE__ */ jsx("div", { className: "border-t border-neutral-200 px-3 py-2 dark:border-neutral-700", children: /* @__PURE__ */ jsx("p", { className: "text-sm text-neutral-600 italic dark:text-neutral-400", children: content.text }) })
1151
- ]
1133
+ text: content.text,
1134
+ streaming,
1135
+ defaultCollapsed: content.collapsed ?? false
1152
1136
  }
1153
1137
  );
1154
1138
  }
@@ -1297,7 +1281,7 @@ var bubbleVariants = cva("rounded-2xl px-4 py-2.5 w-fit max-w-[85%]", {
1297
1281
  variant: "assistant"
1298
1282
  }
1299
1283
  });
1300
- var ChatBubble = React.forwardRef(
1284
+ var ChatBubble = React2.forwardRef(
1301
1285
  ({ className, variant, hasError, accent, style, children, ...props }, ref) => {
1302
1286
  return /* @__PURE__ */ jsx(
1303
1287
  "div",
@@ -1324,10 +1308,12 @@ function AIMessageDisplay({
1324
1308
  showTimestamp = false,
1325
1309
  onLinkClick,
1326
1310
  renderTextContent,
1311
+ renderMessageFooter,
1327
1312
  className
1328
1313
  }) {
1329
1314
  const isStreaming = message.status === "streaming";
1330
1315
  const hasContent = message.content.length > 0;
1316
+ const messageFooter = renderMessageFooter?.(message);
1331
1317
  const formatTime = (timestamp) => {
1332
1318
  const date = new Date(timestamp);
1333
1319
  return date.toLocaleTimeString(void 0, {
@@ -1394,6 +1380,7 @@ function AIMessageDisplay({
1394
1380
  )) }) : isStreaming ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx(AITypingIndicator, {}) }) : null
1395
1381
  }
1396
1382
  ),
1383
+ messageFooter != null && messageFooter !== false && /* @__PURE__ */ jsx("div", { "data-slot": "ai-message-footer", className: "w-fit max-w-[85%]", children: messageFooter }),
1397
1384
  showTimestamp && /* @__PURE__ */ jsx(
1398
1385
  "span",
1399
1386
  {
@@ -1411,6 +1398,6 @@ function AIMessageDisplay({
1411
1398
  );
1412
1399
  }
1413
1400
 
1414
- export { AILogoIcon, AIMessageDisplay, AITypingIndicator, ChatBubble, ChevronIcon, CloseIcon, MCPToolCallDisplay, MessageAvatar, RefreshIcon, ResourceLink, SendIcon, SparklesIcon, SpinnerIcon, ToolStatusIcon, getToolIcon };
1415
- //# sourceMappingURL=chunk-QKKYMNR2.js.map
1416
- //# sourceMappingURL=chunk-QKKYMNR2.js.map
1401
+ export { AILogoIcon, AIMessageDisplay, AITypingIndicator, ChatBubble, ChevronIcon, CloseIcon, CollapsiblePill, MCPToolCallDisplay, MessageAvatar, RefreshIcon, ResourceLink, SendIcon, SparklesIcon, SpinnerIcon, ToolStatusIcon, getToolIcon };
1402
+ //# sourceMappingURL=chunk-RZJXCI53.js.map
1403
+ //# sourceMappingURL=chunk-RZJXCI53.js.map