@langchain/macaw-components 1.5.1 → 1.6.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 (52) hide show
  1. package/dist/catalog.json +752 -660
  2. package/dist/components/ChartCard/ChartCardSkeleton.d.ts +1 -1
  3. package/dist/components/ChartCard/ChartCardSkeleton.js +50 -1
  4. package/dist/components/ChartCard/ChartCardSkeleton.js.map +1 -1
  5. package/dist/components/ChatState/ChatState.d.ts +16 -0
  6. package/dist/components/ChatState/ChatState.js +96 -0
  7. package/dist/components/ChatState/ChatState.js.map +1 -0
  8. package/dist/components/ChatState/ChatStateTimer.d.ts +11 -0
  9. package/dist/components/ChatState/ChatStateTimer.js +57 -0
  10. package/dist/components/ChatState/ChatStateTimer.js.map +1 -0
  11. package/dist/components/ChatState/index.d.ts +2 -0
  12. package/dist/components/ChatState/index.js +2 -0
  13. package/dist/components/ChatToolCall/ChatToolCall.d.ts +23 -0
  14. package/dist/components/ChatToolCall/ChatToolCall.js +98 -0
  15. package/dist/components/ChatToolCall/ChatToolCall.js.map +1 -0
  16. package/dist/components/ChatToolCall/ChatToolCall.types.d.ts +10 -0
  17. package/dist/components/ChatToolCall/ChatToolCall.types.js +0 -0
  18. package/dist/components/ChatToolCall/ChatToolCall.value.d.ts +2 -0
  19. package/dist/components/ChatToolCall/ChatToolCall.value.js +82 -0
  20. package/dist/components/ChatToolCall/ChatToolCall.value.js.map +1 -0
  21. package/dist/components/ChatToolCall/ChatToolCallAccordion.d.ts +17 -0
  22. package/dist/components/ChatToolCall/ChatToolCallAccordion.js +56 -0
  23. package/dist/components/ChatToolCall/ChatToolCallAccordion.js.map +1 -0
  24. package/dist/components/ChatToolCall/ChatToolCallDetails.d.ts +4 -0
  25. package/dist/components/ChatToolCall/ChatToolCallDetails.js +66 -0
  26. package/dist/components/ChatToolCall/ChatToolCallDetails.js.map +1 -0
  27. package/dist/components/ChatToolCall/ChatToolCallGroup.d.ts +11 -0
  28. package/dist/components/ChatToolCall/ChatToolCallGroup.js +63 -0
  29. package/dist/components/ChatToolCall/ChatToolCallGroup.js.map +1 -0
  30. package/dist/components/ChatToolCall/ChatToolCallReasoning.d.ts +18 -0
  31. package/dist/components/ChatToolCall/ChatToolCallReasoning.js +45 -0
  32. package/dist/components/ChatToolCall/ChatToolCallReasoning.js.map +1 -0
  33. package/dist/components/ChatToolCall/ChatToolCallStatusRow.d.ts +11 -0
  34. package/dist/components/ChatToolCall/ChatToolCallStatusRow.js +36 -0
  35. package/dist/components/ChatToolCall/ChatToolCallStatusRow.js.map +1 -0
  36. package/dist/components/ChatToolCall/index.d.ts +7 -0
  37. package/dist/components/ChatToolCall/index.js +4 -0
  38. package/dist/components/RadarChart/RadarChart.d.ts +85 -0
  39. package/dist/components/RadarChart/RadarChart.js +357 -0
  40. package/dist/components/RadarChart/RadarChart.js.map +1 -0
  41. package/dist/components/RadarChart/index.d.ts +2 -0
  42. package/dist/components/RadarChart/index.js +2 -0
  43. package/dist/icons/LongTailPhosphorIcons.js +1 -1
  44. package/dist/icons/WeightedPhosphorIcons.js +1 -1
  45. package/dist/utilities.css +1 -1
  46. package/dist/utils/componentUtils.d.ts +2 -0
  47. package/dist/utils/componentUtils.js +8 -0
  48. package/dist/utils/componentUtils.js.map +1 -0
  49. package/docs/CHAT.md +31 -0
  50. package/docs/DESIGN.md +9 -0
  51. package/docs/STYLES.md +39 -39
  52. package/package.json +22 -2
