pixelize-design-library 3.1.1 → 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 (140) hide show
  1. package/CHANGELOG.md +18 -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/esm/Components/Assistant/assistantModel.js +29 -0
  94. package/dist/esm/Components/Assistant/assistantStyles.js +47 -0
  95. package/dist/esm/Components/Assistant/assistantTypes.js +1 -0
  96. package/dist/esm/Components/Assistant/banner/AssistantStatusBanner.js +20 -0
  97. package/dist/esm/Components/Assistant/banner/AssistantStatusBannerProps.js +1 -0
  98. package/dist/esm/Components/Assistant/cards/AssistantApprovalCard.js +46 -0
  99. package/dist/esm/Components/Assistant/cards/AssistantApprovalCardProps.js +1 -0
  100. package/dist/esm/Components/Assistant/cards/AssistantProposalCard.js +31 -0
  101. package/dist/esm/Components/Assistant/cards/AssistantProposalCardProps.js +1 -0
  102. package/dist/esm/Components/Assistant/cards/CardShell.js +23 -0
  103. package/dist/esm/Components/Assistant/composer/AssistantComposer.js +259 -0
  104. package/dist/esm/Components/Assistant/composer/AssistantComposerProps.js +1 -0
  105. package/dist/esm/Components/Assistant/composer/ComposerMenu.js +30 -0
  106. package/dist/esm/Components/Assistant/composer/composerLogic.js +56 -0
  107. package/dist/esm/Components/Assistant/context/AssistantContextBar.js +22 -0
  108. package/dist/esm/Components/Assistant/context/AssistantContextBarProps.js +1 -0
  109. package/dist/esm/Components/Assistant/history/AssistantHistoryList.js +118 -0
  110. package/dist/esm/Components/Assistant/history/AssistantHistoryListProps.js +1 -0
  111. package/dist/esm/Components/Assistant/history/groupConversations.js +51 -0
  112. package/dist/esm/Components/Assistant/index.js +16 -0
  113. package/dist/esm/Components/Assistant/launcher/AssistantLauncher.js +40 -0
  114. package/dist/esm/Components/Assistant/launcher/AssistantLauncherProps.js +1 -0
  115. package/dist/esm/Components/Assistant/markdown/AssistantMarkdown.js +141 -0
  116. package/dist/esm/Components/Assistant/markdown/AssistantMarkdownProps.js +1 -0
  117. package/dist/esm/Components/Assistant/markdown/parseMarkdown.js +322 -0
  118. package/dist/esm/Components/Assistant/markdown/safeHref.js +23 -0
  119. package/dist/esm/Components/Assistant/message/AssistantMessage.js +126 -0
  120. package/dist/esm/Components/Assistant/message/AssistantMessageProps.js +1 -0
  121. package/dist/esm/Components/Assistant/message/MessageActions.js +16 -0
  122. package/dist/esm/Components/Assistant/panel/AssistantPanel.js +82 -0
  123. package/dist/esm/Components/Assistant/panel/AssistantPanelProps.js +1 -0
  124. package/dist/esm/Components/Assistant/panel/ResizeHandle.js +68 -0
  125. package/dist/esm/Components/Assistant/sources/AssistantSources.js +58 -0
  126. package/dist/esm/Components/Assistant/sources/AssistantSourcesProps.js +1 -0
  127. package/dist/esm/Components/Assistant/steps/AssistantToolSteps.js +36 -0
  128. package/dist/esm/Components/Assistant/steps/AssistantToolStepsProps.js +1 -0
  129. package/dist/esm/Components/Assistant/suggestions/AssistantSuggestions.js +13 -0
  130. package/dist/esm/Components/Assistant/suggestions/AssistantSuggestionsProps.js +1 -0
  131. package/dist/esm/Components/Assistant/thread/AssistantThread.js +107 -0
  132. package/dist/esm/Components/Assistant/thread/AssistantThreadProps.js +1 -0
  133. package/dist/esm/Components/Assistant/typing/AssistantTypingIndicator.js +28 -0
  134. package/dist/esm/Components/Assistant/typing/AssistantTypingIndicatorProps.js +1 -0
  135. package/dist/esm/Components/Assistant/welcome/AssistantWelcome.js +25 -0
  136. package/dist/esm/Components/Assistant/welcome/AssistantWelcomeProps.js +1 -0
  137. package/dist/esm/index.js +2 -0
  138. package/dist/index.d.ts +18 -0
  139. package/dist/index.js +20 -1
  140. package/package.json +1 -1
