pixelize-design-library 3.1.0 → 3.2.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 (142) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/COMPONENT-GOTCHAS.md +29 -0
  3. package/DESIGN-GUIDE.md +27 -0
  4. package/README.md +8 -8
  5. package/dist/Components/Assistant/assistantModel.d.ts +17 -0
  6. package/dist/Components/Assistant/assistantModel.js +35 -0
  7. package/dist/Components/Assistant/assistantStyles.d.ts +27 -0
  8. package/dist/Components/Assistant/assistantStyles.js +53 -0
  9. package/dist/Components/Assistant/assistantTypes.d.ts +163 -0
  10. package/dist/Components/Assistant/assistantTypes.js +2 -0
  11. package/dist/Components/Assistant/banner/AssistantStatusBanner.d.ts +3 -0
  12. package/dist/Components/Assistant/banner/AssistantStatusBanner.js +25 -0
  13. package/dist/Components/Assistant/banner/AssistantStatusBannerProps.d.ts +27 -0
  14. package/dist/Components/Assistant/banner/AssistantStatusBannerProps.js +2 -0
  15. package/dist/Components/Assistant/cards/AssistantApprovalCard.d.ts +3 -0
  16. package/dist/Components/Assistant/cards/AssistantApprovalCard.js +51 -0
  17. package/dist/Components/Assistant/cards/AssistantApprovalCardProps.d.ts +66 -0
  18. package/dist/Components/Assistant/cards/AssistantApprovalCardProps.js +2 -0
  19. package/dist/Components/Assistant/cards/AssistantProposalCard.d.ts +3 -0
  20. package/dist/Components/Assistant/cards/AssistantProposalCard.js +36 -0
  21. package/dist/Components/Assistant/cards/AssistantProposalCardProps.d.ts +56 -0
  22. package/dist/Components/Assistant/cards/AssistantProposalCardProps.js +2 -0
  23. package/dist/Components/Assistant/cards/CardShell.d.ts +31 -0
  24. package/dist/Components/Assistant/cards/CardShell.js +32 -0
  25. package/dist/Components/Assistant/composer/AssistantComposer.d.ts +3 -0
  26. package/dist/Components/Assistant/composer/AssistantComposer.js +264 -0
  27. package/dist/Components/Assistant/composer/AssistantComposerProps.d.ts +128 -0
  28. package/dist/Components/Assistant/composer/AssistantComposerProps.js +2 -0
  29. package/dist/Components/Assistant/composer/ComposerMenu.d.ts +24 -0
  30. package/dist/Components/Assistant/composer/ComposerMenu.js +38 -0
  31. package/dist/Components/Assistant/composer/composerLogic.d.ts +19 -0
  32. package/dist/Components/Assistant/composer/composerLogic.js +65 -0
  33. package/dist/Components/Assistant/context/AssistantContextBar.d.ts +3 -0
  34. package/dist/Components/Assistant/context/AssistantContextBar.js +27 -0
  35. package/dist/Components/Assistant/context/AssistantContextBarProps.d.ts +34 -0
  36. package/dist/Components/Assistant/context/AssistantContextBarProps.js +2 -0
  37. package/dist/Components/Assistant/history/AssistantHistoryList.d.ts +3 -0
  38. package/dist/Components/Assistant/history/AssistantHistoryList.js +123 -0
  39. package/dist/Components/Assistant/history/AssistantHistoryListProps.d.ts +83 -0
  40. package/dist/Components/Assistant/history/AssistantHistoryListProps.js +2 -0
  41. package/dist/Components/Assistant/history/groupConversations.d.ts +12 -0
  42. package/dist/Components/Assistant/history/groupConversations.js +55 -0
  43. package/dist/Components/Assistant/index.d.ts +16 -0
  44. package/dist/Components/Assistant/index.js +38 -0
  45. package/dist/Components/Assistant/launcher/AssistantLauncher.d.ts +3 -0
  46. package/dist/Components/Assistant/launcher/AssistantLauncher.js +45 -0
  47. package/dist/Components/Assistant/launcher/AssistantLauncherProps.d.ts +37 -0
  48. package/dist/Components/Assistant/launcher/AssistantLauncherProps.js +2 -0
  49. package/dist/Components/Assistant/markdown/AssistantMarkdown.d.ts +3 -0
  50. package/dist/Components/Assistant/markdown/AssistantMarkdown.js +146 -0
  51. package/dist/Components/Assistant/markdown/AssistantMarkdownProps.d.ts +38 -0
  52. package/dist/Components/Assistant/markdown/AssistantMarkdownProps.js +2 -0
  53. package/dist/Components/Assistant/markdown/parseMarkdown.d.ts +74 -0
  54. package/dist/Components/Assistant/markdown/parseMarkdown.js +328 -0
  55. package/dist/Components/Assistant/markdown/safeHref.d.ts +21 -0
  56. package/dist/Components/Assistant/markdown/safeHref.js +28 -0
  57. package/dist/Components/Assistant/message/AssistantMessage.d.ts +3 -0
  58. package/dist/Components/Assistant/message/AssistantMessage.js +131 -0
  59. package/dist/Components/Assistant/message/AssistantMessageProps.d.ts +83 -0
  60. package/dist/Components/Assistant/message/AssistantMessageProps.js +2 -0
  61. package/dist/Components/Assistant/message/MessageActions.d.ts +16 -0
  62. package/dist/Components/Assistant/message/MessageActions.js +23 -0
  63. package/dist/Components/Assistant/panel/AssistantPanel.d.ts +3 -0
  64. package/dist/Components/Assistant/panel/AssistantPanel.js +87 -0
  65. package/dist/Components/Assistant/panel/AssistantPanelProps.d.ts +86 -0
  66. package/dist/Components/Assistant/panel/AssistantPanelProps.js +2 -0
  67. package/dist/Components/Assistant/panel/ResizeHandle.d.ts +14 -0
  68. package/dist/Components/Assistant/panel/ResizeHandle.js +72 -0
  69. package/dist/Components/Assistant/sources/AssistantSources.d.ts +3 -0
  70. package/dist/Components/Assistant/sources/AssistantSources.js +63 -0
  71. package/dist/Components/Assistant/sources/AssistantSourcesProps.d.ts +29 -0
  72. package/dist/Components/Assistant/sources/AssistantSourcesProps.js +2 -0
  73. package/dist/Components/Assistant/steps/AssistantToolSteps.d.ts +3 -0
  74. package/dist/Components/Assistant/steps/AssistantToolSteps.js +41 -0
  75. package/dist/Components/Assistant/steps/AssistantToolStepsProps.d.ts +37 -0
  76. package/dist/Components/Assistant/steps/AssistantToolStepsProps.js +2 -0
  77. package/dist/Components/Assistant/suggestions/AssistantSuggestions.d.ts +3 -0
  78. package/dist/Components/Assistant/suggestions/AssistantSuggestions.js +18 -0
  79. package/dist/Components/Assistant/suggestions/AssistantSuggestionsProps.d.ts +15 -0
  80. package/dist/Components/Assistant/suggestions/AssistantSuggestionsProps.js +2 -0
  81. package/dist/Components/Assistant/thread/AssistantThread.d.ts +3 -0
  82. package/dist/Components/Assistant/thread/AssistantThread.js +112 -0
  83. package/dist/Components/Assistant/thread/AssistantThreadProps.d.ts +37 -0
  84. package/dist/Components/Assistant/thread/AssistantThreadProps.js +2 -0
  85. package/dist/Components/Assistant/typing/AssistantTypingIndicator.d.ts +3 -0
  86. package/dist/Components/Assistant/typing/AssistantTypingIndicator.js +33 -0
  87. package/dist/Components/Assistant/typing/AssistantTypingIndicatorProps.d.ts +9 -0
  88. package/dist/Components/Assistant/typing/AssistantTypingIndicatorProps.js +2 -0
  89. package/dist/Components/Assistant/welcome/AssistantWelcome.d.ts +3 -0
  90. package/dist/Components/Assistant/welcome/AssistantWelcome.js +30 -0
  91. package/dist/Components/Assistant/welcome/AssistantWelcomeProps.d.ts +40 -0
  92. package/dist/Components/Assistant/welcome/AssistantWelcomeProps.js +2 -0
  93. package/dist/Components/Table/components/TableBody.js +5 -1
  94. package/dist/esm/Components/Assistant/assistantModel.js +29 -0
  95. package/dist/esm/Components/Assistant/assistantStyles.js +47 -0
  96. package/dist/esm/Components/Assistant/assistantTypes.js +1 -0
  97. package/dist/esm/Components/Assistant/banner/AssistantStatusBanner.js +20 -0
  98. package/dist/esm/Components/Assistant/banner/AssistantStatusBannerProps.js +1 -0
  99. package/dist/esm/Components/Assistant/cards/AssistantApprovalCard.js +46 -0
  100. package/dist/esm/Components/Assistant/cards/AssistantApprovalCardProps.js +1 -0
  101. package/dist/esm/Components/Assistant/cards/AssistantProposalCard.js +31 -0
  102. package/dist/esm/Components/Assistant/cards/AssistantProposalCardProps.js +1 -0
  103. package/dist/esm/Components/Assistant/cards/CardShell.js +23 -0
  104. package/dist/esm/Components/Assistant/composer/AssistantComposer.js +259 -0
  105. package/dist/esm/Components/Assistant/composer/AssistantComposerProps.js +1 -0
  106. package/dist/esm/Components/Assistant/composer/ComposerMenu.js +30 -0
  107. package/dist/esm/Components/Assistant/composer/composerLogic.js +56 -0
  108. package/dist/esm/Components/Assistant/context/AssistantContextBar.js +22 -0
  109. package/dist/esm/Components/Assistant/context/AssistantContextBarProps.js +1 -0
  110. package/dist/esm/Components/Assistant/history/AssistantHistoryList.js +118 -0
  111. package/dist/esm/Components/Assistant/history/AssistantHistoryListProps.js +1 -0
  112. package/dist/esm/Components/Assistant/history/groupConversations.js +51 -0
  113. package/dist/esm/Components/Assistant/index.js +16 -0
  114. package/dist/esm/Components/Assistant/launcher/AssistantLauncher.js +40 -0
  115. package/dist/esm/Components/Assistant/launcher/AssistantLauncherProps.js +1 -0
  116. package/dist/esm/Components/Assistant/markdown/AssistantMarkdown.js +141 -0
  117. package/dist/esm/Components/Assistant/markdown/AssistantMarkdownProps.js +1 -0
  118. package/dist/esm/Components/Assistant/markdown/parseMarkdown.js +322 -0
  119. package/dist/esm/Components/Assistant/markdown/safeHref.js +23 -0
  120. package/dist/esm/Components/Assistant/message/AssistantMessage.js +126 -0
  121. package/dist/esm/Components/Assistant/message/AssistantMessageProps.js +1 -0
  122. package/dist/esm/Components/Assistant/message/MessageActions.js +16 -0
  123. package/dist/esm/Components/Assistant/panel/AssistantPanel.js +82 -0
  124. package/dist/esm/Components/Assistant/panel/AssistantPanelProps.js +1 -0
  125. package/dist/esm/Components/Assistant/panel/ResizeHandle.js +68 -0
  126. package/dist/esm/Components/Assistant/sources/AssistantSources.js +58 -0
  127. package/dist/esm/Components/Assistant/sources/AssistantSourcesProps.js +1 -0
  128. package/dist/esm/Components/Assistant/steps/AssistantToolSteps.js +36 -0
  129. package/dist/esm/Components/Assistant/steps/AssistantToolStepsProps.js +1 -0
  130. package/dist/esm/Components/Assistant/suggestions/AssistantSuggestions.js +13 -0
  131. package/dist/esm/Components/Assistant/suggestions/AssistantSuggestionsProps.js +1 -0
  132. package/dist/esm/Components/Assistant/thread/AssistantThread.js +107 -0
  133. package/dist/esm/Components/Assistant/thread/AssistantThreadProps.js +1 -0
  134. package/dist/esm/Components/Assistant/typing/AssistantTypingIndicator.js +28 -0
  135. package/dist/esm/Components/Assistant/typing/AssistantTypingIndicatorProps.js +1 -0
  136. package/dist/esm/Components/Assistant/welcome/AssistantWelcome.js +25 -0
  137. package/dist/esm/Components/Assistant/welcome/AssistantWelcomeProps.js +1 -0
  138. package/dist/esm/Components/Table/components/TableBody.js +5 -1
  139. package/dist/esm/index.js +2 -0
  140. package/dist/index.d.ts +18 -0
  141. package/dist/index.js +20 -1
  142. package/package.json +1 -1
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const react_1 = require("react");
8
+ const react_2 = require("@chakra-ui/react");
9
+ const lucide_react_1 = require("lucide-react");
10
+ const useCustomTheme_1 = require("../../../Theme/useCustomTheme");
11
+ const scrollbar_1 = require("../../../Theme/tokens/builders/scrollbar");
12
+ const motion_1 = require("../../../Theme/chakra/motion");
13
+ const sharedResizeObserver_1 = require("../../../Hooks/sharedResizeObserver");
14
+ const mergeRefs_1 = require("../../../Utils/mergeRefs");
15
+ const Button_1 = __importDefault(require("../../Button/Button"));
16
+ const VisuallyHidden_1 = __importDefault(require("../../VisuallyHidden/VisuallyHidden"));
17
+ const AssistantMessage_1 = __importDefault(require("../message/AssistantMessage"));
18
+ const assistantModel_1 = require("../assistantModel");
19
+ const parseMarkdown_1 = require("../markdown/parseMarkdown");
20
+ const DEFAULT_LABELS = {
21
+ region: "Conversation",
22
+ jumpToLatest: "Jump to latest",
23
+ completed: (text) => (text ? `Assistant replied: ${(0, assistantModel_1.truncate)(text, 200)}` : "Assistant replied"),
24
+ failed: "The assistant's reply failed",
25
+ stopped: "Response stopped",
26
+ };
27
+ const distanceFromBottom = (el) => el.scrollHeight - el.scrollTop - el.clientHeight;
28
+ /**
29
+ * Scroll container for a conversation. It follows the newest content while the person is at the bottom,
30
+ * stops following once they scroll up (showing "Jump to latest"), and re-sticks when they send. A polite
31
+ * live region announces a reply once it finishes streaming, never token by token.
32
+ */
33
+ const AssistantThread = ({ messages, renderMessage, messageProps, emptyState, children, stickThreshold = 48, scrollContainerRef, labels, "data-testid": testId = "assistant-thread", }) => {
34
+ const { colors } = (0, useCustomTheme_1.useCustomTheme)();
35
+ const text = { ...DEFAULT_LABELS, ...labels };
36
+ const reducedMotion = (0, motion_1.usePrefersReducedMotion)();
37
+ const scrollRef = (0, react_1.useRef)(null);
38
+ const contentRef = (0, react_1.useRef)(null);
39
+ const stuck = (0, react_1.useRef)(true);
40
+ const [showJump, setShowJump] = (0, react_1.useState)(false);
41
+ const [announcement, setAnnouncement] = (0, react_1.useState)("");
42
+ const statuses = (0, react_1.useRef)(new Map());
43
+ const lastId = (0, react_1.useRef)(undefined);
44
+ const ref = (0, react_1.useMemo)(() => (0, mergeRefs_1.mergeRefs)(scrollRef, scrollContainerRef), [scrollContainerRef]);
45
+ const scrollToBottom = (0, react_1.useCallback)((smooth) => {
46
+ const el = scrollRef.current;
47
+ if (!el)
48
+ return;
49
+ const top = el.scrollHeight;
50
+ if (smooth && !reducedMotion && typeof el.scrollTo === "function")
51
+ el.scrollTo({ top, behavior: "smooth" });
52
+ else
53
+ el.scrollTop = top;
54
+ }, [reducedMotion]);
55
+ const onScroll = () => {
56
+ const el = scrollRef.current;
57
+ if (!el)
58
+ return;
59
+ const atBottom = distanceFromBottom(el) <= stickThreshold;
60
+ stuck.current = atBottom;
61
+ setShowJump(!atBottom);
62
+ };
63
+ // New content: follow it if stuck; a message the person just sent always re-sticks.
64
+ (0, react_1.useLayoutEffect)(() => {
65
+ const last = messages[messages.length - 1];
66
+ if (last && last.id !== lastId.current && last.role === "user")
67
+ stuck.current = true;
68
+ lastId.current = last === null || last === void 0 ? void 0 : last.id;
69
+ if (stuck.current) {
70
+ scrollToBottom(false);
71
+ setShowJump(false);
72
+ }
73
+ }, [messages, scrollToBottom]);
74
+ // Growth that is not a new message (markdown reflow, an image loading, a card expanding).
75
+ (0, react_1.useEffect)(() => {
76
+ const el = contentRef.current;
77
+ if (!el)
78
+ return undefined;
79
+ return (0, sharedResizeObserver_1.observeResize)(el, () => {
80
+ if (stuck.current)
81
+ scrollToBottom(false);
82
+ });
83
+ }, [scrollToBottom]);
84
+ (0, react_1.useEffect)(() => {
85
+ const seen = statuses.current;
86
+ messages.forEach((message) => {
87
+ var _a;
88
+ const now = (_a = message.status) !== null && _a !== void 0 ? _a : "complete";
89
+ const before = seen.get(message.id);
90
+ seen.set(message.id, now);
91
+ if (before !== "streaming" || now === "streaming" || message.role !== "assistant")
92
+ return;
93
+ if (now === "complete")
94
+ setAnnouncement(text.completed((0, parseMarkdown_1.markdownToPlainText)((0, assistantModel_1.messageText)(message))));
95
+ else if (now === "error")
96
+ setAnnouncement(text.failed);
97
+ else
98
+ setAnnouncement(text.stopped);
99
+ });
100
+ // Labels are read at announcement time on purpose; only message transitions drive this effect.
101
+ // eslint-disable-next-line react-hooks/exhaustive-deps
102
+ }, [messages]);
103
+ const jump = () => {
104
+ stuck.current = true;
105
+ setShowJump(false);
106
+ scrollToBottom(true);
107
+ };
108
+ return ((0, jsx_runtime_1.jsxs)(react_2.Box, { position: "relative", flex: "1", minH: 0, h: "100%", "data-testid": testId, children: [(0, jsx_runtime_1.jsx)(react_2.Box, { ref: ref, role: "region", "aria-label": text.region, h: "100%", overflowY: "auto", overscrollBehavior: "contain", sx: (0, scrollbar_1.scrollbarStyles)(colors), onScroll: onScroll, "data-testid": `${testId}-scroll`, children: (0, jsx_runtime_1.jsxs)(react_2.Flex, { ref: contentRef, direction: "column", gap: 5, px: 4, py: 4, minH: "100%", children: [messages.length === 0 && emptyState
109
+ ? emptyState
110
+ : messages.map((message, index) => renderMessage ? ((0, jsx_runtime_1.jsx)(react_2.Box, { children: renderMessage(message, index) }, message.id)) : ((0, jsx_runtime_1.jsx)(AssistantMessage_1.default, { ...messageProps, message: message }, message.id))), children] }) }), showJump ? ((0, jsx_runtime_1.jsx)(react_2.Box, { position: "absolute", bottom: 3, left: "50%", transform: "translateX(-50%)", boxShadow: "md", borderRadius: "full", bg: colors.surfaceRaised, children: (0, jsx_runtime_1.jsx)(Button_1.default, { size: "xs", variant: "outline", colorScheme: "gray", borderRadius: "full", leftIcon: (0, jsx_runtime_1.jsx)(lucide_react_1.ArrowDown, { size: 14 }), label: text.jumpToLatest, onClick: jump, "data-testid": `${testId}-jump` }) })) : null, (0, jsx_runtime_1.jsx)(VisuallyHidden_1.default, { role: "status", "aria-live": "polite", "aria-atomic": "true", "data-testid": `${testId}-live`, children: announcement })] }));
111
+ };
112
+ exports.default = (0, react_1.memo)(AssistantThread);
@@ -0,0 +1,37 @@
1
+ import type { ReactNode, Ref } from "react";
2
+ import type { AssistantMessageModel } from "../assistantTypes";
3
+ import type { AssistantMessageProps } from "../message/AssistantMessageProps";
4
+ /** Visible and spoken text of `AssistantThread`; omitted keys keep the English default. */
5
+ export interface AssistantThreadLabels {
6
+ /** Name of the scroll region. Default "Conversation". */
7
+ region?: string;
8
+ /** The button shown while scrolled up. Default "Jump to latest". */
9
+ jumpToLatest?: string;
10
+ /** Announced (politely) when a streamed reply finishes. Default "Assistant replied: <first 200 characters>". */
11
+ completed?: (text: string) => string;
12
+ /** Announced when a streamed reply fails. Default "The assistant's reply failed". */
13
+ failed?: string;
14
+ /** Announced when a streamed reply is stopped. Default "Response stopped". */
15
+ stopped?: string;
16
+ }
17
+ /** The scrolling conversation: sticks to the bottom while a reply grows, unless the person scrolled up. */
18
+ export interface AssistantThreadProps {
19
+ /** Messages, oldest first. */
20
+ messages: AssistantMessageModel[];
21
+ /** Replaces the default `AssistantMessage` per message. */
22
+ renderMessage?: (message: AssistantMessageModel, index: number) => ReactNode;
23
+ /** Props for every default `AssistantMessage` (callbacks receive the message, so one set serves all). */
24
+ messageProps?: Omit<AssistantMessageProps, "message">;
25
+ /** Shown instead of the list when there are no messages, e.g. `AssistantWelcome`. */
26
+ emptyState?: ReactNode;
27
+ /** Rendered after the last message, inside the scroll area (e.g. a retry banner). */
28
+ children?: ReactNode;
29
+ /** Distance from the bottom, in px, that still counts as "at the bottom". Default 48. */
30
+ stickThreshold?: number;
31
+ /** Ref to the scrolling element. */
32
+ scrollContainerRef?: Ref<HTMLDivElement>;
33
+ /** Translated region name, button text and announcements. */
34
+ labels?: AssistantThreadLabels;
35
+ /** data-testid on the root. */
36
+ "data-testid"?: string;
37
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ import type { AssistantTypingIndicatorProps } from "./AssistantTypingIndicatorProps";
2
+ declare const _default: import("react").MemoExoticComponent<({ label, showLabel, "data-testid": testId, }: AssistantTypingIndicatorProps) => import("react/jsx-runtime").JSX.Element>;
3
+ export default _default;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const react_1 = require("react");
8
+ const react_2 = require("@chakra-ui/react");
9
+ const react_3 = require("@emotion/react");
10
+ const useCustomTheme_1 = require("../../../Theme/useCustomTheme");
11
+ const motion_1 = require("../../../Theme/tokens/primitives/motion");
12
+ const motion_2 = require("../../../Theme/chakra/motion");
13
+ const VisuallyHidden_1 = __importDefault(require("../../VisuallyHidden/VisuallyHidden"));
14
+ const bounce = (0, react_3.keyframes) `
15
+ 0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
16
+ 30% { transform: translateY(-0.25rem); opacity: 1; }
17
+ `;
18
+ const pulse = (0, react_3.keyframes) `
19
+ 0%, 60%, 100% { opacity: 0.35; }
20
+ 30% { opacity: 1; }
21
+ `;
22
+ const PERIOD = motion_1.MOTION_LOOP_MS.sweep;
23
+ const DOTS = [0, 1, 2];
24
+ /** Three pulsing dots for "the assistant is working", with an optional visible label. */
25
+ const AssistantTypingIndicator = ({ label = "Assistant is typing", showLabel = false, "data-testid": testId = "assistant-typing", }) => {
26
+ const { colors } = (0, useCustomTheme_1.useCustomTheme)();
27
+ return ((0, jsx_runtime_1.jsxs)(react_2.Flex, { role: "status", align: "center", gap: 2, color: colors.textMuted, "data-testid": testId, children: [(0, jsx_runtime_1.jsx)(react_2.Flex, { "aria-hidden": "true", align: "center", gap: 1, h: 5, className: motion_2.MOTION_KEEP_CLASS, children: DOTS.map((dot) => ((0, jsx_runtime_1.jsx)(react_2.Box, { boxSize: 1.5, borderRadius: "full", bg: "currentColor", sx: {
28
+ animation: `${bounce} ${PERIOD}ms ease-in-out infinite`,
29
+ animationDelay: `${(dot * PERIOD) / 8}ms`,
30
+ [motion_2.REDUCED_MOTION_QUERY]: { animationName: `${pulse}` },
31
+ } }, dot))) }), showLabel ? ((0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: "sm", color: colors.textMuted, children: label })) : ((0, jsx_runtime_1.jsx)(VisuallyHidden_1.default, { children: label }))] }));
32
+ };
33
+ exports.default = (0, react_1.memo)(AssistantTypingIndicator);
@@ -0,0 +1,9 @@
1
+ /** Three pulsing dots that say the assistant is working; the bounce becomes an opacity pulse under reduced motion. */
2
+ export interface AssistantTypingIndicatorProps {
3
+ /** Announced once when it mounts (`role="status"`), and shown beside the dots with `showLabel`. Default "Assistant is typing". */
4
+ label?: string;
5
+ /** Shows `label` as visible text after the dots. Default false: the dots alone, the label for screen readers only. */
6
+ showLabel?: boolean;
7
+ /** data-testid on the root. */
8
+ "data-testid"?: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ import type { AssistantWelcomeProps } from "./AssistantWelcomeProps";
2
+ declare const _default: import("react").MemoExoticComponent<({ title, description, icon: Icon, titleAs, capabilities, onSelectCapability, suggestions, onSuggestion, capabilitiesLabel, suggestionsLabel, "data-testid": testId, }: AssistantWelcomeProps) => import("react/jsx-runtime").JSX.Element>;
3
+ export default _default;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const react_1 = require("react");
8
+ const react_2 = require("@chakra-ui/react");
9
+ const lucide_react_1 = require("lucide-react");
10
+ const useCustomTheme_1 = require("../../../Theme/useCustomTheme");
11
+ const focusRing_styles_1 = require("../../../Theme/chakra/focusRing.styles");
12
+ const rowStates_1 = require("../../../Theme/tokens/builders/rowStates");
13
+ const borderWidths_1 = require("../../../Theme/tokens/primitives/borderWidths");
14
+ const motion_1 = require("../../../Theme/tokens/primitives/motion");
15
+ const radii_1 = require("../../../Theme/tokens/primitives/radii");
16
+ const AssistantSuggestions_1 = __importDefault(require("../suggestions/AssistantSuggestions"));
17
+ const assistantStyles_1 = require("../assistantStyles");
18
+ const TILE_TRANSITION = (0, motion_1.transitionFor)(["background-color", "border-color"]);
19
+ /** Greeting, capability tiles and starter prompts for an empty conversation. */
20
+ const AssistantWelcome = ({ title = "How can I help?", description, icon: Icon = lucide_react_1.Sparkles, titleAs = "h2", capabilities, onSelectCapability, suggestions, onSuggestion, capabilitiesLabel = "What I can do", suggestionsLabel = "Try asking", "data-testid": testId = "assistant-welcome", }) => {
21
+ const { colors } = (0, useCustomTheme_1.useCustomTheme)();
22
+ const tokens = (0, assistantStyles_1.assistantTokens)(colors);
23
+ const rows = (0, rowStates_1.listRowBackgrounds)(colors);
24
+ const tiles = onSelectCapability ? (capabilities !== null && capabilities !== void 0 ? capabilities : []) : [];
25
+ return ((0, jsx_runtime_1.jsxs)(react_2.Flex, { direction: "column", gap: 5, px: 1, py: 4, "data-testid": testId, children: [(0, jsx_runtime_1.jsxs)(react_2.Flex, { direction: "column", align: "flex-start", gap: 2, children: [(0, jsx_runtime_1.jsx)(react_2.Flex, { "aria-hidden": "true", boxSize: 10, align: "center", justify: "center", borderRadius: radii_1.RADIUS_ROLE.card, bg: colors.primary.opacity[8], color: colors.accentText, children: (0, jsx_runtime_1.jsx)(Icon, { size: 20 }) }), (0, jsx_runtime_1.jsx)(react_2.Text, { as: titleAs, fontSize: "lg", fontWeight: 600, color: tokens.heading, children: title }), description ? ((0, jsx_runtime_1.jsx)(react_2.Box, { fontSize: "sm", color: tokens.muted, children: description })) : null] }), tiles.length ? ((0, jsx_runtime_1.jsx)(react_2.SimpleGrid, { as: "ul", "aria-label": capabilitiesLabel, columns: { base: 1, sm: 2 }, spacing: 2, listStyleType: "none", m: 0, p: 0, children: tiles.map((capability) => {
26
+ const TileIcon = capability.icon;
27
+ return ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsxs)(react_2.Flex, { as: "button", type: "button", w: "100%", h: "100%", align: "flex-start", gap: 2.5, p: 3, textAlign: "start", borderWidth: borderWidths_1.BORDER_WIDTHS.hairline, borderColor: tokens.rule, borderRadius: radii_1.RADIUS_ROLE.card, transition: TILE_TRANSITION, _hover: { bg: rows.active }, sx: (0, focusRing_styles_1.focusVisibleStyles)(colors), onClick: () => onSelectCapability === null || onSelectCapability === void 0 ? void 0 : onSelectCapability(capability), "data-testid": `${testId}-capability`, children: [TileIcon ? (0, jsx_runtime_1.jsx)(react_2.Box, { as: TileIcon, "aria-hidden": "true", boxSize: 4, mt: 0.5, flexShrink: 0, color: colors.accentText }) : null, (0, jsx_runtime_1.jsxs)(react_2.Box, { minW: 0, children: [(0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: "sm", fontWeight: 600, color: tokens.heading, children: capability.title }), capability.description ? ((0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: "xs", color: tokens.muted, mt: 0.5, children: capability.description })) : null] })] }) }, capability.id));
28
+ }) })) : null, (suggestions === null || suggestions === void 0 ? void 0 : suggestions.length) && onSuggestion ? ((0, jsx_runtime_1.jsxs)(react_2.Box, { children: [(0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: "xs", fontWeight: 600, color: tokens.muted, mb: 2, "aria-hidden": "true", children: suggestionsLabel }), (0, jsx_runtime_1.jsx)(AssistantSuggestions_1.default, { suggestions: suggestions, onSelect: onSuggestion, label: suggestionsLabel })] })) : null] }));
29
+ };
30
+ exports.default = (0, react_1.memo)(AssistantWelcome);
@@ -0,0 +1,40 @@
1
+ import type { ReactNode } from "react";
2
+ import type { AssistantIcon } from "../assistantTypes";
3
+ /** One "what I can do" tile on the welcome screen. */
4
+ export interface AssistantCapability {
5
+ /** Stable key. */
6
+ id: string;
7
+ /** Tile title, e.g. "Summarise a ticket". */
8
+ title: string;
9
+ /** One muted line under the title. */
10
+ description?: string;
11
+ /** Decorative icon in the tile. */
12
+ icon?: AssistantIcon;
13
+ /** Prompt the tile stands for; the app usually sends or prefills it from `onSelectCapability`. */
14
+ prompt: string;
15
+ }
16
+ /** The empty-conversation screen: greeting, capability tiles and starter prompts. */
17
+ export interface AssistantWelcomeProps {
18
+ /** Greeting heading. Default "How can I help?". */
19
+ title?: string;
20
+ /** Muted line under the title, e.g. what the assistant can see. */
21
+ description?: ReactNode;
22
+ /** Decorative icon above the title. Default Sparkles. */
23
+ icon?: AssistantIcon;
24
+ /** Heading level of the title, so it fits the page outline. Default "h2". */
25
+ titleAs?: "h2" | "h3" | "h4";
26
+ /** Tiles in a one- or two-column grid. */
27
+ capabilities?: AssistantCapability[];
28
+ /** Called with the whole tile; tiles render only when this is set. */
29
+ onSelectCapability?: (capability: AssistantCapability) => void;
30
+ /** Starter prompts shown as chips under the tiles. */
31
+ suggestions?: string[];
32
+ /** Called with a starter prompt's text; chips render only when this is set. */
33
+ onSuggestion?: (text: string) => void;
34
+ /** Name of the tile group. Default "What I can do". */
35
+ capabilitiesLabel?: string;
36
+ /** Name of the chip group. Default "Try asking". */
37
+ suggestionsLabel?: string;
38
+ /** data-testid on the root. */
39
+ "data-testid"?: string;
40
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -264,7 +264,11 @@ const TableBody = ({ data, isCheckbox, columns, startRow, rowsPerPage, columnWid
264
264
  setScrollTop(el.scrollTop);
265
265
  });
266
266
  };
