tfy-web-components 0.0.27 → 0.0.29

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.
@@ -8,7 +8,7 @@ const OpenUiFenceBlock = ({ isStreaming = false, content, darkTheme = true }) =>
8
8
  {
9
9
  className: classNames(
10
10
  "mb-2 min-h-32 w-full min-w-0 rounded-md border p-2",
11
- darkTheme ? "border-gray-600/50 bg-gray-900/40" : "border-gray-200 bg-white shadow-sm"
11
+ darkTheme ? "border-gray-275 bg-gray-200" : "border-gray-200 bg-white shadow-sm"
12
12
  ),
13
13
  children: /* @__PURE__ */ jsx(ThemeProvider, { mode: darkTheme ? "dark" : "light", cssSelector: ".markdown-openui-scope", children: /* @__PURE__ */ jsx("div", { className: "markdown-openui-scope min-w-0", children: /* @__PURE__ */ jsx(Renderer, { response: content, library: openuiLibrary, isStreaming }) }) })
14
14
  }
@@ -17,4 +17,4 @@ const OpenUiFenceBlock = ({ isStreaming = false, content, darkTheme = true }) =>
17
17
  export {
18
18
  OpenUiFenceBlock as default
19
19
  };
20
- //# sourceMappingURL=OpenUiFenceBlock-CsVY6kwA.js.map
20
+ //# sourceMappingURL=OpenUiFenceBlock-C4ZpWd0O.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpenUiFenceBlock-C4ZpWd0O.js","sources":["../src/components/molecules/Markdown/OpenUiFenceBlock.tsx"],"sourcesContent":["import React from 'react'\nimport { Renderer } from '@openuidev/react-lang'\nimport { openuiLibrary, ThemeProvider } from '@openuidev/react-ui'\n\nimport classNames from '@/utils/classNames'\n\nimport type { FencedCodeBlockProps } from './codeFencing'\n\nimport '@openuidev/react-ui/defaults.css'\nimport '@openuidev/react-ui/components.css'\n\n/**\n * Renders ```openui … ``` using the official OpenUI component library and theme.\n * Loaded only via dynamic import (see MarkdownWithOpenUI).\n * @see https://www.openui.com/docs/openui-lang\n */\nconst OpenUiFenceBlock: React.FC<FencedCodeBlockProps> = ({ isStreaming = false, content, darkTheme = true }) => {\n return (\n <div\n className={classNames(\n 'mb-2 min-h-32 w-full min-w-0 rounded-md border p-2',\n darkTheme ? 'border-gray-275 bg-gray-200' : 'border-gray-200 bg-white shadow-sm',\n )}\n >\n <ThemeProvider mode={darkTheme ? 'dark' : 'light'} cssSelector=\".markdown-openui-scope\">\n <div className=\"markdown-openui-scope min-w-0\">\n <Renderer response={content} library={openuiLibrary} isStreaming={isStreaming} />\n </div>\n </ThemeProvider>\n </div>\n )\n}\n\nexport default OpenUiFenceBlock\n"],"names":[],"mappings":";;;;AAgBA,MAAM,mBAAmD,CAAC,EAAE,cAAc,OAAO,SAAS,YAAY,WAAW;AAC/G,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA,YAAY,gCAAgC;AAAA,MAAA;AAAA,MAG9C,UAAA,oBAAC,iBAAc,MAAM,YAAY,SAAS,SAAS,aAAY,0BAC7D,UAAA,oBAAC,OAAA,EAAI,WAAU,iCACb,UAAA,oBAAC,YAAS,UAAU,SAAS,SAAS,eAAe,YAAA,CAA0B,GACjF,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -314,7 +314,7 @@ const SandboxArtifactsFenceBlock = ({
314
314
  }
315
315
  );
316
316
  };
317
- const preloadMarkdownOpenUI = () => import("../../OpenUiFenceBlock-CsVY6kwA.js");
317
+ const preloadMarkdownOpenUI = () => import("../../OpenUiFenceBlock-C4ZpWd0O.js");
318
318
  const OpenUiFenceBlockLazy = lazy(preloadMarkdownOpenUI);
319
319
  const SuspensedOpenUiFenceBlock = (props) => {
320
320
  return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Spinner, { small: true, center: true }), children: /* @__PURE__ */ jsx(OpenUiFenceBlockLazy, { ...props }) });
@@ -23,6 +23,7 @@ export interface AgentStepRowProps {
23
23
  persistentChildren?: React.ReactNode;
24
24
  dataTestPrefix?: string;
25
25
  className?: string;
26
+ titleClassName?: string;
26
27
  }