@@ -0,0 +1,56 @@
1
+ import { cn } from "../../utils/cn.js";
2
+ import { Button } from "../Button/Button.js";
3
+ import { useId } from "react";
4
+ import { CaretRightIcon } from "@phosphor-icons/react/dist/ssr/CaretRight";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { useControllableState } from "@radix-ui/react-use-controllable-state";
7
+ //#region packages/components/src/components/ChatToolCall/ChatToolCallAccordion.tsx
8
+ function ChatToolCallAccordion({ heading, status, children, groupLabel, triggerLabel, triggerDescriptionId, detailsLabel, expanded, defaultExpanded = false, onExpandedChange, className, detailsClassName }) {
9
+ const detailsId = useId();
10
+ const hasDetails = children != null && children !== false;
11
+ const [expandedState = false, setExpanded] = useControllableState({
12
+ prop: expanded,
13
+ defaultProp: defaultExpanded,
14
+ onChange: onExpandedChange
15
+ });
16
+ const isExpanded = hasDetails && expandedState;
17
+ return /* @__PURE__ */ jsxs("div", {
18
+ role: "group",
19
+ "aria-label": groupLabel,
20
+ className: cn("min-w-0 max-w-full font-sans text-xxs text-secondary", className),
21
+ children: [/* @__PURE__ */ jsxs("div", {
22
+ className: "flex flex-wrap items-center gap-space-2 rounded-md px-space-1 transition-colors duration-fast hover:bg-surface-level-2 motion-reduce:transition-none",
23
+ children: [hasDetails ? /* @__PURE__ */ jsxs(Button, {
24
+ type: "button",
25
+ variant: "plain",
26
+ color: "secondary",
27
+ size: "sm",
28
+ "aria-label": triggerLabel,
29
+ "aria-describedby": triggerDescriptionId,
30
+ "aria-controls": detailsId,
31
+ "aria-expanded": isExpanded,
32
+ onClick: () => setExpanded(!isExpanded),
33
+ className: "h-auto min-w-0 flex-1 justify-start gap-space-2 px-0 py-space-1 text-left shadow-none hover:bg-transparent",
34
+ children: [/* @__PURE__ */ jsx(CaretRightIcon, {
35
+ size: 12,
36
+ weight: "regular",
37
+ "aria-hidden": "true",
38
+ className: cn("shrink-0 text-icon-tertiary transition-transform duration-normal motion-reduce:transition-none", isExpanded && "rotate-90")
39
+ }), heading]
40
+ }) : /* @__PURE__ */ jsx("span", {
41
+ className: "flex min-w-0 flex-1 items-center gap-space-2 py-space-1 pl-space-5",
42
+ children: heading
43
+ }), status]
44
+ }), isExpanded && /* @__PURE__ */ jsx("div", {
45
+ id: detailsId,
46
+ role: "region",
47
+ "aria-label": detailsLabel,
48
+ className: cn("ml-space-2 min-w-0 border-l border-subtle py-space-2 pl-space-4 text-tertiary", detailsClassName),
49
+ children
50
+ })]
51
+ });
52
+ }
53
+ //#endregion
54
+ export { ChatToolCallAccordion };
55
+
56
+ //# sourceMappingURL=ChatToolCallAccordion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatToolCallAccordion.js","names":[],"sources":["../../../src/components/ChatToolCall/ChatToolCallAccordion.tsx"],"sourcesContent":["import { type ReactNode, useId } from 'react';\n\nimport { CaretRightIcon } from '@phosphor-icons/react/dist/ssr/CaretRight';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\n\nimport { cn } from '../../utils/cn';\nimport { Button } from '../Button';\n\ninterface ChatToolCallAccordionProps {\n heading: ReactNode;\n status: ReactNode;\n children: ReactNode;\n groupLabel: string;\n triggerLabel: string;\n triggerDescriptionId?: string;\n detailsLabel: string;\n expanded?: boolean;\n defaultExpanded?: boolean;\n onExpandedChange?: (expanded: boolean) => void;\n className?: string;\n detailsClassName?: string;\n}\n\nexport function ChatToolCallAccordion({\n heading,\n status,\n children,\n groupLabel,\n triggerLabel,\n triggerDescriptionId,\n detailsLabel,\n expanded,\n defaultExpanded = false,\n onExpandedChange,\n className,\n detailsClassName,\n}: ChatToolCallAccordionProps) {\n const detailsId = useId();\n const hasDetails = children != null && children !== false;\n const [expandedState = false, setExpanded] = useControllableState({\n prop: expanded,\n defaultProp: defaultExpanded,\n onChange: onExpandedChange,\n });\n const isExpanded = hasDetails && expandedState;\n\n return (\n <div\n role=\"group\"\n aria-label={groupLabel}\n className={cn(\n 'min-w-0 max-w-full font-sans text-xxs text-secondary',\n className\n )}\n >\n <div className=\"flex flex-wrap items-center gap-space-2 rounded-md px-space-1 transition-colors duration-fast hover:bg-surface-level-2 motion-reduce:transition-none\">\n {hasDetails ? (\n <Button\n type=\"button\"\n variant=\"plain\"\n color=\"secondary\"\n size=\"sm\"\n aria-label={triggerLabel}\n aria-describedby={triggerDescriptionId}\n aria-controls={detailsId}\n aria-expanded={isExpanded}\n onClick={() => setExpanded(!isExpanded)}\n className=\"h-auto min-w-0 flex-1 justify-start gap-space-2 px-0 py-space-1 text-left shadow-none hover:bg-transparent\"\n >\n <CaretRightIcon\n size={12}\n weight=\"regular\"\n aria-hidden=\"true\"\n className={cn(\n 'shrink-0 text-icon-tertiary transition-transform duration-normal motion-reduce:transition-none',\n isExpanded && 'rotate-90'\n )}\n />\n {heading}\n </Button>\n ) : (\n <span className=\"flex min-w-0 flex-1 items-center gap-space-2 py-space-1 pl-space-5\">\n {heading}\n </span>\n )}\n {status}\n </div>\n {isExpanded && (\n <div\n id={detailsId}\n role=\"region\"\n aria-label={detailsLabel}\n className={cn(\n 'ml-space-2 min-w-0 border-l border-subtle py-space-2 pl-space-4 text-tertiary',\n detailsClassName\n )}\n >\n {children}\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;AAuBA,SAAgB,sBAAsB,EACpC,SACA,QACA,UACA,YACA,cACA,sBACA,cACA,UACA,kBAAkB,OAClB,kBACA,WACA,oBAC6B;CAC7B,MAAM,YAAY,MAAM;CACxB,MAAM,aAAa,YAAY,QAAQ,aAAa;CACpD,MAAM,CAAC,gBAAgB,OAAO,eAAe,qBAAqB;EAChE,MAAM;EACN,aAAa;EACb,UAAU;CACZ,CAAC;CACD,MAAM,aAAa,cAAc;CAEjC,OACE,qBAAC,OAAD;EACE,MAAK;EACL,cAAY;EACZ,WAAW,GACT,wDACA,SACF;EANF,UAAA,CAQE,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACG,aACC,qBAAC,QAAD;IACE,MAAK;IACL,SAAQ;IACR,OAAM;IACN,MAAK;IACL,cAAY;IACZ,oBAAkB;IAClB,iBAAe;IACf,iBAAe;IACf,eAAe,YAAY,CAAC,UAAU;IACtC,WAAU;IAVZ,UAAA,CAYE,oBAAC,gBAAD;KACE,MAAM;KACN,QAAO;KACP,eAAY;KACZ,WAAW,GACT,kGACA,cAAc,WAChB;IACD,CAAA,GACA,OACK;GAER,CAAA,IAAA,oBAAC,QAAD;IAAM,WAAU;IACb,UAAA;GACG,CAAA,GAEP,MACE;EACJ,CAAA,GAAA,cACC,oBAAC,OAAD;GACE,IAAI;GACJ,MAAK;GACL,cAAY;GACZ,WAAW,GACT,iFACA,gBACF;GAEC;EACE,CAAA,CAEJ;;AAET"}
@@ -0,0 +1,4 @@
1
+ import type { ChatToolCallModel } from './ChatToolCall.types.js';
2
+ export declare function ChatToolCallDetails({ toolCall, }: {
3
+ toolCall: ChatToolCallModel;
4
+ }): import("react").JSX.Element;
@@ -0,0 +1,66 @@
1
+ import { Text } from "../Text/Text.js";
2
+ import { formatChatToolCallValue } from "./ChatToolCall.value.js";
3
+ import { CodeLite } from "../Code/CodeLite.js";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ //#region packages/components/src/components/ChatToolCall/ChatToolCallDetails.tsx
6
+ function DetailsValue({ value }) {
7
+ const preview = formatChatToolCallValue(value);
8
+ if (typeof value === "string") return /* @__PURE__ */ jsx(Text, {
9
+ variant: "xs",
10
+ color: "tertiary",
11
+ className: "max-h-60 overflow-auto whitespace-pre-wrap break-words [overflow-wrap:anywhere]",
12
+ children: preview
13
+ });
14
+ return /* @__PURE__ */ jsx("div", {
15
+ className: "max-h-60 max-w-full overflow-auto rounded-md bg-surface-level-2 p-space-2 [overflow-wrap:anywhere]",
16
+ children: /* @__PURE__ */ jsx(CodeLite, {
17
+ value: preview,
18
+ language: "json",
19
+ className: "text-xxs",
20
+ showGutter: false,
21
+ wrapLines: true
22
+ })
23
+ });
24
+ }
25
+ function DetailsSection({ label, value, emptyLabel }) {
26
+ return /* @__PURE__ */ jsxs("section", {
27
+ "aria-label": label,
28
+ className: "flex min-w-0 flex-col gap-space-2",
29
+ children: [/* @__PURE__ */ jsx(Text, {
30
+ variant: "xs",
31
+ weight: "medium",
32
+ color: "quaternary",
33
+ children: label
34
+ }), value === void 0 ? /* @__PURE__ */ jsx(Text, {
35
+ variant: "xs",
36
+ color: "tertiary",
37
+ children: emptyLabel
38
+ }) : /* @__PURE__ */ jsx(DetailsValue, { value })]
39
+ });
40
+ }
41
+ function ChatToolCallDetails({ toolCall }) {
42
+ return /* @__PURE__ */ jsxs("div", {
43
+ className: "flex min-w-0 flex-col gap-space-3",
44
+ children: [
45
+ /* @__PURE__ */ jsx(DetailsSection, {
46
+ label: "Request",
47
+ value: toolCall.args,
48
+ emptyLabel: "No arguments"
49
+ }),
50
+ /* @__PURE__ */ jsx(DetailsSection, {
51
+ label: "Response",
52
+ value: toolCall.result,
53
+ emptyLabel: toolCall.status === "pending" || toolCall.status === "running" ? "Awaiting response" : "No response provided"
54
+ }),
55
+ toolCall.error !== void 0 && /* @__PURE__ */ jsx(DetailsSection, {
56
+ label: "Error",
57
+ value: toolCall.error,
58
+ emptyLabel: "No error details"
59
+ })
60
+ ]
61
+ });
62
+ }
63
+ //#endregion
64
+ export { ChatToolCallDetails };
65
+
66
+ //# sourceMappingURL=ChatToolCallDetails.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatToolCallDetails.js","names":[],"sources":["../../../src/components/ChatToolCall/ChatToolCallDetails.tsx"],"sourcesContent":["import { CodeLite } from '../Code/CodeLite';\nimport { Text } from '../Text';\nimport type { ChatToolCallModel } from './ChatToolCall.types';\nimport { formatChatToolCallValue } from './ChatToolCall.value';\n\nfunction DetailsValue({ value }: { value: unknown }) {\n const preview = formatChatToolCallValue(value);\n\n if (typeof value === 'string') {\n return (\n <Text\n variant=\"xs\"\n color=\"tertiary\"\n className=\"max-h-60 overflow-auto whitespace-pre-wrap break-words [overflow-wrap:anywhere]\"\n >\n {preview}\n </Text>\n );\n }\n\n return (\n <div className=\"max-h-60 max-w-full overflow-auto rounded-md bg-surface-level-2 p-space-2 [overflow-wrap:anywhere]\">\n <CodeLite\n value={preview}\n language=\"json\"\n className=\"text-xxs\"\n showGutter={false}\n wrapLines\n />\n </div>\n );\n}\n\nfunction DetailsSection({\n label,\n value,\n emptyLabel,\n}: {\n label: string;\n value: unknown;\n emptyLabel: string;\n}) {\n return (\n <section aria-label={label} className=\"flex min-w-0 flex-col gap-space-2\">\n <Text variant=\"xs\" weight=\"medium\" color=\"quaternary\">\n {label}\n </Text>\n {value === undefined ? (\n <Text variant=\"xs\" color=\"tertiary\">\n {emptyLabel}\n </Text>\n ) : (\n <DetailsValue value={value} />\n )}\n </section>\n );\n}\n\nexport function ChatToolCallDetails({\n toolCall,\n}: {\n toolCall: ChatToolCallModel;\n}) {\n return (\n <div className=\"flex min-w-0 flex-col gap-space-3\">\n <DetailsSection\n label=\"Request\"\n value={toolCall.args}\n emptyLabel=\"No arguments\"\n />\n <DetailsSection\n label=\"Response\"\n value={toolCall.result}\n emptyLabel={\n toolCall.status === 'pending' || toolCall.status === 'running'\n ? 'Awaiting response'\n : 'No response provided'\n }\n />\n {toolCall.error !== undefined && (\n <DetailsSection\n label=\"Error\"\n value={toolCall.error}\n emptyLabel=\"No error details\"\n />\n )}\n </div>\n );\n}\n"],"mappings":";;;;;AAKA,SAAS,aAAa,EAAE,SAA6B;CACnD,MAAM,UAAU,wBAAwB,KAAK;CAE7C,IAAI,OAAO,UAAU,UACnB,OACE,oBAAC,MAAD;EACE,SAAQ;EACR,OAAM;EACN,WAAU;EAET,UAAA;CACG,CAAA;CAIV,OACE,oBAAC,OAAD;EAAK,WAAU;EACb,UAAA,oBAAC,UAAD;GACE,OAAO;GACP,UAAS;GACT,WAAU;GACV,YAAY;GACZ,WAAA;EACD,CAAA;CACE,CAAA;AAET;AAEA,SAAS,eAAe,EACtB,OACA,OACA,cAKC;CACD,OACE,qBAAC,WAAD;EAAS,cAAY;EAAO,WAAU;EAAtC,UAAA,CACE,oBAAC,MAAD;GAAM,SAAQ;GAAK,QAAO;GAAS,OAAM;GACtC,UAAA;EACG,CAAA,GACL,UAAU,KAAA,IACT,oBAAC,MAAD;GAAM,SAAQ;GAAK,OAAM;GACtB,UAAA;EACG,CAAA,IAEN,oBAAC,cAAD,EAAqB,MAAQ,CAAA,CAExB;;AAEb;AAEA,SAAgB,oBAAoB,EAClC,YAGC;CACD,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GACE,oBAAC,gBAAD;IACE,OAAM;IACN,OAAO,SAAS;IAChB,YAAW;GACZ,CAAA;GACD,oBAAC,gBAAD;IACE,OAAM;IACN,OAAO,SAAS;IAChB,YACE,SAAS,WAAW,aAAa,SAAS,WAAW,YACjD,sBACA;GAEP,CAAA;GACA,SAAS,UAAU,KAAA,KAClB,oBAAC,gBAAD;IACE,OAAM;IACN,OAAO,SAAS;IAChB,YAAW;GACZ,CAAA;EAEA;;AAET"}
@@ -0,0 +1,11 @@
1
+ import { type ReactNode } from 'react';
2
+ export interface ChatToolCallGroupProps {
3
+ /** Hosts supply the count/summary and group only consecutive content. */
4
+ label: string;
5
+ children: ReactNode;
6
+ expanded?: boolean;
7
+ defaultExpanded?: boolean;
8
+ onExpandedChange?: (expanded: boolean) => void;
9
+ className?: string;
10
+ }
11
+ export declare function ChatToolCallGroup({ label, children, expanded, defaultExpanded, onExpandedChange, className, }: ChatToolCallGroupProps): import("react").JSX.Element;
@@ -0,0 +1,63 @@
1
+ import { cn } from "../../utils/cn.js";
2
+ import { Text } from "../Text/Text.js";
3
+ import { Button } from "../Button/Button.js";
4
+ import { useId } from "react";
5
+ import { CaretRightIcon } from "@phosphor-icons/react/dist/ssr/CaretRight";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { useControllableState } from "@radix-ui/react-use-controllable-state";
8
+ import { WrenchIcon } from "@phosphor-icons/react/dist/ssr/Wrench";
9
+ //#region packages/components/src/components/ChatToolCall/ChatToolCallGroup.tsx
10
+ function ChatToolCallGroup({ label, children, expanded, defaultExpanded = false, onExpandedChange, className }) {
11
+ const contentId = useId();
12
+ const [isExpanded = false, setExpanded] = useControllableState({
13
+ prop: expanded,
14
+ defaultProp: defaultExpanded,
15
+ onChange: onExpandedChange
16
+ });
17
+ return /* @__PURE__ */ jsxs("div", {
18
+ className: cn("min-w-0 max-w-full font-sans text-xxs", className),
19
+ children: [/* @__PURE__ */ jsxs(Button, {
20
+ type: "button",
21
+ variant: "plain",
22
+ color: "secondary",
23
+ size: "sm",
24
+ "aria-label": label,
25
+ "aria-controls": contentId,
26
+ "aria-expanded": isExpanded,
27
+ onClick: () => setExpanded(!isExpanded),
28
+ className: "h-auto max-w-full justify-start gap-space-2 bg-transparent px-0 py-space-1 text-left shadow-none hover:bg-transparent",
29
+ children: [
30
+ /* @__PURE__ */ jsx(CaretRightIcon, {
31
+ size: 12,
32
+ weight: "regular",
33
+ "aria-hidden": "true",
34
+ className: cn("shrink-0 text-icon-tertiary transition-transform duration-normal motion-reduce:transition-none", isExpanded && "rotate-90")
35
+ }),
36
+ /* @__PURE__ */ jsx(WrenchIcon, {
37
+ size: 16,
38
+ weight: "regular",
39
+ "aria-hidden": "true",
40
+ className: "shrink-0 text-icon-tertiary"
41
+ }),
42
+ /* @__PURE__ */ jsx(Text, {
43
+ as: "span",
44
+ variant: "xs",
45
+ color: "tertiary",
46
+ className: "min-w-0 truncate",
47
+ children: label
48
+ })
49
+ ]
50
+ }), /* @__PURE__ */ jsx("div", {
51
+ id: contentId,
52
+ hidden: !isExpanded,
53
+ children: /* @__PURE__ */ jsx("div", {
54
+ className: "flex min-w-0 flex-col gap-0 pl-space-5",
55
+ children
56
+ })
57
+ })]
58
+ });
59
+ }
60
+ //#endregion
61
+ export { ChatToolCallGroup };
62
+
63
+ //# sourceMappingURL=ChatToolCallGroup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatToolCallGroup.js","names":[],"sources":["../../../src/components/ChatToolCall/ChatToolCallGroup.tsx"],"sourcesContent":["import { type ReactNode, useId } from 'react';\n\nimport { CaretRightIcon } from '@phosphor-icons/react/dist/ssr/CaretRight';\nimport { WrenchIcon } from '@phosphor-icons/react/dist/ssr/Wrench';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\n\nimport { cn } from '../../utils/cn';\nimport { Button } from '../Button';\nimport { Text } from '../Text';\n\nexport interface ChatToolCallGroupProps {\n /** Hosts supply the count/summary and group only consecutive content. */\n label: string;\n children: ReactNode;\n expanded?: boolean;\n defaultExpanded?: boolean;\n onExpandedChange?: (expanded: boolean) => void;\n className?: string;\n}\n\nexport function ChatToolCallGroup({\n label,\n children,\n expanded,\n defaultExpanded = false,\n onExpandedChange,\n className,\n}: ChatToolCallGroupProps) {\n const contentId = useId();\n const [isExpanded = false, setExpanded] = useControllableState({\n prop: expanded,\n defaultProp: defaultExpanded,\n onChange: onExpandedChange,\n });\n\n return (\n <div className={cn('min-w-0 max-w-full font-sans text-xxs', className)}>\n <Button\n type=\"button\"\n variant=\"plain\"\n color=\"secondary\"\n size=\"sm\"\n aria-label={label}\n aria-controls={contentId}\n aria-expanded={isExpanded}\n onClick={() => setExpanded(!isExpanded)}\n className=\"h-auto max-w-full justify-start gap-space-2 bg-transparent px-0 py-space-1 text-left shadow-none hover:bg-transparent\"\n >\n <CaretRightIcon\n size={12}\n weight=\"regular\"\n aria-hidden=\"true\"\n className={cn(\n 'shrink-0 text-icon-tertiary transition-transform duration-normal motion-reduce:transition-none',\n isExpanded && 'rotate-90'\n )}\n />\n <WrenchIcon\n size={16}\n weight=\"regular\"\n aria-hidden=\"true\"\n className=\"shrink-0 text-icon-tertiary\"\n />\n <Text\n as=\"span\"\n variant=\"xs\"\n color=\"tertiary\"\n className=\"min-w-0 truncate\"\n >\n {label}\n </Text>\n </Button>\n <div id={contentId} hidden={!isExpanded}>\n <div className=\"flex min-w-0 flex-col gap-0 pl-space-5\">{children}</div>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAoBA,SAAgB,kBAAkB,EAChC,OACA,UACA,UACA,kBAAkB,OAClB,kBACA,aACyB;CACzB,MAAM,YAAY,MAAM;CACxB,MAAM,CAAC,aAAa,OAAO,eAAe,qBAAqB;EAC7D,MAAM;EACN,aAAa;EACb,UAAU;CACZ,CAAC;CAED,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,yCAAyC,SAAS;EAArE,UAAA,CACE,qBAAC,QAAD;GACE,MAAK;GACL,SAAQ;GACR,OAAM;GACN,MAAK;GACL,cAAY;GACZ,iBAAe;GACf,iBAAe;GACf,eAAe,YAAY,CAAC,UAAU;GACtC,WAAU;GATZ,UAAA;IAWE,oBAAC,gBAAD;KACE,MAAM;KACN,QAAO;KACP,eAAY;KACZ,WAAW,GACT,kGACA,cAAc,WAChB;IACD,CAAA;IACD,oBAAC,YAAD;KACE,MAAM;KACN,QAAO;KACP,eAAY;KACZ,WAAU;IACX,CAAA;IACD,oBAAC,MAAD;KACE,IAAG;KACH,SAAQ;KACR,OAAM;KACN,WAAU;KAET,UAAA;IACG,CAAA;GACA;EACR,CAAA,GAAA,oBAAC,OAAD;GAAK,IAAI;GAAW,QAAQ,CAAC;GAC3B,UAAA,oBAAC,OAAD;IAAK,WAAU;IAA0C;GAAc,CAAA;EACpE,CAAA,CACF;;AAET"}
@@ -0,0 +1,18 @@
1
+ import type { ReactNode } from 'react';
2
+ import { type ChatStateStatus } from '../ChatState/index.js';
3
+ export interface ChatToolCallReasoningProps {
4
+ /** Only content intentionally disclosed by the host; never raw hidden model reasoning. */
5
+ children: ReactNode;
6
+ variant?: 'default' | 'simple';
7
+ /** Simple row inspection; the host owns navigation, panes, and permissions. */
8
+ onInspect?: () => void;
9
+ /** Tooltip and accessible action label for Simple row inspection. */
10
+ inspectLabel?: string;
11
+ label?: string;
12
+ status?: ChatStateStatus;
13
+ elapsedMs?: number;
14
+ expanded?: boolean;
15
+ defaultExpanded?: boolean;
16
+ onExpandedChange?: (expanded: boolean) => void;
17
+ }
18
+ export declare function ChatToolCallReasoning({ children, variant, onInspect, inspectLabel, label, status, elapsedMs, expanded, defaultExpanded, onExpandedChange, }: ChatToolCallReasoningProps): import("react").JSX.Element;
@@ -0,0 +1,45 @@
1
+ import { Text } from "../Text/Text.js";
2
+ import { ChatState } from "../ChatState/ChatState.js";
3
+ import { ChatToolCallAccordion } from "./ChatToolCallAccordion.js";
4
+ import { ChatToolCallStatusRow } from "./ChatToolCallStatusRow.js";
5
+ import { jsx } from "react/jsx-runtime";
6
+ //#region packages/components/src/components/ChatToolCall/ChatToolCallReasoning.tsx
7
+ function ChatToolCallReasoning({ children, variant = "default", onInspect, inspectLabel, label = "Reasoning summary", status = "completed", elapsedMs, expanded, defaultExpanded = false, onExpandedChange }) {
8
+ const heading = /* @__PURE__ */ jsx(Text, {
9
+ as: "span",
10
+ variant: "xs",
11
+ weight: "medium",
12
+ color: "secondary",
13
+ className: "min-w-0 truncate",
14
+ children: label
15
+ });
16
+ const state = /* @__PURE__ */ jsx(ChatState, {
17
+ variant: "simple",
18
+ status,
19
+ showElapsed: status === "streaming",
20
+ elapsedMs
21
+ });
22
+ if (variant === "simple") return /* @__PURE__ */ jsx(ChatToolCallStatusRow, {
23
+ groupLabel: label,
24
+ heading,
25
+ status: state,
26
+ onInspect,
27
+ inspectLabel
28
+ });
29
+ return /* @__PURE__ */ jsx(ChatToolCallAccordion, {
30
+ groupLabel: label,
31
+ triggerLabel: label,
32
+ detailsLabel: `${label} details`,
33
+ heading,
34
+ status: state,
35
+ expanded,
36
+ defaultExpanded,
37
+ onExpandedChange,
38
+ detailsClassName: "break-words border-l-0 text-tertiary [overflow-wrap:anywhere]",
39
+ children
40
+ });
41
+ }
42
+ //#endregion
43
+ export { ChatToolCallReasoning };
44
+
45
+ //# sourceMappingURL=ChatToolCallReasoning.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatToolCallReasoning.js","names":[],"sources":["../../../src/components/ChatToolCall/ChatToolCallReasoning.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport { ChatState, type ChatStateStatus } from '../ChatState';\nimport { Text } from '../Text';\nimport { ChatToolCallAccordion } from './ChatToolCallAccordion';\nimport { ChatToolCallStatusRow } from './ChatToolCallStatusRow';\n\nexport interface ChatToolCallReasoningProps {\n /** Only content intentionally disclosed by the host; never raw hidden model reasoning. */\n children: ReactNode;\n variant?: 'default' | 'simple';\n /** Simple row inspection; the host owns navigation, panes, and permissions. */\n onInspect?: () => void;\n /** Tooltip and accessible action label for Simple row inspection. */\n inspectLabel?: string;\n label?: string;\n status?: ChatStateStatus;\n elapsedMs?: number;\n expanded?: boolean;\n defaultExpanded?: boolean;\n onExpandedChange?: (expanded: boolean) => void;\n}\n\nexport function ChatToolCallReasoning({\n children,\n variant = 'default',\n onInspect,\n inspectLabel,\n label = 'Reasoning summary',\n status = 'completed',\n elapsedMs,\n expanded,\n defaultExpanded = false,\n onExpandedChange,\n}: ChatToolCallReasoningProps) {\n const heading = (\n <Text\n as=\"span\"\n variant=\"xs\"\n weight=\"medium\"\n color=\"secondary\"\n className=\"min-w-0 truncate\"\n >\n {label}\n </Text>\n );\n const state = (\n <ChatState\n variant=\"simple\"\n status={status}\n showElapsed={status === 'streaming'}\n elapsedMs={elapsedMs}\n />\n );\n\n if (variant === 'simple') {\n return (\n <ChatToolCallStatusRow\n groupLabel={label}\n heading={heading}\n status={state}\n onInspect={onInspect}\n inspectLabel={inspectLabel}\n />\n );\n }\n\n return (\n <ChatToolCallAccordion\n groupLabel={label}\n triggerLabel={label}\n detailsLabel={`${label} details`}\n heading={heading}\n status={state}\n expanded={expanded}\n defaultExpanded={defaultExpanded}\n onExpandedChange={onExpandedChange}\n detailsClassName=\"break-words border-l-0 text-tertiary [overflow-wrap:anywhere]\"\n >\n {children}\n </ChatToolCallAccordion>\n );\n}\n"],"mappings":";;;;;;AAuBA,SAAgB,sBAAsB,EACpC,UACA,UAAU,WACV,WACA,cACA,QAAQ,qBACR,SAAS,aACT,WACA,UACA,kBAAkB,OAClB,oBAC6B;CAC7B,MAAM,UACJ,oBAAC,MAAD;EACE,IAAG;EACH,SAAQ;EACR,QAAO;EACP,OAAM;EACN,WAAU;EAET,UAAA;CACG,CAAA;CAER,MAAM,QACJ,oBAAC,WAAD;EACE,SAAQ;EACA;EACR,aAAa,WAAW;EACb;CACZ,CAAA;CAGH,IAAI,YAAY,UACd,OACE,oBAAC,uBAAD;EACE,YAAY;EACH;EACT,QAAQ;EACG;EACG;CACf,CAAA;CAIL,OACE,oBAAC,uBAAD;EACE,YAAY;EACZ,cAAc;EACd,cAAc,GAAG,MAAM;EACd;EACT,QAAQ;EACE;EACO;EACC;EAClB,kBAAiB;EAEhB;CACoB,CAAA;AAE3B"}
@@ -0,0 +1,11 @@
1
+ import type { ReactNode } from 'react';
2
+ interface ChatToolCallStatusRowProps {
3
+ heading: ReactNode;
4
+ status: ReactNode;
5
+ groupLabel: string;
6
+ onInspect?: () => void;
7
+ inspectLabel?: string;
8
+ className?: string;
9
+ }
10
+ export declare function ChatToolCallStatusRow({ heading, status, groupLabel, onInspect, inspectLabel, className, }: ChatToolCallStatusRowProps): import("react").JSX.Element;
11
+ export {};
@@ -0,0 +1,36 @@
1
+ import { cn } from "../../utils/cn.js";
2
+ import { Tooltip } from "../Tooltip/Tooltip.js";
3
+ import { Button } from "../Button/Button.js";
4
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
+ //#region packages/components/src/components/ChatToolCall/ChatToolCallStatusRow.tsx
6
+ function ChatToolCallStatusRow({ heading, status, groupLabel, onInspect, inspectLabel = "View tool details", className }) {
7
+ const content = /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
8
+ className: "flex min-w-0 flex-1 items-center gap-space-2 py-space-1",
9
+ children: heading
10
+ }), status] });
11
+ return /* @__PURE__ */ jsx("div", {
12
+ role: "group",
13
+ "aria-label": groupLabel,
14
+ className: cn("min-w-0 max-w-full font-sans text-xxs text-secondary", className),
15
+ children: onInspect ? /* @__PURE__ */ jsx(Tooltip, {
16
+ title: inspectLabel,
17
+ children: /* @__PURE__ */ jsx(Button, {
18
+ type: "button",
19
+ size: "xs",
20
+ variant: "plain",
21
+ color: "secondary",
22
+ "aria-label": `${groupLabel}: ${inspectLabel}`,
23
+ onClick: onInspect,
24
+ className: "focus-visible:ring-focus flex h-auto w-full flex-wrap items-center gap-space-1 rounded-md border-0 px-space-1 py-0 text-left transition-colors duration-fast hover:bg-surface-level-2 focus-visible:outline-hidden focus-visible:ring-2 motion-reduce:transition-none dark:hover:bg-surface-level-2",
25
+ children: content
26
+ })
27
+ }) : /* @__PURE__ */ jsx("div", {
28
+ className: "flex flex-wrap items-center gap-space-1 rounded-md px-space-1 transition-colors duration-fast hover:bg-surface-level-2 motion-reduce:transition-none",
29
+ children: content
30
+ })
31
+ });
32
+ }
33
+ //#endregion
34
+ export { ChatToolCallStatusRow };
35
+
36
+ //# sourceMappingURL=ChatToolCallStatusRow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatToolCallStatusRow.js","names":[],"sources":["../../../src/components/ChatToolCall/ChatToolCallStatusRow.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport { cn } from '../../utils/cn';\nimport { Button } from '../Button';\nimport { Tooltip } from '../Tooltip';\n\ninterface ChatToolCallStatusRowProps {\n heading: ReactNode;\n status: ReactNode;\n groupLabel: string;\n onInspect?: () => void;\n inspectLabel?: string;\n className?: string;\n}\n\nexport function ChatToolCallStatusRow({\n heading,\n status,\n groupLabel,\n onInspect,\n inspectLabel = 'View tool details',\n className,\n}: ChatToolCallStatusRowProps) {\n const content = (\n <>\n <span className=\"flex min-w-0 flex-1 items-center gap-space-2 py-space-1\">\n {heading}\n </span>\n {status}\n </>\n );\n\n return (\n <div\n role=\"group\"\n aria-label={groupLabel}\n className={cn(\n 'min-w-0 max-w-full font-sans text-xxs text-secondary',\n className\n )}\n >\n {onInspect ? (\n <Tooltip title={inspectLabel}>\n <Button\n type=\"button\"\n size=\"xs\"\n variant=\"plain\"\n color=\"secondary\"\n aria-label={`${groupLabel}: ${inspectLabel}`}\n onClick={onInspect}\n className=\"focus-visible:ring-focus flex h-auto w-full flex-wrap items-center gap-space-1 rounded-md border-0 px-space-1 py-0 text-left transition-colors duration-fast hover:bg-surface-level-2 focus-visible:outline-hidden focus-visible:ring-2 motion-reduce:transition-none dark:hover:bg-surface-level-2\"\n >\n {content}\n </Button>\n </Tooltip>\n ) : (\n <div className=\"flex flex-wrap items-center gap-space-1 rounded-md px-space-1 transition-colors duration-fast hover:bg-surface-level-2 motion-reduce:transition-none\">\n {content}\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;AAeA,SAAgB,sBAAsB,EACpC,SACA,QACA,YACA,WACA,eAAe,qBACf,aAC6B;CAC7B,MAAM,UACJ,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,QAAD;EAAM,WAAU;EACb,UAAA;CACG,CAAA,GACL,MACD,EAAA,CAAA;CAGJ,OACE,oBAAC,OAAD;EACE,MAAK;EACL,cAAY;EACZ,WAAW,GACT,wDACA,SACF;EAEC,UAAA,YACC,oBAAC,SAAD;GAAS,OAAO;GACd,UAAA,oBAAC,QAAD;IACE,MAAK;IACL,MAAK;IACL,SAAQ;IACR,OAAM;IACN,cAAY,GAAG,WAAW,IAAI;IAC9B,SAAS;IACT,WAAU;IAET,UAAA;GACK,CAAA;EACD,CAAA,IAET,oBAAC,OAAD;GAAK,WAAU;GACZ,UAAA;EACE,CAAA;CAEJ,CAAA;AAET"}
@@ -0,0 +1,7 @@
1
+ export { ChatToolCall } from './ChatToolCall.js';
2
+ export type { ChatToolCallProps } from './ChatToolCall.js';
3
+ export { ChatToolCallGroup } from './ChatToolCallGroup.js';
4
+ export type { ChatToolCallGroupProps } from './ChatToolCallGroup.js';
5
+ export { ChatToolCallReasoning } from './ChatToolCallReasoning.js';
6
+ export type { ChatToolCallReasoningProps } from './ChatToolCallReasoning.js';
7
+ export type { ChatToolCallModel, ChatToolCallStatus, } from './ChatToolCall.types.js';
@@ -0,0 +1,4 @@
1
+ import { ChatToolCall } from "./ChatToolCall.js";
2
+ import { ChatToolCallGroup } from "./ChatToolCallGroup.js";
3
+ import { ChatToolCallReasoning } from "./ChatToolCallReasoning.js";
4
+ export { ChatToolCall, ChatToolCallGroup, ChatToolCallReasoning };
@@ -0,0 +1,85 @@
1
+ import { type HTMLAttributes, type ReactNode } from 'react';
2
+ export type RadarChartDatum = {
3
+ /** Unique, stable identifier for this axis. */
4
+ id: string;
5
+ label: string;
6
+ value: number;
7
+ /** Semantic chart color; defaults to the categorical fill palette in axis order. */
8
+ color?: string;
9
+ };
10
+ export type RadarChartAxis = {
11
+ /** Unique, stable identifier; keys each series' `values`. */
12
+ id: string;
13
+ label: string;
14
+ };
15
+ export type RadarChartSeries = {
16
+ /** Unique, stable identifier; use it as the matching legend item's id. */
17
+ id: string;
18
+ label: string;
19
+ /** Values keyed by axis id. Missing, negative, and non-finite values plot at zero. */
20
+ values: Readonly<Record<string, number | undefined>>;
21
+ /**
22
+ * Outline color; defaults to the categorical line palette in series order.
23
+ * The area uses the hue-matched fill color.
24
+ */
25
+ color?: string;
26
+ };
27
+ /** One axis and every visible series' value on it, for multi-series tooltips. */
28
+ export type RadarChartAxisValues = RadarChartAxis & {
29
+ /** Visible series in input order, with sanitized values and outline colors. */
30
+ values: readonly {
31
+ id: string;
32
+ label: string;
33
+ value: number;
34
+ color: string;
35
+ }[];
36
+ };
37
+ type RadarChartBaseProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
38
+ /** Shared axis maximum; defaults to the largest finite positive value. */
39
+ maxValue?: number;
40
+ /** Formats labels and the accessible data summary. */
41
+ formatValue?: (value: number) => string;
42
+ };
43
+ export type RadarChartSingleSeriesProps = RadarChartBaseProps & {
44
+ /** Axes in clockwise order, beginning at the top. Supply at least three. */
45
+ data: readonly RadarChartDatum[];
46
+ /**
47
+ * Content inside ChartTooltip on point or label hover and keyboard focus.
48
+ * Receives the sanitized value and resolved color. Compose ChartTooltipHeader,
49
+ * ChartTooltipBody, and ChartTooltipRow here; omit for a static chart.
50
+ */
51
+ renderTooltip?: (datum: RadarChartDatum) => ReactNode;
52
+ axes?: never;
53
+ series?: never;
54
+ renderAxisTooltip?: never;
55
+ selectedIds?: never;
56
+ activeLegendItemId?: never;
57
+ };
58
+ export type RadarChartMultiSeriesProps = RadarChartBaseProps & {
59
+ /** Axes in clockwise order, beginning at the top. Supply at least three. */
60
+ axes: readonly RadarChartAxis[];
61
+ /**
62
+ * Overlapping areas on the shared axes, drawn in input order. Keep to about
63
+ * four; beyond that, filter series or use small multiples.
64
+ */
65
+ series: readonly RadarChartSeries[];
66
+ /**
67
+ * Content inside ChartTooltip when an axis is hovered anywhere in its sector
68
+ * or focused. Compose one ChartTooltipRow per series; omit for a static chart.
69
+ */
70
+ renderAxisTooltip?: (axis: RadarChartAxisValues) => ReactNode;
71
+ /** When non-empty, only these series are drawn. Colors keep their series order. */
72
+ selectedIds?: ReadonlySet<string>;
73
+ /** Emphasizes one series from an external legend and dims the rest. */
74
+ activeLegendItemId?: string | null;
75
+ data?: never;
76
+ renderTooltip?: never;
77
+ };
78
+ export type RadarChartProps = RadarChartSingleSeriesProps | RadarChartMultiSeriesProps;
79
+ /**
80
+ * A radar with a shared scale and clockwise, outside axis labels. Pass `data`
81
+ * for one series with categorical points, or `axes` and `series` for
82
+ * overlapping areas identified by an external legend.
83
+ */
84
+ export declare const RadarChart: (props: RadarChartProps) => import("react").JSX.Element;
85
+ export {};