267
- const measure = () => setViewportH(el.clientHeight);
267
+ // NOTE: the sticky header covers the top of the scroller, so rows only get what is left.
268
+ const measure = () => {
269
+ const head = el.querySelector("thead");
270
+ setViewportH(el.clientHeight - (head ? head.offsetHeight : 0));
271
+ };
268
272
  measure();
269
273
  setScrollTop(el.scrollTop);
270
274
  el.addEventListener("scroll", onScroll, { passive: true });
@@ -0,0 +1,29 @@
1
+ /** Plain text of a message: its text parts joined by a blank line. */
2
+ export const messageText = (message) => message.parts
3
+ .flatMap((part) => (part.type === "text" ? [part.text] : []))
4
+ .join("\n\n");
5
+ const keyOf = (part, index) => "id" in part ? `${part.type}-${part.id}` : `${part.type}-${index}`;
6
+ export const groupParts = (parts) => {
7
+ const groups = [];
8
+ parts.forEach((part, index) => {
9
+ const last = groups[groups.length - 1];
10
+ if (part.type === "tool") {
11
+ if ((last === null || last === void 0 ? void 0 : last.kind) === "tools")
12
+ last.parts.push(part);
13
+ else
14
+ groups.push({ kind: "tools", key: `tools-${keyOf(part, index)}`, parts: [part] });
15
+ return;
16
+ }
17
+ groups.push({ kind: "part", key: keyOf(part, index), part, index });
18
+ });
19
+ return groups;
20
+ };
21
+ /** Cuts `text` at a word boundary near `max` characters and adds an ellipsis. */
22
+ export const truncate = (text, max) => {
23
+ const flat = text.replace(/\s+/g, " ").trim();
24
+ if (flat.length <= max)
25
+ return flat;
26
+ const cut = flat.slice(0, max);
27
+ const space = cut.lastIndexOf(" ");
28
+ return `${(space > max * 0.6 ? cut.slice(0, space) : cut).trimEnd()}…`;
29
+ };
@@ -0,0 +1,47 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Box } from "@chakra-ui/react";
3
+ import { keyframes } from "@emotion/react";
4
+ import { accentTextOnPlanes } from "../../Theme/tokens/builders/accentText.js";
5
+ import { bandOn, ruleOn } from "../../Theme/tokens/builders/planeStep.js";
6
+ import { raisedRule } from "../../Theme/tokens/builders/surfaceRaised.js";
7
+ import { toneInk, toneScale, resolveSoftTone } from "../../Theme/tokens/builders/tone.js";
8
+ import { MOTION_LOOP_MS } from "../../Theme/tokens/primitives/motion.js";
9
+ import { REDUCED_MOTION_QUERY } from "../../Theme/chakra/motion.js";
10
+ /**
11
+ * The colour roles every Assistant component reads. The family lives on an overlay plane (the panel is
12
+ * `surfaceRaised`), so rules, insets and link ink are resolved against it as well as the page planes —
13
+ * the same component can then sit in the panel or straight on a page.
14
+ */
15
+ export const assistantTokens = (colors) => {
16
+ const surface = colors.surfaceRaised;
17
+ return {
18
+ surface,
19
+ rule: raisedRule(colors),
20
+ /** A rule that also reads on the page canvas and on a card. */
21
+ pageRule: ruleOn(colors, colors.background[50]),
22
+ inset: bandOn(colors.backgroundColor.secondary, surface),
23
+ link: accentTextOnPlanes(colors.primary, [
24
+ colors.backgroundColor.main,
25
+ colors.backgroundColor.base,
26
+ colors.background[50],
27
+ surface,
28
+ ]),
29
+ body: colors.text[800],
30
+ heading: colors.header[900],
31
+ muted: colors.textMuted,
32
+ };
33
+ };
34
+ /** Soft tinted fill + ink for a status tone on the assistant's overlay plane. */
35
+ export const assistantTone = (colors, tone) => {
36
+ const soft = resolveSoftTone(colors, toneScale(colors, tone), colors.surfaceRaised);
37
+ return { bg: soft.bg, border: soft.border, ink: soft.fg, text: toneInk(colors, tone) };
38
+ };
39
+ const blink = keyframes `
40
+ 0%, 45% { opacity: 1; }
41
+ 55%, 100% { opacity: 0; }
42
+ `;
43
+ /** The blinking block caret at the end of a streaming answer; static under reduced motion. */
44
+ export const StreamingCaret = () => (_jsx(Box, { as: "span", "aria-hidden": "true", "data-testid": "assistant-caret", display: "inline-block", w: "0.5em", h: "1em", ml: "0.125em", verticalAlign: "text-bottom", bg: "currentColor", sx: {
45
+ animation: `${blink} ${MOTION_LOOP_MS.sweep}ms steps(1, end) infinite`,
46
+ [REDUCED_MOTION_QUERY]: { animation: "none" },
47
+ } }));
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { memo } from "react";
3
+ import { Box, Flex, Text } from "@chakra-ui/react";
4
+ import { AlertCircle, AlertTriangle, Info, X } from "lucide-react";
5
+ import { useCustomTheme } from "../../../Theme/useCustomTheme.js";
6
+ import { BORDER_WIDTHS } from "../../../Theme/tokens/primitives/borderWidths.js";
7
+ import { RADIUS_ROLE } from "../../../Theme/tokens/primitives/radii.js";
8
+ import Button from "../../Button/Button.js";
9
+ import IconButton from "../../IconButton/IconButton.js";
10
+ import { assistantTone } from "../assistantStyles.js";
11
+ const ICON = { info: Info, warning: AlertTriangle, error: AlertCircle };
12
+ /** Tinted info/warning/error strip with an optional action and dismiss, sized for the assistant panel. */
13
+ const AssistantStatusBanner = ({ tone = "info", title, message, children, action, onDismiss, dismissLabel = "Dismiss", "data-testid": testId = "assistant-status-banner", }) => {
14
+ const { colors } = useCustomTheme();
15
+ const look = assistantTone(colors, tone);
16
+ const Icon = ICON[tone];
17
+ const body = children !== null && children !== void 0 ? children : message;
18
+ return (_jsxs(Flex, { role: tone === "error" ? "alert" : "status", align: "flex-start", gap: 2.5, px: 3, py: 2, bg: look.bg, borderWidth: BORDER_WIDTHS.hairline, borderColor: look.border, borderRadius: RADIUS_ROLE.control, "data-testid": testId, "data-tone": tone, children: [_jsx(Box, { as: Icon, "aria-hidden": "true", boxSize: 4, mt: 0.5, flexShrink: 0, color: look.ink }), _jsxs(Box, { flex: "1", minW: 0, fontSize: "sm", lineHeight: 1.5, children: [title ? (_jsx(Text, { fontWeight: 600, color: look.ink, children: title })) : null, body ? _jsx(Box, { color: colors.text[800], children: body }) : null] }), action ? (_jsx(Button, { size: "xs", variant: "outline", colorScheme: "gray", label: action.label, onClick: action.onClick, flexShrink: 0 })) : null, onDismiss ? (_jsx(IconButton, { "aria-label": dismissLabel, size: "xs", variant: "ghost", colorScheme: "gray", icon: _jsx(X, { size: 14 }), onClick: onDismiss, flexShrink: 0 })) : null] }));
19
+ };
20
+ export default memo(AssistantStatusBanner);
@@ -0,0 +1,46 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { memo } from "react";
3
+ import { Box, Flex, Text } from "@chakra-ui/react";
4
+ import { ArrowRight, ShieldCheck } from "lucide-react";
5
+ import { useCustomTheme } from "../../../Theme/useCustomTheme.js";
6
+ import Button from "../../Button/Button.js";
7
+ import Tag from "../../Tag/Tag.js";
8
+ import VisuallyHidden from "../../VisuallyHidden/VisuallyHidden.js";
9
+ import { assistantTokens } from "../assistantStyles.js";
10
+ import { CardActions, CardError, CardShell } from "./CardShell.js";
11
+ const DEFAULT_LABELS = {
12
+ approve: "Approve",
13
+ deny: "Deny",
14
+ undo: "Undo",
15
+ retry: "Try again",
16
+ changes: "Changes",
17
+ changesTo: "changes to",
18
+ empty: "Not set",
19
+ };
20
+ const DEFAULT_RISK = { low: "Low risk", medium: "Medium risk", high: "High risk" };
21
+ const DEFAULT_STATUS = { approving: "Approving", approved: "Approved", denied: "Denied", expired: "Expired", failed: "Failed" };
22
+ const RISK_TONE = { low: "neutral", medium: "warning", high: "error" };
23
+ const STATUS_TONE = {
24
+ approving: "info",
25
+ approved: "success",
26
+ denied: "neutral",
27
+ expired: "neutral",
28
+ failed: "error",
29
+ };
30
+ /** A compact approve/deny card: what changes (before → after), how risky, and Undo once approved. */
31
+ const AssistantApprovalCard = ({ title, summary, changes, risk, status = "pending", error, undoable = false, onApprove, onDeny, onUndo, icon = ShieldCheck, labels, "data-testid": testId = "assistant-approval", }) => {
32
+ const { colors } = useCustomTheme();
33
+ const tokens = assistantTokens(colors);
34
+ const text = { ...DEFAULT_LABELS, ...labels };
35
+ const riskText = { ...DEFAULT_RISK, ...labels === null || labels === void 0 ? void 0 : labels.risk };
36
+ const statusText = { ...DEFAULT_STATUS, ...labels === null || labels === void 0 ? void 0 : labels.status };
37
+ const busy = status === "approving";
38
+ const open = status === "pending" || busy || status === "failed";
39
+ const closed = status === "denied" || status === "expired";
40
+ const badge = status === "pending" ? undefined : { label: statusText[status], tone: STATUS_TONE[status] };
41
+ return (_jsxs(CardShell, { title: title, icon: icon, badge: badge, edgeTone: status === "approved" ? "success" : status === "failed" ? "error" : undefined, quiet: closed, isBusy: busy, status: status, testId: testId, children: [summary || risk ? (_jsxs(Flex, { align: "flex-start", gap: 2, wrap: "wrap", children: [summary ? (_jsx(Box, { flex: "1", minW: "10rem", fontSize: "sm", color: closed ? tokens.muted : tokens.body, children: summary })) : null, risk && open ? (_jsx(Tag, { label: riskText[risk], tone: RISK_TONE[risk], size: "xs", variant: "outline", "data-testid": `${testId}-risk` })) : null] })) : null, (changes === null || changes === void 0 ? void 0 : changes.length) ? (_jsx(Box, { as: "ul", "aria-label": text.changes, listStyleType: "none", m: 0, p: 0, fontSize: "sm", children: changes.map((change, i) => {
42
+ var _a;
43
+ return (_jsxs(Flex, { as: "li", align: "baseline", gap: 1.5, wrap: "wrap", py: 0.5, children: [_jsx(Text, { as: "span", color: tokens.muted, children: `${change.label}: ` }), _jsx(Text, { as: "span", color: tokens.muted, textDecoration: change.before ? "line-through" : undefined, children: (_a = change.before) !== null && _a !== void 0 ? _a : text.empty }), _jsx(Box, { as: ArrowRight, "aria-hidden": "true", boxSize: 3, color: tokens.muted, alignSelf: "center" }), _jsxs(VisuallyHidden, { children: [" ", text.changesTo, " "] }), _jsx(Text, { as: "span", fontWeight: 500, color: closed ? tokens.muted : tokens.heading, children: change.after })] }, `${change.label}-${i}`));
44
+ }) })) : null, status === "failed" && error ? _jsx(CardError, { message: error }) : null, open && (onApprove || onDeny) ? (_jsxs(CardActions, { children: [onDeny ? (_jsx(Button, { size: "sm", variant: "outline", colorScheme: "gray", label: text.deny, onClick: onDeny, isDisabled: busy })) : null, onApprove ? (_jsx(Button, { size: "sm", variant: "solid", colorScheme: risk === "high" ? "red" : "primary", label: status === "failed" ? text.retry : text.approve, onClick: onApprove, isLoading: busy })) : null] })) : null, status === "approved" && undoable && onUndo ? (_jsx(CardActions, { children: _jsx(Button, { size: "sm", variant: "outline", colorScheme: "gray", label: text.undo, onClick: onUndo }) })) : null] }));
45
+ };
46
+ export default memo(AssistantApprovalCard);
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { memo } from "react";
3
+ import { Box } from "@chakra-ui/react";
4
+ import { Sparkles } from "lucide-react";
5
+ import { useCustomTheme } from "../../../Theme/useCustomTheme.js";
6
+ import Button from "../../Button/Button.js";
7
+ import DescriptionList from "../../DescriptionList/DescriptionList.js";
8
+ import { CardActions, CardError, CardShell } from "./CardShell.js";
9
+ const DEFAULT_STATUS = { applying: "Applying", applied: "Applied", dismissed: "Dismissed", failed: "Failed" };
10
+ const DEFAULT_LABELS = { edit: "Edit", dismiss: "Dismiss", retry: "Try again" };
11
+ const BADGE_TONE = {
12
+ applying: "info",
13
+ applied: "success",
14
+ dismissed: "neutral",
15
+ failed: "error",
16
+ };
17
+ /**
18
+ * A proposal to apply, edit or dismiss (the web twin of mobile's `ProposalCard`). Applied, dismissed and
19
+ * failed each look different — a green edge and badge, a dimmed title, an error edge and message — and
20
+ * the buttons go away once the proposal is settled.
21
+ */
22
+ const AssistantProposalCard = ({ title, summary, fields, status = "pending", error, primaryLabel = "Apply", onPrimary, onEdit, onDismiss, children, icon = Sparkles, labels, "data-testid": testId = "assistant-proposal", }) => {
23
+ const { colors } = useCustomTheme();
24
+ const text = { ...DEFAULT_LABELS, ...labels };
25
+ const statusText = { ...DEFAULT_STATUS, ...labels === null || labels === void 0 ? void 0 : labels.status };
26
+ const busy = status === "applying";
27
+ const open = status === "pending" || busy || status === "failed";
28
+ const badge = status === "pending" ? undefined : { label: statusText[status], tone: BADGE_TONE[status] };
29
+ return (_jsxs(CardShell, { title: title, icon: icon, badge: badge, edgeTone: status === "applied" ? "success" : status === "failed" ? "error" : undefined, quiet: status === "dismissed", isBusy: busy, status: status, testId: testId, children: [summary ? (_jsx(Box, { fontSize: "sm", color: status === "dismissed" ? colors.textMuted : colors.text[800], children: summary })) : null, (fields === null || fields === void 0 ? void 0 : fields.length) && status !== "dismissed" ? (_jsx(DescriptionList, { items: fields, layout: "inline", columns: { base: 1 } })) : null, open ? children : null, status === "failed" && error ? _jsx(CardError, { message: error }) : null, open && (onPrimary || onEdit || onDismiss) ? (_jsxs(CardActions, { children: [onDismiss ? (_jsx(Button, { size: "sm", variant: "ghost", colorScheme: "gray", label: text.dismiss, onClick: onDismiss, isDisabled: busy })) : null, onEdit ? (_jsx(Button, { size: "sm", variant: "outline", colorScheme: "gray", label: text.edit, onClick: onEdit, isDisabled: busy })) : null, onPrimary ? (_jsx(Button, { size: "sm", variant: "solid", colorScheme: "primary", label: status === "failed" ? text.retry : primaryLabel, onClick: onPrimary, isLoading: busy })) : null] })) : null] }));
30
+ };
31
+ export default memo(AssistantProposalCard);
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useId } from "react";
3
+ import { Box, Flex, Text } from "@chakra-ui/react";
4
+ import { useCustomTheme } from "../../../Theme/useCustomTheme.js";
5
+ import { BORDER_WIDTHS } from "../../../Theme/tokens/primitives/borderWidths.js";
6
+ import { RADIUS_ROLE } from "../../../Theme/tokens/primitives/radii.js";
7
+ import Tag from "../../Tag/Tag.js";
8
+ import { assistantTokens, assistantTone } from "../assistantStyles.js";
9
+ /** The bordered card both action cards share; a rule, not a lifted card, so it never nests a card in the panel. */
10
+ export const CardShell = ({ title, icon: Icon, badge, edgeTone, quiet, isBusy, testId, status, children }) => {
11
+ const { colors } = useCustomTheme();
12
+ const tokens = assistantTokens(colors);
13
+ const titleId = useId();
14
+ const edge = edgeTone ? assistantTone(colors, edgeTone).border : tokens.rule;
15
+ return (_jsxs(Box, { as: "section", "aria-labelledby": titleId, "aria-busy": isBusy || undefined, borderWidth: BORDER_WIDTHS.hairline, borderColor: edge, borderRadius: RADIUS_ROLE.card, p: 3, "data-testid": testId, "data-status": status, children: [_jsxs(Flex, { align: "flex-start", gap: 2.5, children: [_jsx(Flex, { "aria-hidden": "true", boxSize: 7, flexShrink: 0, align: "center", justify: "center", borderRadius: RADIUS_ROLE.control, bg: colors.primary.opacity[8], color: quiet ? tokens.muted : colors.accentText, children: _jsx(Icon, { size: 16 }) }), _jsx(Text, { id: titleId, as: "h4", flex: "1", minW: 0, pt: 1, fontSize: "sm", fontWeight: 600, lineHeight: 1.43, color: quiet ? tokens.muted : tokens.heading, noOfLines: 2, children: title }), badge ? _jsx(Tag, { label: badge.label, tone: badge.tone, size: "xs", "data-testid": `${testId}-status` }) : null] }), _jsx(Flex, { direction: "column", gap: 2.5, mt: 2.5, children: children })] }));
16
+ };
17
+ /** The end-aligned action row under a card. */
18
+ export const CardActions = ({ children }) => (_jsx(Flex, { justify: "flex-end", wrap: "wrap", gap: 2, children: children }));
19
+ /** Error line shown on a failed card. */
20
+ export const CardError = ({ message }) => {
21
+ const { colors } = useCustomTheme();
22
+ return (_jsx(Text, { role: "alert", fontSize: "sm", color: colors.semanticText.error, children: message }));
23
+ };