27
28
  declare const AgentStepRow: React.FC<AgentStepRowProps>;
28
29
  export default AgentStepRow;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ export interface AgentStepsCardProps {
3
+ toolCount: number;
4
+ thinkingCount: number;
5
+ expanded: boolean;
6
+ active?: boolean;
7
+ onToggle: () => void;
8
+ children: React.ReactNode;
9
+ borderColor?: string;
10
+ background?: string;
11
+ dataTestPrefix?: string;
12
+ className?: string;
13
+ }
14
+ declare const AgentStepsCard: React.FC<AgentStepsCardProps>;
15
+ export default AgentStepsCard;
@@ -14,8 +14,7 @@ const UserMessage = ({ text, className, editAction, actionsAlwaysVisible = false
14
14
  {
15
15
  className: classNames(
16
16
  "w-fit max-w-[85%] rounded-[0.75rem] border border-transparent p-3",
17
- "bg-indigo-500 text-white dark:bg-gray-275 dark:text-light-white",
18
- "transition-all duration-100 hover:border-gray-250 dark:hover:border-indigo-600"
17
+ "bg-indigo-500 text-white dark:bg-gray-275 dark:text-light-white"
19
18
  ),
20
19
  children: /* @__PURE__ */ jsx("div", { className: "break-words [word-break:break-word] whitespace-pre-wrap text-base font-lab leading-[1.34]", children: text })
21
20
  }
@@ -1 +1 @@
1
- {"version":3,"file":"UserMessage.es.js","sources":["../../../../src/components/molecules/agent-chat/UserMessage.tsx"],"sourcesContent":["import React from 'react'\n\nimport classNames from '@/utils/classNames'\n\nexport interface UserMessageProps {\n text: string\n className?: string\n /** Edit button — glue passes ActionBarPrimitive.Edit or a styled button */\n editAction?: React.ReactNode\n /** When true, action row stays visible instead of hover-reveal. */\n actionsAlwaysVisible?: boolean\n}\n\nconst UserMessage: React.FC<UserMessageProps> = ({ text, className, editAction, actionsAlwaysVisible = false }) => {\n return (\n <div\n className={classNames(\n 'flex w-full flex-col items-end gap-1 transition-all duration-100 group/chat my-1',\n className,\n )}\n >\n <div\n className={classNames(\n 'w-fit max-w-[85%] rounded-[0.75rem] border border-transparent p-3',\n 'bg-indigo-500 text-white dark:bg-gray-275 dark:text-light-white',\n 'transition-all duration-100 hover:border-gray-250 dark:hover:border-indigo-600',\n )}\n >\n <div className=\"break-words [word-break:break-word] whitespace-pre-wrap text-base font-lab leading-[1.34]\">\n {text}\n </div>\n </div>\n {editAction != null ? (\n <div\n className={classNames(\n 'flex w-full min-w-0 items-center justify-end gap-2 transition-opacity duration-100',\n actionsAlwaysVisible\n ? 'opacity-100 pointer-events-auto'\n : 'opacity-0 pointer-events-none group-hover/chat:opacity-100 group-hover/chat:pointer-events-auto',\n )}\n >\n {editAction}\n </div>\n ) : null}\n </div>\n )\n}\n\nexport default UserMessage\n"],"names":[],"mappings":";;AAaA,MAAM,cAA0C,CAAC,EAAE,MAAM,WAAW,YAAY,uBAAuB,YAAY;AACjH,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MAAA;AAAA,MAGF,UAAA;AAAA,QAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAW;AAAA,cACT;AAAA,cACA;AAAA,cACA;AAAA,YAAA;AAAA,YAGF,UAAA,oBAAC,OAAA,EAAI,WAAU,6FACZ,UAAA,KAAA,CACH;AAAA,UAAA;AAAA,QAAA;AAAA,QAED,cAAc,OACb;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAW;AAAA,cACT;AAAA,cACA,uBACI,oCACA;AAAA,YAAA;AAAA,YAGL,UAAA;AAAA,UAAA;AAAA,QAAA,IAED;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGV;"}
1
+ {"version":3,"file":"UserMessage.es.js","sources":["../../../../src/components/molecules/agent-chat/UserMessage.tsx"],"sourcesContent":["import React from 'react'\n\nimport classNames from '@/utils/classNames'\n\nexport interface UserMessageProps {\n text: string\n className?: string\n /** Edit button — glue passes ActionBarPrimitive.Edit or a styled button */\n editAction?: React.ReactNode\n /** When true, action row stays visible instead of hover-reveal. */\n actionsAlwaysVisible?: boolean\n}\n\nconst UserMessage: React.FC<UserMessageProps> = ({ text, className, editAction, actionsAlwaysVisible = false }) => {\n return (\n <div\n className={classNames(\n 'flex w-full flex-col items-end gap-1 transition-all duration-100 group/chat my-1',\n className,\n )}\n >\n <div\n className={classNames(\n 'w-fit max-w-[85%] rounded-[0.75rem] border border-transparent p-3',\n 'bg-indigo-500 text-white dark:bg-gray-275 dark:text-light-white',\n )}\n >\n <div className=\"break-words [word-break:break-word] whitespace-pre-wrap text-base font-lab leading-[1.34]\">\n {text}\n </div>\n </div>\n {editAction != null ? (\n <div\n className={classNames(\n 'flex w-full min-w-0 items-center justify-end gap-2 transition-opacity duration-100',\n actionsAlwaysVisible\n ? 'opacity-100 pointer-events-auto'\n : 'opacity-0 pointer-events-none group-hover/chat:opacity-100 group-hover/chat:pointer-events-auto',\n )}\n >\n {editAction}\n </div>\n ) : null}\n </div>\n )\n}\n\nexport default UserMessage\n"],"names":[],"mappings":";;AAaA,MAAM,cAA0C,CAAC,EAAE,MAAM,WAAW,YAAY,uBAAuB,YAAY;AACjH,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MAAA;AAAA,MAGF,UAAA;AAAA,QAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAW;AAAA,cACT;AAAA,cACA;AAAA,YAAA;AAAA,YAGF,UAAA,oBAAC,OAAA,EAAI,WAAU,6FACZ,UAAA,KAAA,CACH;AAAA,UAAA;AAAA,QAAA;AAAA,QAED,cAAc,OACb;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAW;AAAA,cACT;AAAA,cACA,uBACI,oCACA;AAAA,YAAA;AAAA,YAGL,UAAA;AAAA,UAAA;AAAA,QAAA,IAED;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGV;"}
@@ -1,5 +1,7 @@
1
1
  export type { AgentStepRowProps, AgentStepStatus } from './AgentStepRow';
2
2
  export { default as AgentStepRow } from './AgentStepRow';
3
+ export type { AgentStepsCardProps } from './AgentStepsCard';
4
+ export { default as AgentStepsCard } from './AgentStepsCard';
3
5
  export type { AnsweredQuestion, AskUserAnswerDraft, AskUserQuestionCardProps, Question } from './AskUserQuestionCard';
4
6
  export { ASK_USER_CUSTOM_OPTION, default as AskUserQuestionCard } from './AskUserQuestionCard';
5
7
  export type { AssistantMessageProps } from './AssistantMessage';
@@ -3,6 +3,9 @@ import { c as classNames } from "../../classNames-Dy-RXSjS.js";
3
3
  import { t as toDataTestId } from "../../Notification-BT4CZ69U.js";
4
4
  import IconProvider from "../atoms/IconProvider.es.js";
5
5
  import Spinner from "../atoms/Spinner.es.js";
6
+ import { Accordion, AccordionSummary, AccordionDetails } from "../atoms/Accordion.es.js";
7
+ import { colors } from "../theme/theme.es.js";
8
+ import { useTheme } from "../theme/useTheme.es.js";
6
9
  import { Button } from "../atoms/Button.es.js";
7
10
  import IconButton from "../atoms/IconButton.es.js";
8
11
  import OutlinedRadio from "../atoms/OutlinedRadio.es.js";
@@ -78,7 +81,8 @@ const AgentStepRow = ({
78
81
  children,
79
82
  persistentChildren,
80
83
  dataTestPrefix,
81
- className
84
+ className,
85
+ titleClassName
82
86
  }) => {
83
87
  const hasChildren = !!children;
84
88
  const hasPersistentChildren = !!persistentChildren;
@@ -129,7 +133,7 @@ const AgentStepRow = ({
129
133
  /* @__PURE__ */ jsx(
130
134
  "span",
131
135
  {
132
- className: "text-sm font-medium text-gray-750 font-sans",
136
+ className: classNames("text-sm font-medium text-gray-750 font-sans", titleClassName),
133
137
  "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "title"),
134
138
  children: title
135
139
  }
@@ -205,6 +209,75 @@ const AgentStepRow = ({
205
209
  }
206
210
  );
207
211
  };
212
+ const AgentStepsCard = ({
213
+ toolCount,
214
+ thinkingCount,
215
+ expanded,
216
+ active = false,
217
+ onToggle,
218
+ children,
219
+ borderColor,
220
+ background = "transparent",
221
+ dataTestPrefix,
222
+ className
223
+ }) => {
224
+ const { isDark } = useTheme();
225
+ const toolLabel = `${toolCount} tool ${toolCount === 1 ? "call" : "calls"}`;
226
+ const thinkingLabel = thinkingCount > 0 ? ` · ${thinkingCount} thought${thinkingCount === 1 ? "" : "s"}` : "";
227
+ const defaultBorderColor = borderColor ?? (isDark ? colors.gray[275] : colors.gray[250]);
228
+ return /* @__PURE__ */ jsxs(
229
+ Accordion,
230
+ {
231
+ expanded,
232
+ onChange: () => onToggle(),
233
+ background,
234
+ borderColor: defaultBorderColor,
235
+ className: classNames("rounded-lg", className),
236
+ sx: { margin: 0, boxShadow: "none", color: colors.gray[750] },
237
+ "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "agent-steps-card"),
238
+ children: [
239
+ /* @__PURE__ */ jsx(
240
+ AccordionSummary,
241
+ {
242
+ hideIcon: true,
243
+ disableRipple: true,
244
+ sx: {
245
+ padding: 0,
246
+ minHeight: 0,
247
+ "&.Mui-expanded": { minHeight: 0 },
248
+ "& .MuiAccordionSummary-content": { margin: 0, width: "100%" }
249
+ },
250
+ children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 w-full py-2 px-2.5 text-left text-xs", children: [
251
+ /* @__PURE__ */ jsx(
252
+ IconProvider,
253
+ {
254
+ icon: expanded ? "chevron-down" : "chevron-right",
255
+ size: 0.75,
256
+ className: "shrink-0 text-gray-500"
257
+ }
258
+ ),
259
+ /* @__PURE__ */ jsx("span", { className: "font-semibold text-gray-750", children: "Agent steps" }),
260
+ /* @__PURE__ */ jsxs("span", { className: "text-gray-500", children: [
261
+ "· ",
262
+ toolLabel,
263
+ thinkingLabel
264
+ ] }),
265
+ active && /* @__PURE__ */ jsx("div", { className: "ml-auto", children: /* @__PURE__ */ jsx(Spinner, { small: true, className: "text-indigo-600" }) })
266
+ ] })
267
+ }
268
+ ),
269
+ /* @__PURE__ */ jsx(AccordionDetails, { sx: { padding: 0 }, children: /* @__PURE__ */ jsx(
270
+ "div",
271
+ {
272
+ className: "space-y-3 border-t border-gray-200 dark:border-gray-275 p-3",
273
+ "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, "content"),
274
+ children
275
+ }
276
+ ) })
277
+ ]
278
+ }
279
+ );
280
+ };
208
281
  const ASK_USER_CUSTOM_OPTION = "__tfy_ask_user_question_custom__";
209
282
  const AskUserQuestionCard = ({
210
283
  questions,
@@ -229,7 +302,7 @@ const AskUserQuestionCard = ({
229
302
  const isLastQuestion = isLastQuestionProp ?? currentQuestionIndex === totalQuestions - 1;
230
303
  if (questions.length === 0) {
231
304
  if (answeredQuestions.length === 0) return null;
232
- return /* @__PURE__ */ jsx("div", { className: classNames("flex flex-col gap-3", className), children: answeredQuestions.map((q) => /* @__PURE__ */ jsxs("div", { "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, `answered-${q.id}`), children: [
305
+ return /* @__PURE__ */ jsx("div", { className: classNames("flex flex-col gap-3 mt-2", className), children: answeredQuestions.map((q) => /* @__PURE__ */ jsxs("div", { "data-test": dataTestPrefix && toDataTestId(dataTestPrefix, `answered-${q.id}`), children: [
233
306
  /* @__PURE__ */ jsxs("div", { className: "bg-indigo-50 dark:bg-gray-250 border rounded-t-lg border-indigo-300 dark:border-gray-275 px-4 py-2 flex items-center justify-between", children: [
234
307
  /* @__PURE__ */ jsx("div", { className: "text-xs font-medium font-sans text-indigo-600 dark:text-gray-700", children: q.question }),
235
308
  /* @__PURE__ */ jsx("div", { className: "text-[0.6875rem] flex items-center gap-1 font-medium text-gray-600 border border-indigo-400 bg-white dark:bg-gray-200 rounded px-2 py-0.5 shrink-0 h-fit", children: /* @__PURE__ */ jsx("span", { className: "text-[0.6875rem] leading-tight", children: "Answered" }) })
@@ -455,7 +528,7 @@ const ReasoningCard = ({
455
528
  isMultiLine = false,
456
529
  reasoningTimeText,
457
530
  previewText = "",
458
- headingText = "Show Reasoning",
531
+ headingText = "Reasoning",
459
532
  contentRef,
460
533
  dataTestPrefix,
461
534
  className
@@ -474,13 +547,14 @@ const ReasoningCard = ({
474
547
  "div",
475
548
  {
476
549
  ref: contentRef,
477
- className: "border-l-4 border-l-blue-500 pl-3 text-gray-600 dark:text-gray-400 text-sm font-normal font-sans",
478
- children: /* @__PURE__ */ jsx(Markdown, { className: "text-gray-600 dark:text-gray-400 font-sans text-sm", children: content })
550
+ className: "border-l-4 border-l-blue-500 pl-3 text-gray-600 text-sm font-normal font-sans",
551
+ children: /* @__PURE__ */ jsx(Markdown, { className: "text-gray-600 font-sans text-sm", children: content })
479
552
  }
480
553
  ),
481
554
  status,
482
- expandable: false,
483
- showChevronColumn: false,
555
+ expandable: true,
556
+ expanded,
557
+ onToggle,
484
558
  dataTestPrefix
485
559
  }
486
560
  ) });
@@ -491,7 +565,7 @@ const ReasoningCard = ({
491
565
  icon: isStreaming ? "brain" : "brain-regular",
492
566
  iconVariant: "primary",
493
567
  label: headingText,
494
- body: expanded && content ? /* @__PURE__ */ jsx("div", { ref: contentRef, className: "border-l-4 border-l-blue-500 pl-3", children: /* @__PURE__ */ jsx(Markdown, { className: "text-gray-600 dark:text-gray-400 font-sans text-sm", children: content }) }) : !expanded && previewText ? /* @__PURE__ */ jsx("div", { className: "border-l-4 border-l-blue-500 pl-3 text-gray-600 dark:text-gray-400 text-sm font-normal font-sans truncate", children: previewText }) : void 0,
568
+ body: expanded && content ? /* @__PURE__ */ jsx("div", { ref: contentRef, className: "border-l-4 border-l-blue-500 pl-3", children: /* @__PURE__ */ jsx(Markdown, { className: "text-gray-600 font-sans text-sm", children: content }) }) : !expanded && previewText ? /* @__PURE__ */ jsx("div", { className: "border-l-4 border-l-blue-500 pl-3 text-gray-600 text-sm font-normal font-sans truncate", children: previewText }) : void 0,
495
569
  expandable: isExpandable,
496
570
  expanded,
497
571
  onToggle,
@@ -672,6 +746,7 @@ const SubAgentCard = ({
672
746
  status: agentStatus,
673
747
  statusText: durationText,
674
748
  dataTestPrefix,
749
+ titleClassName: "mt-0.5",
675
750
  children: [
676
751
  instructionContent != null && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 border border-gray-200 dark:border-gray-275 rounded-md p-2 mb-3", children: [
677
752
  /* @__PURE__ */ jsx("h4", { className: "text-sm font-semibold text-gray-900", children: "Instructions" }),
@@ -868,7 +943,7 @@ const ToolCallCard = ({
868
943
  "flex flex-col min-w-0",
869
944
  {
870
945
  "rounded-md p-1 -mx-1": highlightCard,
871
- "p-0 mx-0": !highlightCard
946
+ "p-0 mx-0 mt-2": !highlightCard
872
947
  },
873
948
  className
874
949
  ),
@@ -881,6 +956,7 @@ const ToolCallCard = ({
881
956
  iconVariant: derivedIconVariant,
882
957
  iconSize: derivedIconSize,
883
958
  title: toolName,
959
+ titleClassName: "mt-0.5",
884
960
  expandable: isExpandable,
885
961
  expanded,
886
962
  onToggle,
@@ -984,6 +1060,7 @@ const ToolCallContentBlock = ({
984
1060
  export {
985
1061
  ASK_USER_CUSTOM_OPTION,
986
1062
  AgentStepRow,
1063
+ AgentStepsCard,
987
1064
  AskUserQuestionCard,
988
1065
  AssistantMessage,
989
1066
  McpAuthCard,