@@ -0,0 +1,3 @@
1
+ import type { AssistantPanelProps } from "./AssistantPanelProps";
2
+ declare const _default: import("react").MemoExoticComponent<({ title, subtitle, icon: Icon, status, actions, banner, children, footer, size, onSizeChange, width, minWidth, maxWidth, onResize, onClose, onMinimize, positioning, id, labels, "data-testid": testId, }: AssistantPanelProps) => import("react/jsx-runtime").JSX.Element>;
3
+ export default _default;
@@ -0,0 +1,87 @@
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 borderWidths_1 = require("../../../Theme/tokens/primitives/borderWidths");
12
+ const radii_1 = require("../../../Theme/tokens/primitives/radii");
13
+ const zIndices_1 = __importDefault(require("../../../Theme/tokens/primitives/zIndices"));
14
+ const IconButton_1 = __importDefault(require("../../IconButton/IconButton"));
15
+ const ToolTip_1 = __importDefault(require("../../ToolTip/ToolTip"));
16
+ const assistantStyles_1 = require("../assistantStyles");
17
+ const ResizeHandle_1 = require("./ResizeHandle");
18
+ const DEFAULT_STATUS = { online: "Online", busy: "Working", degraded: "Degraded service", offline: "Offline" };
19
+ const DEFAULT_LABELS = {
20
+ close: "Close assistant",
21
+ minimize: "Minimize",
22
+ resize: "Resize assistant panel",
23
+ dock: "Dock to the side",
24
+ float: "Pop out",
25
+ fullscreen: "Full screen",
26
+ exitFullscreen: "Exit full screen",
27
+ };
28
+ const HeaderButton = ({ action }) => {
29
+ const Icon = action.icon;
30
+ return ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { label: action.label, children: (0, jsx_runtime_1.jsx)(IconButton_1.default, { "aria-label": action.label, "aria-pressed": action.isActive, icon: (0, jsx_runtime_1.jsx)(Icon, { size: 16 }), size: "sm", variant: "ghost", colorScheme: "gray", isActive: action.isActive, onClick: action.onClick, "data-testid": action.testId }) }));
31
+ };
32
+ /**
33
+ * The assistant's window: a header (title, status, actions, size and window controls), an optional banner,
34
+ * the body and a footer. "docked" is a full-height sheet on the right with a keyboard-operable resize
35
+ * handle; "floating" a bottom-right card; "fullscreen" covers the viewport. All three paint `surfaceRaised`.
36
+ * The panel is not modal: it never traps focus or closes on Esc.
37
+ */
38
+ const AssistantPanel = ({ title = "Assistant", subtitle, icon: Icon = lucide_react_1.Sparkles, status, actions = [], banner, children, footer, size = "docked", onSizeChange, width = 420, minWidth = 320, maxWidth = 720, onResize, onClose, onMinimize, positioning = "fixed", id, labels, "data-testid": testId = "assistant-panel", }) => {
39
+ const { colors } = (0, useCustomTheme_1.useCustomTheme)();
40
+ const tokens = (0, assistantStyles_1.assistantTokens)(colors);
41
+ const text = { ...DEFAULT_LABELS, ...labels };
42
+ const statusText = { ...DEFAULT_STATUS, ...labels === null || labels === void 0 ? void 0 : labels.status };
43
+ const titleId = (0, react_1.useId)();
44
+ const [liveWidth, setLiveWidth] = (0, react_1.useState)(width);
45
+ (0, react_1.useEffect)(() => setLiveWidth(width), [width]);
46
+ const panelWidth = Math.min(maxWidth, Math.max(minWidth, liveWidth));
47
+ const statusInk = {
48
+ online: colors.semanticText.success,
49
+ busy: colors.semanticText.info,
50
+ degraded: colors.semanticText.warning,
51
+ offline: colors.textMuted,
52
+ };
53
+ const frame = size === "fullscreen"
54
+ ? { top: 0, right: 0, bottom: 0, left: 0 }
55
+ : size === "floating"
56
+ ? {
57
+ right: { base: 2, sm: 4 },
58
+ bottom: { base: 2, sm: 4 },
59
+ w: { base: "calc(100vw - 1rem)", sm: `${panelWidth}px` },
60
+ h: "min(40rem, calc(100vh - 2rem))",
61
+ borderRadius: radii_1.RADIUS_ROLE.float,
62
+ borderWidth: borderWidths_1.BORDER_WIDTHS.hairline,
63
+ }
64
+ : {
65
+ top: 0,
66
+ right: 0,
67
+ bottom: 0,
68
+ w: { base: "100vw", sm: `${panelWidth}px` },
69
+ borderInlineStartWidth: borderWidths_1.BORDER_WIDTHS.hairline,
70
+ };
71
+ const sizeButtons = !onSizeChange
72
+ ? []
73
+ : size === "fullscreen"
74
+ ? [{ id: "exit", label: text.exitFullscreen, icon: lucide_react_1.Minimize2, onClick: () => onSizeChange("docked"), testId: `${testId}-size-docked` }]
75
+ : [
76
+ size === "docked"
77
+ ? { id: "float", label: text.float, icon: lucide_react_1.PictureInPicture2, onClick: () => onSizeChange("floating"), testId: `${testId}-size-floating` }
78
+ : { id: "dock", label: text.dock, icon: lucide_react_1.PanelRight, onClick: () => onSizeChange("docked"), testId: `${testId}-size-docked` },
79
+ { id: "full", label: text.fullscreen, icon: lucide_react_1.Maximize2, onClick: () => onSizeChange("fullscreen"), testId: `${testId}-size-fullscreen` },
80
+ ];
81
+ const resize = (next) => {
82
+ setLiveWidth(next);
83
+ onResize === null || onResize === void 0 ? void 0 : onResize(next);
84
+ };
85
+ return ((0, jsx_runtime_1.jsxs)(react_2.Box, { as: "aside", id: id, "aria-labelledby": titleId, position: positioning, zIndex: zIndices_1.default.overlay, display: "flex", flexDirection: "column", bg: tokens.surface, borderColor: tokens.rule, boxShadow: size === "fullscreen" ? "none" : "lg", overflow: size === "floating" ? "hidden" : "visible", ...frame, "data-testid": testId, "data-size": size, children: [size === "docked" && onResize ? ((0, jsx_runtime_1.jsx)(ResizeHandle_1.ResizeHandle, { width: panelWidth, min: minWidth, max: maxWidth, label: text.resize, onResize: resize })) : null, (0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "center", gap: 2, px: 3, py: 2, minH: 14, borderBottomWidth: borderWidths_1.BORDER_WIDTHS.hairline, borderColor: tokens.rule, flexShrink: 0, children: [(0, jsx_runtime_1.jsx)(react_2.Flex, { "aria-hidden": "true", boxSize: 8, flexShrink: 0, align: "center", justify: "center", borderRadius: radii_1.RADIUS_ROLE.control, bg: colors.primary.opacity[8], color: colors.accentText, children: (0, jsx_runtime_1.jsx)(Icon, { size: 16 }) }), (0, jsx_runtime_1.jsxs)(react_2.Box, { flex: "1", minW: 0, children: [(0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "center", gap: 1.5, children: [(0, jsx_runtime_1.jsx)(react_2.Text, { id: titleId, as: "h2", fontSize: "sm", fontWeight: 600, color: tokens.heading, noOfLines: 1, children: title }), status ? ((0, jsx_runtime_1.jsx)(react_2.Box, { role: "img", "aria-label": statusText[status], title: statusText[status], boxSize: 2, flexShrink: 0, borderRadius: "full", bg: statusInk[status], "data-testid": `${testId}-status`, "data-status": status })) : null] }), subtitle ? ((0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: "xs", color: tokens.muted, noOfLines: 1, children: subtitle })) : null] }), (0, jsx_runtime_1.jsxs)(react_2.Flex, { align: "center", gap: 0.5, flexShrink: 0, children: [actions.map((action) => ((0, jsx_runtime_1.jsx)(HeaderButton, { action: action }, action.id))), sizeButtons.map((action) => ((0, jsx_runtime_1.jsx)(HeaderButton, { action: action }, action.id))), onMinimize ? ((0, jsx_runtime_1.jsx)(HeaderButton, { action: { id: "minimize", label: text.minimize, icon: lucide_react_1.Minus, onClick: onMinimize, testId: `${testId}-minimize` } })) : null, onClose ? ((0, jsx_runtime_1.jsx)(HeaderButton, { action: { id: "close", label: text.close, icon: lucide_react_1.X, onClick: onClose, testId: `${testId}-close` } })) : null] })] }), banner ? ((0, jsx_runtime_1.jsx)(react_2.Box, { px: 3, pt: 2, flexShrink: 0, children: banner })) : null, (0, jsx_runtime_1.jsx)(react_2.Flex, { direction: "column", flex: "1", minH: 0, position: "relative", children: children }), footer ? ((0, jsx_runtime_1.jsx)(react_2.Box, { px: 3, pt: 2, pb: 3, flexShrink: 0, children: footer })) : null] }));
86
+ };
87
+ exports.default = (0, react_1.memo)(AssistantPanel);
@@ -0,0 +1,86 @@
1
+ import type { ReactNode } from "react";
2
+ import type { AssistantIcon } from "../assistantTypes";
3
+ /** How the panel sits on the page. */
4
+ export type AssistantPanelSize = "docked" | "floating" | "fullscreen";
5
+ /** Connection state shown as a dot beside the title. */
6
+ export type AssistantPanelStatus = "online" | "busy" | "degraded" | "offline";
7
+ /** One icon button in the panel header (history, new chat, settings…). */
8
+ export interface AssistantPanelAction {
9
+ /** Stable key. */
10
+ id: string;
11
+ /** Tooltip and accessible name. */
12
+ label: string;
13
+ /** Glyph. */
14
+ icon: AssistantIcon;
15
+ /** Called on click. */
16
+ onClick: () => void;
17
+ /** When set, the button is a toggle and reports `aria-pressed`. */
18
+ isActive?: boolean;
19
+ }
20
+ /** Visible and spoken text of `AssistantPanel`; omitted keys keep the English default. */
21
+ export interface AssistantPanelLabels {
22
+ /** Default "Close assistant". */
23
+ close?: string;
24
+ /** Default "Minimize". */
25
+ minimize?: string;
26
+ /** Name of the resize handle. Default "Resize assistant panel". */
27
+ resize?: string;
28
+ /** Default "Dock to the side". */
29
+ dock?: string;
30
+ /** Default "Pop out". */
31
+ float?: string;
32
+ /** Default "Full screen". */
33
+ fullscreen?: string;
34
+ /** Default "Exit full screen". */
35
+ exitFullscreen?: string;
36
+ /** Spoken status words. */
37
+ status?: {
38
+ online?: string;
39
+ busy?: string;
40
+ degraded?: string;
41
+ offline?: string;
42
+ };
43
+ }
44
+ /** The assistant's shell: header, optional banner, body and footer, docked, floating or full screen. */
45
+ export interface AssistantPanelProps {
46
+ /** Header title. Default "Assistant". */
47
+ title?: string;
48
+ /** Muted line under the title, e.g. the conversation name. */
49
+ subtitle?: ReactNode;
50
+ /** Decorative glyph before the title. Default Sparkles. */
51
+ icon?: AssistantIcon;
52
+ /** Adds a status dot after the title, named by `labels.status` (Online, Working, Degraded service, Offline). */
53
+ status?: AssistantPanelStatus;
54
+ /** Icon buttons before the window controls. */
55
+ actions?: AssistantPanelAction[];
56
+ /** Strip between the header and the body, e.g. an `AssistantStatusBanner`. */
57
+ banner?: ReactNode;
58
+ /** The body: usually an `AssistantThread` (it scrolls itself) or an `AssistantHistoryList`. */
59
+ children: ReactNode;
60
+ /** Pinned under the body, usually an `AssistantComposer`. */
61
+ footer?: ReactNode;
62
+ /** Default "docked": a full-height sheet on the right with a resize handle. "floating" is a bottom-right card; "fullscreen" covers the viewport. */
63
+ size?: AssistantPanelSize;
64
+ /** Adds the pop-out / dock and full-screen buttons; the parent stores the new size. */
65
+ onSizeChange?: (size: AssistantPanelSize) => void;
66
+ /** Width in px for "docked" and "floating". Default 420. */
67
+ width?: number;
68
+ /** Narrowest docked width, in px. Default 320. */
69
+ minWidth?: number;
70
+ /** Widest docked width, in px. Default 720. */
71
+ maxWidth?: number;
72
+ /** Adds the docked resize handle (drag, or ←/→ with Shift for bigger steps, Home/End); called with the clamped width. */
73
+ onResize?: (width: number) => void;
74
+ /** Adds the close button. Esc never closes the panel. */
75
+ onClose?: () => void;
76
+ /** Adds the minimize button. */
77
+ onMinimize?: () => void;
78
+ /** "fixed" (default) places it against the viewport; "absolute" against the nearest positioned ancestor, for an embedded layout. */
79
+ positioning?: "fixed" | "absolute";
80
+ /** id of the panel element, for a launcher's `aria-controls`. */
81
+ id?: string;
82
+ /** Translated control names and status words. */
83
+ labels?: AssistantPanelLabels;
84
+ /** data-testid on the root. */
85
+ "data-testid"?: string;
86
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,14 @@
1
+ interface ResizeHandleProps {
2
+ width: number;
3
+ min: number;
4
+ max: number;
5
+ label: string;
6
+ onResize: (width: number) => void;
7
+ }
8
+ /**
9
+ * The docked panel's left-edge handle: a focusable `separator` that reports its width. Dragging left widens
10
+ * the panel; ←/→ step 16px (64px with Shift), Home/End jump to the narrowest/widest. Reads `clientX`, which
11
+ * jsdom supports (it has no `pageX`).
12
+ */
13
+ export declare const ResizeHandle: ({ width, min, max, label, onResize }: ResizeHandleProps) => import("react/jsx-runtime").JSX.Element;
14
+ export {};
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ResizeHandle = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const react_2 = require("@chakra-ui/react");
7
+ const useCustomTheme_1 = require("../../../Theme/useCustomTheme");
8
+ const focusRing_styles_1 = require("../../../Theme/chakra/focusRing.styles");
9
+ const motion_1 = require("../../../Theme/tokens/primitives/motion");
10
+ const STEP = 16;
11
+ const BIG_STEP = 64;
12
+ const GRIP_TRANSITION = (0, motion_1.transitionFor)(["background-color"]);
13
+ const clamp = (value, min, max) => Math.round(Math.min(max, Math.max(min, value)));
14
+ /**
15
+ * The docked panel's left-edge handle: a focusable `separator` that reports its width. Dragging left widens
16
+ * the panel; ←/→ step 16px (64px with Shift), Home/End jump to the narrowest/widest. Reads `clientX`, which
17
+ * jsdom supports (it has no `pageX`).
18
+ */
19
+ const ResizeHandle = ({ width, min, max, label, onResize }) => {
20
+ const { colors } = (0, useCustomTheme_1.useCustomTheme)();
21
+ const drag = (0, react_1.useRef)(null);
22
+ const onPointerDown = (event) => {
23
+ var _a, _b;
24
+ if (event.button !== 0)
25
+ return;
26
+ event.preventDefault();
27
+ drag.current = { x: event.clientX, width };
28
+ (_b = (_a = event.currentTarget).setPointerCapture) === null || _b === void 0 ? void 0 : _b.call(_a, event.pointerId);
29
+ };
30
+ const onPointerMove = (event) => {
31
+ if (!drag.current)
32
+ return;
33
+ onResize(clamp(drag.current.width + (drag.current.x - event.clientX), min, max));
34
+ };
35
+ const endDrag = (event) => {
36
+ var _a, _b;
37
+ drag.current = null;
38
+ (_b = (_a = event.currentTarget).releasePointerCapture) === null || _b === void 0 ? void 0 : _b.call(_a, event.pointerId);
39
+ };
40
+ const onKeyDown = (event) => {
41
+ const step = event.shiftKey ? BIG_STEP : STEP;
42
+ const next = event.key === "ArrowLeft"
43
+ ? width + step
44
+ : event.key === "ArrowRight"
45
+ ? width - step
46
+ : event.key === "Home"
47
+ ? min
48
+ : event.key === "End"
49
+ ? max
50
+ : null;
51
+ if (next === null)
52
+ return;
53
+ event.preventDefault();
54
+ onResize(clamp(next, min, max));
55
+ };
56
+ return ((0, jsx_runtime_1.jsx)(react_2.Box, { role: "separator", "aria-orientation": "vertical", "aria-label": label, "aria-valuenow": width, "aria-valuemin": min, "aria-valuemax": max, tabIndex: 0, position: "absolute", top: 0, bottom: 0, left: "-0.25rem", w: 2, cursor: "col-resize", zIndex: 1, display: { base: "none", sm: "block" }, sx: {
57
+ touchAction: "none",
58
+ ...(0, focusRing_styles_1.focusVisibleStyles)(colors),
59
+ "&::after": {
60
+ content: '""',
61
+ position: "absolute",
62
+ top: 0,
63
+ bottom: 0,
64
+ left: "0.1875rem",
65
+ w: "2px",
66
+ bg: "transparent",
67
+ transition: GRIP_TRANSITION,
68
+ },
69
+ "&:hover::after, &:focus-visible::after, &:active::after": { bg: colors.primary[500] },
70
+ }, onPointerDown: onPointerDown, onPointerMove: onPointerMove, onPointerUp: endDrag, onPointerCancel: endDrag, onKeyDown: onKeyDown, "data-testid": "assistant-panel-resize" }));
71
+ };
72
+ exports.ResizeHandle = ResizeHandle;
@@ -0,0 +1,3 @@
1
+ import type { AssistantSourcesProps } from "./AssistantSourcesProps";
2
+ declare const _default: import("react").MemoExoticComponent<({ sources, onSelect, max, labels, "data-testid": testId, }: AssistantSourcesProps) => import("react/jsx-runtime").JSX.Element | null>;
3
+ export default _default;
@@ -0,0 +1,63 @@
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 motion_1 = require("../../../Theme/tokens/primitives/motion");
14
+ const radii_1 = require("../../../Theme/tokens/primitives/radii");
15
+ const typography_1 = require("../../../Theme/tokens/primitives/typography");
16
+ const Button_1 = __importDefault(require("../../Button/Button"));
17
+ const VisuallyHidden_1 = __importDefault(require("../../VisuallyHidden/VisuallyHidden"));
18
+ const assistantStyles_1 = require("../assistantStyles");
19
+ const safeHref_1 = require("../markdown/safeHref");
20
+ const DEFAULT_LABELS = {
21
+ title: "Sources",
22
+ showMore: (hidden) => `Show ${hidden} more`,
23
+ showFewer: "Show fewer",
24
+ newTab: "opens in a new tab",
25
+ };
26
+ const ROW_TRANSITION = (0, motion_1.transitionFor)(["background-color"]);
27
+ /** Numbered citation list; safe hrefs become anchors, the rest buttons that call `onSelect`. */
28
+ const AssistantSources = ({ sources, onSelect, max = 4, labels, "data-testid": testId = "assistant-sources", }) => {
29
+ const { colors } = (0, useCustomTheme_1.useCustomTheme)();
30
+ const text = { ...DEFAULT_LABELS, ...labels };
31
+ const headingId = (0, react_1.useId)();
32
+ const [expanded, setExpanded] = (0, react_1.useState)(false);
33
+ if (sources.length === 0)
34
+ return null;
35
+ const tokens = (0, assistantStyles_1.assistantTokens)(colors);
36
+ const rows = (0, rowStates_1.listRowBackgrounds)(colors);
37
+ const limit = Math.max(1, max);
38
+ const visible = expanded ? sources : sources.slice(0, limit);
39
+ const hidden = sources.length - visible.length;
40
+ const row = (source, index) => {
41
+ const safe = (0, safeHref_1.resolveSafeHref)(source.href);
42
+ const handle = (event) => onSelect === null || onSelect === void 0 ? void 0 : onSelect(source, event);
43
+ const content = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_2.Flex, { as: "span", "aria-hidden": "true", align: "center", justify: "center", boxSize: 5, flexShrink: 0, borderRadius: radii_1.RADIUS_ROLE.option, bg: tokens.inset, color: tokens.muted, fontSize: "xs-minus", fontWeight: 600, sx: typography_1.NUMERIC_TEXT, children: index + 1 }), (0, jsx_runtime_1.jsxs)(react_2.Box, { as: "span", flex: "1", minW: 0, textAlign: "start", children: [(0, jsx_runtime_1.jsx)(react_2.Box, { as: "span", display: "block", fontSize: "sm", fontWeight: 500, color: safe ? tokens.link : tokens.body, noOfLines: 1, children: source.title }), source.subtitle || source.kind ? ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "span", display: "block", fontSize: "xs", color: tokens.muted, noOfLines: 1, children: [source.kind, source.subtitle].filter(Boolean).join(" · ") })) : null] }), (0, jsx_runtime_1.jsx)(react_2.Box, { as: (safe === null || safe === void 0 ? void 0 : safe.external) ? lucide_react_1.ExternalLink : lucide_react_1.FileText, "aria-hidden": "true", boxSize: 3.5, flexShrink: 0, color: tokens.muted }), (safe === null || safe === void 0 ? void 0 : safe.external) ? (0, jsx_runtime_1.jsxs)(VisuallyHidden_1.default, { children: ["(", text.newTab, ")"] }) : null] }));
44
+ const shared = {
45
+ display: "flex",
46
+ alignItems: "center",
47
+ gap: 2.5,
48
+ w: "100%",
49
+ px: 2,
50
+ py: 1.5,
51
+ borderRadius: radii_1.RADIUS_ROLE.option,
52
+ transition: ROW_TRANSITION,
53
+ _hover: { bg: rows.active },
54
+ sx: (0, focusRing_styles_1.focusVisibleStyles)(colors),
55
+ };
56
+ if (safe) {
57
+ return ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "a", href: safe.href, ...(0, safeHref_1.anchorAttributes)(safe), onClick: handle, ...shared, children: content }));
58
+ }
59
+ return ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "button", type: "button", onClick: handle, disabled: !onSelect, cursor: onSelect ? "pointer" : "default", ...shared, children: content }));
60
+ };
61
+ return ((0, jsx_runtime_1.jsxs)(react_2.Box, { as: "section", "aria-labelledby": headingId, "data-testid": testId, children: [(0, jsx_runtime_1.jsx)(react_2.Text, { id: headingId, as: "h4", fontSize: "xs", fontWeight: 600, color: tokens.muted, mb: 1, children: text.title }), (0, jsx_runtime_1.jsx)(react_2.Box, { as: "ol", listStyleType: "none", m: 0, p: 0, children: visible.map((source, index) => ((0, jsx_runtime_1.jsx)("li", { children: row(source, index) }, source.id))) }), sources.length > limit ? ((0, jsx_runtime_1.jsx)(Button_1.default, { mt: 1, size: "xs", variant: "ghost", colorScheme: "gray", label: expanded ? text.showFewer : text.showMore(hidden), "aria-expanded": expanded, onClick: () => setExpanded((v) => !v) })) : null] }));
62
+ };
63
+ exports.default = (0, react_1.memo)(AssistantSources);
@@ -0,0 +1,29 @@
1
+ import type { MouseEvent } from "react";
2
+ import type { AssistantSource } from "../assistantTypes";
3
+ /** Visible and spoken text of `AssistantSources`; omitted keys keep the English default. */
4
+ export interface AssistantSourcesLabels {
5
+ /** Heading above the list. Default "Sources". */
6
+ title?: string;
7
+ /** The expander when some sources are hidden. Default "Show N more". */
8
+ showMore?: (hidden: number) => string;
9
+ /** The collapser. Default "Show fewer". */
10
+ showFewer?: string;
11
+ /** Appended, visually hidden, to a source that opens a new tab. Default "opens in a new tab". */
12
+ newTab?: string;
13
+ }
14
+ /** A compact, numbered list of the sources an answer drew on. */
15
+ export interface AssistantSourcesProps {
16
+ /** Sources in citation order; nothing renders when empty. */
17
+ sources: AssistantSource[];
18
+ /**
19
+ * Called when a source is activated. A source with a safe `href` is an anchor, so call
20
+ * `event.preventDefault()` to open it in-app; one without `href` is a button and needs this to do anything.
21
+ */
22
+ onSelect?: (source: AssistantSource, event: MouseEvent<HTMLElement>) => void;
23
+ /** Sources shown before a "Show N more" button. Default 4. */
24
+ max?: number;
25
+ /** Translated heading and expander text. */
26
+ labels?: AssistantSourcesLabels;
27
+ /** data-testid on the root. */
28
+ "data-testid"?: string;
29
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ import type { AssistantToolStepsProps } from "./AssistantToolStepsProps";
2
+ declare const _default: import("react").MemoExoticComponent<({ steps, collapseAfter, labels, "data-testid": testId, }: AssistantToolStepsProps) => import("react/jsx-runtime").JSX.Element | null>;
3
+ export default _default;
@@ -0,0 +1,41 @@
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 Button_1 = __importDefault(require("../../Button/Button"));
12
+ const Spinner_1 = __importDefault(require("../../Spinner/Spinner"));
13
+ const VisuallyHidden_1 = __importDefault(require("../../VisuallyHidden/VisuallyHidden"));
14
+ const DEFAULT_STATUS = { running: "Running", done: "Done", error: "Failed" };
15
+ const DEFAULT_LABELS = {
16
+ list: "Assistant steps",
17
+ showAll: (total) => `Show all ${total} steps`,
18
+ showFewer: "Show fewer",
19
+ };
20
+ /** Checklist of tool calls: spinner, check or error mark per step; collapses to the latest `collapseAfter`. */
21
+ const AssistantToolSteps = ({ steps, collapseAfter = 3, labels, "data-testid": testId = "assistant-tool-steps", }) => {
22
+ const { colors } = (0, useCustomTheme_1.useCustomTheme)();
23
+ const [expanded, setExpanded] = (0, react_1.useState)(false);
24
+ if (steps.length === 0)
25
+ return null;
26
+ const text = { ...DEFAULT_LABELS, ...labels };
27
+ const status = { ...DEFAULT_STATUS, ...labels === null || labels === void 0 ? void 0 : labels.status };
28
+ const limit = Math.max(1, collapseAfter);
29
+ const collapsible = steps.length > limit;
30
+ // The latest steps are the live ones, so a collapsed list keeps the tail, not the head.
31
+ const visible = collapsible && !expanded ? steps.slice(-limit) : steps;
32
+ const icon = (step) => {
33
+ if (step.status === "running")
34
+ return (0, jsx_runtime_1.jsx)(Spinner_1.default, { size: "xs", color: "currentColor", label: "", "aria-hidden": "true" });
35
+ if (step.status === "done")
36
+ return (0, jsx_runtime_1.jsx)(react_2.Box, { as: lucide_react_1.Check, "aria-hidden": "true", boxSize: 3.5, color: colors.semanticText.success });
37
+ return (0, jsx_runtime_1.jsx)(react_2.Box, { as: lucide_react_1.AlertCircle, "aria-hidden": "true", boxSize: 3.5, color: colors.semanticText.error });
38
+ };
39
+ return ((0, jsx_runtime_1.jsxs)(react_2.Box, { "data-testid": testId, children: [(0, jsx_runtime_1.jsx)(react_2.Box, { as: "ol", "aria-label": text.list, listStyleType: "none", m: 0, p: 0, children: visible.map((step) => ((0, jsx_runtime_1.jsxs)(react_2.Flex, { as: "li", gap: 2, align: "flex-start", py: 0.5, "data-status": step.status, children: [(0, jsx_runtime_1.jsx)(react_2.Flex, { boxSize: 5, align: "center", justify: "center", flexShrink: 0, color: colors.textMuted, children: icon(step) }), (0, jsx_runtime_1.jsxs)(react_2.Box, { minW: 0, fontSize: "sm", lineHeight: 1.43, children: [(0, jsx_runtime_1.jsx)(react_2.Text, { as: "span", color: step.status === "error" ? colors.semanticText.error : colors.text[700], children: step.label }), (0, jsx_runtime_1.jsxs)(VisuallyHidden_1.default, { children: [", ", status[step.status]] }), step.detail ? ((0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: "xs", color: colors.textMuted, noOfLines: 2, children: step.detail })) : null] })] }, step.id))) }), collapsible ? ((0, jsx_runtime_1.jsx)(Button_1.default, { mt: 1, size: "xs", variant: "ghost", colorScheme: "gray", "aria-expanded": expanded, label: expanded ? text.showFewer : text.showAll(steps.length), onClick: () => setExpanded((v) => !v) })) : null] }));
40
+ };
41
+ exports.default = (0, react_1.memo)(AssistantToolSteps);
@@ -0,0 +1,37 @@
1
+ /** One step of the assistant's work, e.g. a tool call. */
2
+ export interface AssistantToolStep {
3
+ /** Stable key. */
4
+ id: string;
5
+ /** What the step does, e.g. "Searching tickets". */
6
+ label: string;
7
+ /** Spinner while "running", a check when "done", an error mark on "error". */
8
+ status: "running" | "done" | "error";
9
+ /** Muted second line, e.g. "12 results". */
10
+ detail?: string;
11
+ }
12
+ /** Visible and spoken text of `AssistantToolSteps`; omitted keys keep the English default. */
13
+ export interface AssistantToolStepsLabels {
14
+ /** Name of the list. Default "Assistant steps". */
15
+ list?: string;
16
+ /** The expander. Default "Show all N steps". */
17
+ showAll?: (total: number) => string;
18
+ /** The collapser. Default "Show fewer". */
19
+ showFewer?: string;
20
+ /** Spoken status of a step, read after its label. */
21
+ status?: {
22
+ running?: string;
23
+ done?: string;
24
+ error?: string;
25
+ };
26
+ }
27
+ /** The assistant's tool calls as a compact checklist; long runs collapse to the latest steps. */
28
+ export interface AssistantToolStepsProps {
29
+ /** Steps in order; nothing renders when empty. */
30
+ steps: AssistantToolStep[];
31
+ /** Steps shown before the list collapses to its latest ones behind "Show all". Default 3. */
32
+ collapseAfter?: number;
33
+ /** Translated list name, expander and status words. */
34
+ labels?: AssistantToolStepsLabels;
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 { AssistantSuggestionsProps } from "./AssistantSuggestionsProps";
2
+ declare const _default: import("react").MemoExoticComponent<({ suggestions, onSelect, max, isDisabled, label, "data-testid": testId, }: AssistantSuggestionsProps) => import("react/jsx-runtime").JSX.Element | null>;
3
+ export default _default;
@@ -0,0 +1,18 @@
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 radii_1 = require("../../../Theme/tokens/primitives/radii");
10
+ const Button_1 = __importDefault(require("../../Button/Button"));
11
+ /** Wrapping row of outline prompt chips (`Button`s), so a long prompt wraps instead of truncating. */
12
+ const AssistantSuggestions = ({ suggestions, onSelect, max, isDisabled = false, label = "Suggestions", "data-testid": testId = "assistant-suggestions", }) => {
13
+ const shown = max === undefined ? suggestions : suggestions.slice(0, Math.max(0, max));
14
+ if (shown.length === 0)
15
+ return null;
16
+ return ((0, jsx_runtime_1.jsx)(react_2.Flex, { role: "group", "aria-label": label, wrap: "wrap", gap: 2, "data-testid": testId, children: shown.map((suggestion, i) => ((0, jsx_runtime_1.jsx)(Button_1.default, { variant: "outline", colorScheme: "gray", size: "sm", h: "auto", minH: 8, py: 1.5, px: 3, borderRadius: radii_1.RADIUS_ROLE.chip, whiteSpace: "normal", textAlign: "start", fontWeight: 500, isDisabled: isDisabled, label: suggestion, onClick: () => onSelect(suggestion) }, `${i}-${suggestion}`))) }));
17
+ };
18
+ exports.default = (0, react_1.memo)(AssistantSuggestions);
@@ -0,0 +1,15 @@
1
+ /** Wrapping prompt chips; picking one hands its text to `onSelect`. */
2
+ export interface AssistantSuggestionsProps {
3
+ /** Prompts in display order; nothing renders when empty. */
4
+ suggestions: string[];
5
+ /** Called with the chip's exact text. */
6
+ onSelect: (text: string) => void;
7
+ /** Chips shown at most; the rest are dropped, not collapsed. Default all. */
8
+ max?: number;
9
+ /** Disables every chip, e.g. while a reply is streaming. */
10
+ isDisabled?: boolean;
11
+ /** Name of the chip group. Default "Suggestions". */
12
+ label?: string;
13
+ /** data-testid on the root. */
14
+ "data-testid"?: string;
15
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ import type { AssistantThreadProps } from "./AssistantThreadProps";
2
+ declare const _default: import("react").MemoExoticComponent<({ messages, renderMessage, messageProps, emptyState, children, stickThreshold, scrollContainerRef, labels, "data-testid": testId, }: AssistantThreadProps) => import("react/jsx-runtime").JSX.Element>;
3
+ export default _default;