@wallarm-org/design-system 3.2.0 → 3.3.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 (169) hide show
  1. package/dist/components/AnimatedBackground/blur/BlurBackground.d.ts +6 -0
  2. package/dist/components/AnimatedBackground/blur/BlurBackground.js +176 -76
  3. package/dist/components/AnimatedBackground/blur/index.d.ts +1 -1
  4. package/dist/components/AnimatedBackground/index.d.ts +1 -1
  5. package/dist/components/ApprovalCard/ApprovalCard.d.ts +13 -0
  6. package/dist/components/ApprovalCard/ApprovalCard.js +249 -0
  7. package/dist/components/ApprovalCard/ApprovalCardActions.d.ts +6 -0
  8. package/dist/components/ApprovalCard/ApprovalCardActions.js +50 -0
  9. package/dist/components/ApprovalCard/ApprovalCardContent.d.ts +6 -0
  10. package/dist/components/ApprovalCard/ApprovalCardContent.js +50 -0
  11. package/dist/components/ApprovalCard/classes.d.ts +10 -0
  12. package/dist/components/ApprovalCard/classes.js +26 -0
  13. package/dist/components/ApprovalCard/index.d.ts +3 -0
  14. package/dist/components/ApprovalCard/index.js +3 -0
  15. package/dist/components/AssistantMessage/AssistantMessage.d.ts +12 -0
  16. package/dist/components/AssistantMessage/AssistantMessage.js +66 -0
  17. package/dist/components/AssistantMessage/AssistantMessageContent.d.ts +10 -0
  18. package/dist/components/AssistantMessage/AssistantMessageContent.js +50 -0
  19. package/dist/components/AssistantMessage/AssistantMessageError.d.ts +13 -0
  20. package/dist/components/AssistantMessage/AssistantMessageError.js +93 -0
  21. package/dist/components/AssistantMessage/AssistantMessageLoader.d.ts +13 -0
  22. package/dist/components/AssistantMessage/AssistantMessageLoader.js +88 -0
  23. package/dist/components/AssistantMessage/AssistantMessageMarkdown.d.ts +71 -0
  24. package/dist/components/AssistantMessage/AssistantMessageMarkdown.js +278 -0
  25. package/dist/components/AssistantMessage/AssistantMessageMarkdownCodeBlock.d.ts +17 -0
  26. package/dist/components/AssistantMessage/AssistantMessageMarkdownCodeBlock.js +94 -0
  27. package/dist/components/AssistantMessage/AssistantMessageMarkdownInlineCode.d.ts +10 -0
  28. package/dist/components/AssistantMessage/AssistantMessageMarkdownInlineCode.js +59 -0
  29. package/dist/components/AssistantMessage/AssistantMessageMarkdownLink.d.ts +14 -0
  30. package/dist/components/AssistantMessage/AssistantMessageMarkdownLink.js +65 -0
  31. package/dist/components/AssistantMessage/AssistantMessageMarkdownTable.d.ts +7 -0
  32. package/dist/components/AssistantMessage/AssistantMessageMarkdownTable.js +70 -0
  33. package/dist/components/AssistantMessage/classes.d.ts +38 -0
  34. package/dist/components/AssistantMessage/classes.js +46 -0
  35. package/dist/components/AssistantMessage/index.d.ts +9 -0
  36. package/dist/components/AssistantMessage/index.js +9 -0
  37. package/dist/components/AssistantMessage/lib/markdown.d.ts +20 -0
  38. package/dist/components/AssistantMessage/lib/markdown.js +51 -0
  39. package/dist/components/ChainOfThought/ChainOfThought.d.ts +10 -0
  40. package/dist/components/ChainOfThought/ChainOfThought.js +66 -0
  41. package/dist/components/ChainOfThought/ChainOfThoughtStep.d.ts +31 -0
  42. package/dist/components/ChainOfThought/ChainOfThoughtStep.js +312 -0
  43. package/dist/components/ChainOfThought/classes.d.ts +20 -0
  44. package/dist/components/ChainOfThought/classes.js +84 -0
  45. package/dist/components/ChainOfThought/index.d.ts +2 -0
  46. package/dist/components/ChainOfThought/index.js +2 -0
  47. package/dist/components/Chat/Chat.d.ts +12 -0
  48. package/dist/components/Chat/Chat.js +90 -0
  49. package/dist/components/Chat/ChatBody.d.ts +12 -0
  50. package/dist/components/Chat/ChatBody.js +52 -0
  51. package/dist/components/Chat/ChatFooter.d.ts +7 -0
  52. package/dist/components/Chat/ChatFooter.js +50 -0
  53. package/dist/components/Chat/ChatGreeting.d.ts +8 -0
  54. package/dist/components/Chat/ChatGreeting.js +94 -0
  55. package/dist/components/Chat/ChatHeader.d.ts +6 -0
  56. package/dist/components/Chat/ChatHeader.js +50 -0
  57. package/dist/components/Chat/ChatHeaderActions.d.ts +7 -0
  58. package/dist/components/Chat/ChatHeaderActions.js +50 -0
  59. package/dist/components/Chat/ChatHeaderTitle.d.ts +12 -0
  60. package/dist/components/Chat/ChatHeaderTitle.js +99 -0
  61. package/dist/components/Chat/ChatSuggestion.d.ts +7 -0
  62. package/dist/components/Chat/ChatSuggestion.js +56 -0
  63. package/dist/components/Chat/ChatSuggestions.d.ts +14 -0
  64. package/dist/components/Chat/ChatSuggestions.js +111 -0
  65. package/dist/components/Chat/ChatSuggestionsContext.d.ts +7 -0
  66. package/dist/components/Chat/ChatSuggestionsContext.js +7 -0
  67. package/dist/components/Chat/ChatTrigger.d.ts +13 -0
  68. package/dist/components/Chat/ChatTrigger.js +101 -0
  69. package/dist/components/Chat/classes.d.ts +17 -0
  70. package/dist/components/Chat/classes.js +44 -0
  71. package/dist/components/Chat/index.d.ts +10 -0
  72. package/dist/components/Chat/index.js +10 -0
  73. package/dist/components/ChatInput/ChatInput.d.ts +30 -0
  74. package/dist/components/ChatInput/ChatInput.js +230 -0
  75. package/dist/components/ChatInput/ChatInputContext.d.ts +11 -0
  76. package/dist/components/ChatInput/ChatInputContext.js +8 -0
  77. package/dist/components/ChatInput/ChatInputSubmit.d.ts +10 -0
  78. package/dist/components/ChatInput/ChatInputSubmit.js +175 -0
  79. package/dist/components/ChatInput/ChatInputTextarea.d.ts +6 -0
  80. package/dist/components/ChatInput/ChatInputTextarea.js +155 -0
  81. package/dist/components/ChatInput/classes.d.ts +9 -0
  82. package/dist/components/ChatInput/classes.js +22 -0
  83. package/dist/components/ChatInput/index.d.ts +3 -0
  84. package/dist/components/ChatInput/index.js +3 -0
  85. package/dist/components/ChatPermissions/ChatPermissions.d.ts +12 -0
  86. package/dist/components/ChatPermissions/ChatPermissions.js +66 -0
  87. package/dist/components/ChatPermissions/ChatPermissionsContent.d.ts +7 -0
  88. package/dist/components/ChatPermissions/ChatPermissionsContent.js +73 -0
  89. package/dist/components/ChatPermissions/ChatPermissionsContext.d.ts +7 -0
  90. package/dist/components/ChatPermissions/ChatPermissionsContext.js +8 -0
  91. package/dist/components/ChatPermissions/ChatPermissionsItem.d.ts +17 -0
  92. package/dist/components/ChatPermissions/ChatPermissionsItem.js +115 -0
  93. package/dist/components/ChatPermissions/ChatPermissionsTrigger.d.ts +6 -0
  94. package/dist/components/ChatPermissions/ChatPermissionsTrigger.js +110 -0
  95. package/dist/components/ChatPermissions/classes.d.ts +3 -0
  96. package/dist/components/ChatPermissions/classes.js +5 -0
  97. package/dist/components/ChatPermissions/index.d.ts +4 -0
  98. package/dist/components/ChatPermissions/index.js +4 -0
  99. package/dist/components/Conversation/Conversation.d.ts +19 -0
  100. package/dist/components/Conversation/Conversation.js +102 -0
  101. package/dist/components/Conversation/ConversationContent.d.ts +11 -0
  102. package/dist/components/Conversation/ConversationContent.js +103 -0
  103. package/dist/components/Conversation/ConversationContext.d.ts +14 -0
  104. package/dist/components/Conversation/ConversationContext.js +8 -0
  105. package/dist/components/Conversation/ConversationEmptyState.d.ts +15 -0
  106. package/dist/components/Conversation/ConversationEmptyState.js +70 -0
  107. package/dist/components/Conversation/ConversationScrollButton.d.ts +13 -0
  108. package/dist/components/Conversation/ConversationScrollButton.js +138 -0
  109. package/dist/components/Conversation/classes.d.ts +13 -0
  110. package/dist/components/Conversation/classes.js +8 -0
  111. package/dist/components/Conversation/index.d.ts +4 -0
  112. package/dist/components/Conversation/index.js +4 -0
  113. package/dist/components/Conversation/useStickToBottom.d.ts +9 -0
  114. package/dist/components/Conversation/useStickToBottom.js +203 -0
  115. package/dist/components/MessageActions/MessageAction.d.ts +18 -0
  116. package/dist/components/MessageActions/MessageAction.js +109 -0
  117. package/dist/components/MessageActions/MessageActions.d.ts +12 -0
  118. package/dist/components/MessageActions/MessageActions.js +74 -0
  119. package/dist/components/MessageActions/MessageTimestamp.d.ts +7 -0
  120. package/dist/components/MessageActions/MessageTimestamp.js +50 -0
  121. package/dist/components/MessageActions/classes.d.ts +5 -0
  122. package/dist/components/MessageActions/classes.js +15 -0
  123. package/dist/components/MessageActions/index.d.ts +3 -0
  124. package/dist/components/MessageActions/index.js +3 -0
  125. package/dist/components/Popover/PopoverContent.d.ts +2 -1
  126. package/dist/components/Popover/PopoverContent.js +42 -39
  127. package/dist/components/UserMessage/UserMessage.d.ts +10 -0
  128. package/dist/components/UserMessage/UserMessage.js +66 -0
  129. package/dist/components/UserMessage/UserMessageBubble.d.ts +16 -0
  130. package/dist/components/UserMessage/UserMessageBubble.js +175 -0
  131. package/dist/components/UserMessage/UserMessageContext.d.ts +9 -0
  132. package/dist/components/UserMessage/UserMessageContext.js +4 -0
  133. package/dist/components/UserMessage/UserMessageShowMore.d.ts +15 -0
  134. package/dist/components/UserMessage/UserMessageShowMore.js +87 -0
  135. package/dist/components/UserMessage/classes.d.ts +11 -0
  136. package/dist/components/UserMessage/classes.js +32 -0
  137. package/dist/components/UserMessage/index.d.ts +3 -0
  138. package/dist/components/UserMessage/index.js +3 -0
  139. package/dist/components/WallyAssistant/WallyAssistant.d.ts +56 -0
  140. package/dist/components/WallyAssistant/WallyAssistant.js +541 -0
  141. package/dist/components/WallyAssistant/index.d.ts +10 -0
  142. package/dist/components/WallyAssistant/index.js +8 -0
  143. package/dist/components/WallyAssistant/model/deriveChatState.d.ts +33 -0
  144. package/dist/components/WallyAssistant/model/deriveChatState.js +54 -0
  145. package/dist/components/WallyAssistant/model/labels.d.ts +43 -0
  146. package/dist/components/WallyAssistant/model/labels.js +33 -0
  147. package/dist/components/WallyAssistant/model/model.d.ts +184 -0
  148. package/dist/components/WallyAssistant/model/model.js +0 -0
  149. package/dist/components/WallyAssistant/views/ApprovalCardView.d.ts +20 -0
  150. package/dist/components/WallyAssistant/views/ApprovalCardView.js +274 -0
  151. package/dist/components/WallyAssistant/views/ChainOfThoughtView.d.ts +18 -0
  152. package/dist/components/WallyAssistant/views/ChainOfThoughtView.js +301 -0
  153. package/dist/components/WallyAssistant/views/ChatMessageView.d.ts +15 -0
  154. package/dist/components/WallyAssistant/views/ChatMessageView.js +372 -0
  155. package/dist/components/WallyAssistant/views/ChatPartView.d.ts +16 -0
  156. package/dist/components/WallyAssistant/views/ChatPartView.js +171 -0
  157. package/dist/components/WallyAssistant/views/ChatViewContext.d.ts +98 -0
  158. package/dist/components/WallyAssistant/views/ChatViewContext.js +44 -0
  159. package/dist/components/WallyAssistant/views/ChatViewProvider.d.ts +18 -0
  160. package/dist/components/WallyAssistant/views/ChatViewProvider.js +96 -0
  161. package/dist/components/WallyAssistant/views/stepIcons.d.ts +8 -0
  162. package/dist/components/WallyAssistant/views/stepIcons.js +47 -0
  163. package/dist/index.d.ts +10 -0
  164. package/dist/index.js +10 -0
  165. package/dist/metadata/components.json +30786 -15960
  166. package/dist/theme/components/animated-background.css +6 -1
  167. package/dist/theme/index.css +1 -0
  168. package/dist/theme/utilities/shimmer-text.css +27 -0
  169. package/package.json +3 -1
@@ -0,0 +1,111 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { c } from "react/compiler-runtime";
3
+ import { useId } from "react";
4
+ import { cn } from "../../utils/cn.js";
5
+ import { useTestId } from "../../utils/testId.js";
6
+ import { ChatSuggestionsProvider } from "./ChatSuggestionsContext.js";
7
+ import { chatSuggestionsLabelVariants, chatSuggestionsVariants } from "./classes.js";
8
+ const ChatSuggestions = (t0)=>{
9
+ const $ = c(29);
10
+ let children;
11
+ let className;
12
+ let label;
13
+ let props;
14
+ let ref;
15
+ let t1;
16
+ let testIdProp;
17
+ if ($[0] !== t0) {
18
+ ({ ref, placement: t1, label, className, children, "data-testid": testIdProp, ...props } = t0);
19
+ $[0] = t0;
20
+ $[1] = children;
21
+ $[2] = className;
22
+ $[3] = label;
23
+ $[4] = props;
24
+ $[5] = ref;
25
+ $[6] = t1;
26
+ $[7] = testIdProp;
27
+ } else {
28
+ children = $[1];
29
+ className = $[2];
30
+ label = $[3];
31
+ props = $[4];
32
+ ref = $[5];
33
+ t1 = $[6];
34
+ testIdProp = $[7];
35
+ }
36
+ const placement = void 0 === t1 ? "footer" : t1;
37
+ const testId = useTestId("suggestions", testIdProp);
38
+ const labelId = useId();
39
+ const hasLabel = null != label && false !== label && "" !== label;
40
+ const t2 = hasLabel ? void 0 : "Suggestions";
41
+ const t3 = hasLabel ? labelId : void 0;
42
+ let t4;
43
+ if ($[8] !== className || $[9] !== placement) {
44
+ t4 = cn(chatSuggestionsVariants({
45
+ placement
46
+ }), className);
47
+ $[8] = className;
48
+ $[9] = placement;
49
+ $[10] = t4;
50
+ } else t4 = $[10];
51
+ let t5;
52
+ if ($[11] !== hasLabel || $[12] !== label || $[13] !== labelId) {
53
+ t5 = hasLabel && /*#__PURE__*/ jsx("p", {
54
+ id: labelId,
55
+ className: chatSuggestionsLabelVariants(),
56
+ children: label
57
+ });
58
+ $[11] = hasLabel;
59
+ $[12] = label;
60
+ $[13] = labelId;
61
+ $[14] = t5;
62
+ } else t5 = $[14];
63
+ const t6 = "greeting" === placement ? "lg" : "md";
64
+ let t7;
65
+ if ($[15] !== t6) {
66
+ t7 = {
67
+ size: t6
68
+ };
69
+ $[15] = t6;
70
+ $[16] = t7;
71
+ } else t7 = $[16];
72
+ let t8;
73
+ if ($[17] !== children || $[18] !== t7) {
74
+ t8 = /*#__PURE__*/ jsx(ChatSuggestionsProvider, {
75
+ value: t7,
76
+ children: children
77
+ });
78
+ $[17] = children;
79
+ $[18] = t7;
80
+ $[19] = t8;
81
+ } else t8 = $[19];
82
+ let t9;
83
+ if ($[20] !== props || $[21] !== ref || $[22] !== t2 || $[23] !== t3 || $[24] !== t4 || $[25] !== t5 || $[26] !== t8 || $[27] !== testId) {
84
+ t9 = /*#__PURE__*/ jsxs("div", {
85
+ role: "group",
86
+ "aria-label": t2,
87
+ "aria-labelledby": t3,
88
+ ...props,
89
+ ref: ref,
90
+ "data-slot": "chat-suggestions",
91
+ "data-testid": testId,
92
+ className: t4,
93
+ children: [
94
+ t5,
95
+ t8
96
+ ]
97
+ });
98
+ $[20] = props;
99
+ $[21] = ref;
100
+ $[22] = t2;
101
+ $[23] = t3;
102
+ $[24] = t4;
103
+ $[25] = t5;
104
+ $[26] = t8;
105
+ $[27] = testId;
106
+ $[28] = t9;
107
+ } else t9 = $[28];
108
+ return t9;
109
+ };
110
+ ChatSuggestions.displayName = "ChatSuggestions";
111
+ export { ChatSuggestions };
@@ -0,0 +1,7 @@
1
+ export type ChatSuggestionSize = 'md' | 'lg';
2
+ interface ChatSuggestionsContextValue {
3
+ size: ChatSuggestionSize;
4
+ }
5
+ export declare const ChatSuggestionsProvider: import("react").Provider<ChatSuggestionsContextValue>;
6
+ export declare const useChatSuggestionsContext: () => ChatSuggestionsContextValue;
7
+ export {};
@@ -0,0 +1,7 @@
1
+ import { createContext, useContext } from "react";
2
+ const ChatSuggestionsContext = createContext({
3
+ size: "md"
4
+ });
5
+ const ChatSuggestionsProvider = ChatSuggestionsContext.Provider;
6
+ const useChatSuggestionsContext = ()=>useContext(ChatSuggestionsContext);
7
+ export { ChatSuggestionsProvider, useChatSuggestionsContext };
@@ -0,0 +1,13 @@
1
+ import { type ButtonHTMLAttributes, type FC, type Ref } from 'react';
2
+ import { type TestableProps } from '../../utils/testId.js';
3
+ /**
4
+ * The app-header button that opens Wally (Figma 101:1034): a ghost small icon `Button` with the
5
+ * mascot and an "Ask Wally" tooltip. It holds no open state — wire `onClick`/`aria-expanded`
6
+ * yourself, or wrap it in `<DrawerTrigger asChild>`.
7
+ */
8
+ export interface ChatTriggerProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'color'>, TestableProps {
9
+ ref?: Ref<HTMLButtonElement>;
10
+ /** Tooltip text and accessible name. */
11
+ label?: string;
12
+ }
13
+ export declare const ChatTrigger: FC<ChatTriggerProps>;
@@ -0,0 +1,101 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { c } from "react/compiler-runtime";
3
+ import { useId } from "react";
4
+ import { useTestId } from "../../utils/testId.js";
5
+ import { Button } from "../Button/index.js";
6
+ import { Tooltip, TooltipContent, TooltipTrigger } from "../Tooltip/index.js";
7
+ import { WallyIcon } from "../WallyIcon/index.js";
8
+ const ChatTrigger = (t0)=>{
9
+ const $ = c(22);
10
+ let id;
11
+ let ref;
12
+ let rest;
13
+ let t1;
14
+ let testIdProp;
15
+ if ($[0] !== t0) {
16
+ ({ ref, id, label: t1, "data-testid": testIdProp, ...rest } = t0);
17
+ $[0] = t0;
18
+ $[1] = id;
19
+ $[2] = ref;
20
+ $[3] = rest;
21
+ $[4] = t1;
22
+ $[5] = testIdProp;
23
+ } else {
24
+ id = $[1];
25
+ ref = $[2];
26
+ rest = $[3];
27
+ t1 = $[4];
28
+ testIdProp = $[5];
29
+ }
30
+ const label = void 0 === t1 ? "Ask Wally" : t1;
31
+ const testId = useTestId("trigger", testIdProp);
32
+ const fallbackId = useId();
33
+ const triggerId = id ?? fallbackId;
34
+ let t2;
35
+ if ($[6] !== triggerId) {
36
+ t2 = {
37
+ trigger: triggerId
38
+ };
39
+ $[6] = triggerId;
40
+ $[7] = t2;
41
+ } else t2 = $[7];
42
+ let t3;
43
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
44
+ t3 = /*#__PURE__*/ jsx(WallyIcon, {
45
+ size: "md"
46
+ });
47
+ $[8] = t3;
48
+ } else t3 = $[8];
49
+ let t4;
50
+ if ($[9] !== label || $[10] !== ref || $[11] !== rest || $[12] !== testId || $[13] !== triggerId) {
51
+ t4 = /*#__PURE__*/ jsx(TooltipTrigger, {
52
+ asChild: true,
53
+ children: /*#__PURE__*/ jsx(Button, {
54
+ variant: "ghost",
55
+ color: "neutral",
56
+ size: "small",
57
+ "aria-label": label,
58
+ type: "button",
59
+ ...rest,
60
+ id: triggerId,
61
+ ref: ref,
62
+ "data-slot": "chat-trigger",
63
+ "data-testid": testId,
64
+ children: t3
65
+ })
66
+ });
67
+ $[9] = label;
68
+ $[10] = ref;
69
+ $[11] = rest;
70
+ $[12] = testId;
71
+ $[13] = triggerId;
72
+ $[14] = t4;
73
+ } else t4 = $[14];
74
+ let t5;
75
+ if ($[15] !== label) {
76
+ t5 = /*#__PURE__*/ jsx(TooltipContent, {
77
+ children: label
78
+ });
79
+ $[15] = label;
80
+ $[16] = t5;
81
+ } else t5 = $[16];
82
+ let t6;
83
+ if ($[17] !== t2 || $[18] !== t4 || $[19] !== t5 || $[20] !== testId) {
84
+ t6 = /*#__PURE__*/ jsxs(Tooltip, {
85
+ ids: t2,
86
+ "data-testid": testId,
87
+ children: [
88
+ t4,
89
+ t5
90
+ ]
91
+ });
92
+ $[17] = t2;
93
+ $[18] = t4;
94
+ $[19] = t5;
95
+ $[20] = testId;
96
+ $[21] = t6;
97
+ } else t6 = $[21];
98
+ return t6;
99
+ };
100
+ ChatTrigger.displayName = "ChatTrigger";
101
+ export { ChatTrigger };
@@ -0,0 +1,17 @@
1
+ export declare const chatVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
2
+ export declare const chatBackgroundVariants: (props?: ({
3
+ background?: "strong" | "subtle" | null | undefined;
4
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
5
+ export declare const chatHeaderVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
6
+ export declare const chatHeaderTitleVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
7
+ export declare const chatHeaderActionsVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
8
+ export declare const chatBodyVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
9
+ export declare const chatFooterVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
10
+ export declare const chatGreetingVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
11
+ export declare const chatSuggestionsVariants: (props?: ({
12
+ placement?: "footer" | "greeting" | null | undefined;
13
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
14
+ export declare const chatSuggestionsLabelVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
15
+ export declare const chatSuggestionVariants: (props?: ({
16
+ size?: "lg" | "md" | null | undefined;
17
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
@@ -0,0 +1,44 @@
1
+ import { cva } from "class-variance-authority";
2
+ import { cn } from "../../utils/cn.js";
3
+ const chatVariants = cva('relative isolate flex h-full min-h-0 flex-col overflow-hidden bg-bg-page-bg');
4
+ const chatBackgroundVariants = cva('pointer-events-none absolute inset-0 -z-1', {
5
+ variants: {
6
+ background: {
7
+ strong: 'opacity-12',
8
+ subtle: 'opacity-5'
9
+ }
10
+ },
11
+ defaultVariants: {
12
+ background: 'subtle'
13
+ }
14
+ });
15
+ const chatHeaderVariants = cva('flex h-48 shrink-0 items-center justify-between gap-8 border-b border-border-primary-light bg-bg-page-bg pl-16 pr-12');
16
+ const chatHeaderTitleVariants = cva('flex min-w-0 items-center');
17
+ const chatHeaderActionsVariants = cva(cn('flex shrink-0 items-center gap-4', '*:data-[orientation=vertical]:mx-2 *:data-[orientation=vertical]:h-16 *:data-[orientation=vertical]:self-center'));
18
+ const chatBodyVariants = cva('flex min-h-0 flex-1 flex-col overflow-y-auto px-16 pt-12 pb-16');
19
+ const chatFooterVariants = cva('flex shrink-0 flex-col gap-16 px-20 pb-4');
20
+ const chatGreetingVariants = cva('flex flex-col items-center gap-24 pt-103');
21
+ const chatSuggestionsVariants = cva('flex flex-col', {
22
+ variants: {
23
+ placement: {
24
+ footer: 'items-end gap-8',
25
+ greeting: 'items-center gap-12'
26
+ }
27
+ },
28
+ defaultVariants: {
29
+ placement: 'footer'
30
+ }
31
+ });
32
+ const chatSuggestionsLabelVariants = cva("font-mono text-xs text-text-secondary [font-feature-settings:'liga'_0]");
33
+ const chatSuggestionVariants = cva(cn('inline-flex max-w-full shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap', "border border-border-primary bg-transparent font-mono font-normal text-text-primary outline-none transition-colors [font-feature-settings:'liga'_0]", 'not-disabled:hover:border-border-brand not-disabled:hover:bg-bg-light-brand not-disabled:hover:text-text-brand', 'focus-visible:ring-3 focus-visible:ring-focus-brand', 'disabled:cursor-not-allowed disabled:opacity-50'), {
34
+ variants: {
35
+ size: {
36
+ md: 'h-20 rounded-8 px-8 text-xs',
37
+ lg: 'h-28 rounded-12 px-12 text-sm'
38
+ }
39
+ },
40
+ defaultVariants: {
41
+ size: 'md'
42
+ }
43
+ });
44
+ export { chatBackgroundVariants, chatBodyVariants, chatFooterVariants, chatGreetingVariants, chatHeaderActionsVariants, chatHeaderTitleVariants, chatHeaderVariants, chatSuggestionVariants, chatSuggestionsLabelVariants, chatSuggestionsVariants, chatVariants };
@@ -0,0 +1,10 @@
1
+ export { Chat, type ChatBackground, type ChatProps } from './Chat.js';
2
+ export { ChatBody, type ChatBodyProps } from './ChatBody.js';
3
+ export { ChatFooter, type ChatFooterProps } from './ChatFooter.js';
4
+ export { ChatGreeting, type ChatGreetingProps } from './ChatGreeting.js';
5
+ export { ChatHeader, type ChatHeaderProps } from './ChatHeader.js';
6
+ export { ChatHeaderActions, type ChatHeaderActionsProps } from './ChatHeaderActions.js';
7
+ export { ChatHeaderTitle, type ChatHeaderTitleProps } from './ChatHeaderTitle.js';
8
+ export { ChatSuggestion, type ChatSuggestionProps } from './ChatSuggestion.js';
9
+ export { ChatSuggestions, type ChatSuggestionsPlacement, type ChatSuggestionsProps, } from './ChatSuggestions.js';
10
+ export { ChatTrigger, type ChatTriggerProps } from './ChatTrigger.js';
@@ -0,0 +1,10 @@
1
+ export { Chat } from "./Chat.js";
2
+ export { ChatBody } from "./ChatBody.js";
3
+ export { ChatFooter } from "./ChatFooter.js";
4
+ export { ChatGreeting } from "./ChatGreeting.js";
5
+ export { ChatHeader } from "./ChatHeader.js";
6
+ export { ChatHeaderActions } from "./ChatHeaderActions.js";
7
+ export { ChatHeaderTitle } from "./ChatHeaderTitle.js";
8
+ export { ChatSuggestion } from "./ChatSuggestion.js";
9
+ export { ChatSuggestions } from "./ChatSuggestions.js";
10
+ export { ChatTrigger } from "./ChatTrigger.js";
@@ -0,0 +1,30 @@
1
+ import type { FC, FormHTMLAttributes, ReactNode, Ref } from 'react';
2
+ import { type TestableProps } from '../../utils/testId.js';
3
+ export interface ChatInputProps extends Omit<FormHTMLAttributes<HTMLFormElement>, 'onSubmit'>, TestableProps {
4
+ ref?: Ref<HTMLFormElement>;
5
+ /** Controlled only — the app owns the draft. */
6
+ value: string;
7
+ onValueChange: (value: string) => void;
8
+ /**
9
+ * Receives `value.trim()`. Not called when the value is empty, while `isRunning`, or when
10
+ * `disabled`. The form's native submit is prevented and focus returns to the textarea.
11
+ */
12
+ onSubmit: (value: string) => void;
13
+ /**
14
+ * Stop-button click, and Esc in the textarea while `isRunning`.
15
+ * Inside a Drawer/Dialog that Esc stops the run and doesn't close the layer; no host
16
+ * `onEscapeKeyDown` is needed. While running, a consumer `onKeyDown` can't cancel the Esc
17
+ * stop with `preventDefault` (the textarea has already claimed the key from the layer).
18
+ * Without `onStop`, Esc is left to the layer. A consumer popup anchored to the textarea
19
+ * (mention/autocomplete) keeps Esc while the textarea has `aria-expanded='true'`.
20
+ */
21
+ onStop?: () => void;
22
+ /** Swaps Send for Stop and blocks submit. CopilotKit: `agent.isRunning`. */
23
+ isRunning?: boolean;
24
+ disabled?: boolean;
25
+ /** Attached-context chips, shown in a bar behind the box. Nothing to render (`null`, `false`, `[]`) hides the bar. */
26
+ context?: ReactNode;
27
+ /** Line under the box. `null`/`false` hides it. */
28
+ disclaimer?: ReactNode;
29
+ }
30
+ export declare const ChatInput: FC<ChatInputProps>;
@@ -0,0 +1,230 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { c } from "react/compiler-runtime";
3
+ import { Children, useId } from "react";
4
+ import { cn } from "../../utils/cn.js";
5
+ import { TestIdProvider, useTestId } from "../../utils/testId.js";
6
+ import { ChatInputContext } from "./ChatInputContext.js";
7
+ import { chatInputBoxVariants, chatInputContextChipsVariants, chatInputContextVariants, chatInputDisclaimerVariants, chatInputVariants } from "./classes.js";
8
+ const DEFAULT_DISCLAIMER = "Wally can make mistakes; always verify.";
9
+ const ChatInput = (t0)=>{
10
+ const $ = c(66);
11
+ let children;
12
+ let className;
13
+ let context;
14
+ let onStop;
15
+ let onSubmit;
16
+ let onValueChange;
17
+ let ref;
18
+ let rest;
19
+ let t1;
20
+ let t2;
21
+ let t3;
22
+ let testIdProp;
23
+ let value;
24
+ if ($[0] !== t0) {
25
+ ({ ref, value, onValueChange, onSubmit, onStop, isRunning: t1, disabled: t2, context, disclaimer: t3, className, children, "data-testid": testIdProp, ...rest } = t0);
26
+ $[0] = t0;
27
+ $[1] = children;
28
+ $[2] = className;
29
+ $[3] = context;
30
+ $[4] = onStop;
31
+ $[5] = onSubmit;
32
+ $[6] = onValueChange;
33
+ $[7] = ref;
34
+ $[8] = rest;
35
+ $[9] = t1;
36
+ $[10] = t2;
37
+ $[11] = t3;
38
+ $[12] = testIdProp;
39
+ $[13] = value;
40
+ } else {
41
+ children = $[1];
42
+ className = $[2];
43
+ context = $[3];
44
+ onStop = $[4];
45
+ onSubmit = $[5];
46
+ onValueChange = $[6];
47
+ ref = $[7];
48
+ rest = $[8];
49
+ t1 = $[9];
50
+ t2 = $[10];
51
+ t3 = $[11];
52
+ testIdProp = $[12];
53
+ value = $[13];
54
+ }
55
+ const isRunning = void 0 === t1 ? false : t1;
56
+ const disabled = void 0 === t2 ? false : t2;
57
+ const disclaimer = void 0 === t3 ? DEFAULT_DISCLAIMER : t3;
58
+ const testId = useTestId("input", testIdProp);
59
+ let t4;
60
+ if ($[14] !== testId) {
61
+ t4 = (slot)=>testId ? `${testId}--${slot}` : void 0;
62
+ $[14] = testId;
63
+ $[15] = t4;
64
+ } else t4 = $[15];
65
+ const slotTestId = t4;
66
+ const disclaimerDomId = useId();
67
+ const hasDisclaimer = null !== disclaimer && false !== disclaimer;
68
+ let t5;
69
+ if ($[16] !== context) {
70
+ t5 = Children.toArray(context);
71
+ $[16] = context;
72
+ $[17] = t5;
73
+ } else t5 = $[17];
74
+ const hasContext = t5.length > 0;
75
+ let t6;
76
+ if ($[18] !== disabled || $[19] !== isRunning || $[20] !== onSubmit || $[21] !== value) {
77
+ t6 = (event)=>{
78
+ event.preventDefault();
79
+ const text = value.trim();
80
+ if (!text || isRunning || disabled) return;
81
+ onSubmit(text);
82
+ event.currentTarget.querySelector("textarea")?.focus();
83
+ };
84
+ $[18] = disabled;
85
+ $[19] = isRunning;
86
+ $[20] = onSubmit;
87
+ $[21] = value;
88
+ $[22] = t6;
89
+ } else t6 = $[22];
90
+ const handleSubmit = t6;
91
+ let t7;
92
+ if ($[23] !== slotTestId) {
93
+ t7 = slotTestId("box");
94
+ $[23] = slotTestId;
95
+ $[24] = t7;
96
+ } else t7 = $[24];
97
+ let t8;
98
+ if ($[25] !== disabled || $[26] !== hasContext) {
99
+ t8 = chatInputBoxVariants({
100
+ withContext: hasContext,
101
+ disabled
102
+ });
103
+ $[25] = disabled;
104
+ $[26] = hasContext;
105
+ $[27] = t8;
106
+ } else t8 = $[27];
107
+ let t9;
108
+ if ($[28] !== children || $[29] !== t7 || $[30] !== t8) {
109
+ t9 = /*#__PURE__*/ jsx("div", {
110
+ "data-slot": "chat-input-box",
111
+ "data-testid": t7,
112
+ className: t8,
113
+ children: children
114
+ });
115
+ $[28] = children;
116
+ $[29] = t7;
117
+ $[30] = t8;
118
+ $[31] = t9;
119
+ } else t9 = $[31];
120
+ const box = t9;
121
+ const t10 = disabled || void 0;
122
+ let t11;
123
+ if ($[32] !== className) {
124
+ t11 = cn(chatInputVariants(), className);
125
+ $[32] = className;
126
+ $[33] = t11;
127
+ } else t11 = $[33];
128
+ const t12 = hasDisclaimer ? disclaimerDomId : void 0;
129
+ let t13;
130
+ if ($[34] !== disabled || $[35] !== isRunning || $[36] !== onStop || $[37] !== onValueChange || $[38] !== t12 || $[39] !== value) {
131
+ t13 = {
132
+ value,
133
+ onValueChange,
134
+ isRunning,
135
+ disabled,
136
+ onStop,
137
+ disclaimerId: t12
138
+ };
139
+ $[34] = disabled;
140
+ $[35] = isRunning;
141
+ $[36] = onStop;
142
+ $[37] = onValueChange;
143
+ $[38] = t12;
144
+ $[39] = value;
145
+ $[40] = t13;
146
+ } else t13 = $[40];
147
+ let t14;
148
+ if ($[41] !== box || $[42] !== context || $[43] !== hasContext || $[44] !== slotTestId) {
149
+ t14 = hasContext ? /*#__PURE__*/ jsxs("div", {
150
+ "data-slot": "chat-input-context",
151
+ "data-testid": slotTestId("context"),
152
+ className: chatInputContextVariants(),
153
+ children: [
154
+ /*#__PURE__*/ jsx("div", {
155
+ className: chatInputContextChipsVariants(),
156
+ children: context
157
+ }),
158
+ box
159
+ ]
160
+ }) : box;
161
+ $[41] = box;
162
+ $[42] = context;
163
+ $[43] = hasContext;
164
+ $[44] = slotTestId;
165
+ $[45] = t14;
166
+ } else t14 = $[45];
167
+ let t15;
168
+ if ($[46] !== t14 || $[47] !== testId) {
169
+ t15 = /*#__PURE__*/ jsx(TestIdProvider, {
170
+ value: testId,
171
+ children: t14
172
+ });
173
+ $[46] = t14;
174
+ $[47] = testId;
175
+ $[48] = t15;
176
+ } else t15 = $[48];
177
+ let t16;
178
+ if ($[49] !== t13 || $[50] !== t15) {
179
+ t16 = /*#__PURE__*/ jsx(ChatInputContext.Provider, {
180
+ value: t13,
181
+ children: t15
182
+ });
183
+ $[49] = t13;
184
+ $[50] = t15;
185
+ $[51] = t16;
186
+ } else t16 = $[51];
187
+ let t17;
188
+ if ($[52] !== disclaimer || $[53] !== disclaimerDomId || $[54] !== hasDisclaimer || $[55] !== slotTestId) {
189
+ t17 = hasDisclaimer && /*#__PURE__*/ jsx("p", {
190
+ id: disclaimerDomId,
191
+ "data-slot": "chat-input-disclaimer",
192
+ "data-testid": slotTestId("disclaimer"),
193
+ className: chatInputDisclaimerVariants(),
194
+ children: disclaimer
195
+ });
196
+ $[52] = disclaimer;
197
+ $[53] = disclaimerDomId;
198
+ $[54] = hasDisclaimer;
199
+ $[55] = slotTestId;
200
+ $[56] = t17;
201
+ } else t17 = $[56];
202
+ let t18;
203
+ if ($[57] !== handleSubmit || $[58] !== ref || $[59] !== rest || $[60] !== t10 || $[61] !== t11 || $[62] !== t16 || $[63] !== t17 || $[64] !== testId) {
204
+ t18 = /*#__PURE__*/ jsxs("form", {
205
+ ...rest,
206
+ ref: ref,
207
+ onSubmit: handleSubmit,
208
+ "aria-disabled": t10,
209
+ "data-slot": "chat-input",
210
+ "data-testid": testId,
211
+ className: t11,
212
+ children: [
213
+ t16,
214
+ t17
215
+ ]
216
+ });
217
+ $[57] = handleSubmit;
218
+ $[58] = ref;
219
+ $[59] = rest;
220
+ $[60] = t10;
221
+ $[61] = t11;
222
+ $[62] = t16;
223
+ $[63] = t17;
224
+ $[64] = testId;
225
+ $[65] = t18;
226
+ } else t18 = $[65];
227
+ return t18;
228
+ };
229
+ ChatInput.displayName = "ChatInput";
230
+ export { ChatInput };
@@ -0,0 +1,11 @@
1
+ export interface ChatInputContextValue {
2
+ value: string;
3
+ onValueChange: (value: string) => void;
4
+ isRunning: boolean;
5
+ disabled: boolean;
6
+ onStop?: () => void;
7
+ /** Present only while the disclaimer is rendered. */
8
+ disclaimerId?: string;
9
+ }
10
+ export declare const ChatInputContext: import("react").Context<ChatInputContextValue | null>;
11
+ export declare const useChatInputContext: () => ChatInputContextValue;
@@ -0,0 +1,8 @@
1
+ import { createContext, useContext } from "react";
2
+ const ChatInputContext = createContext(null);
3
+ const useChatInputContext = ()=>{
4
+ const context = useContext(ChatInputContext);
5
+ if (!context) throw new Error("ChatInput parts must be rendered inside <ChatInput>");
6
+ return context;
7
+ };
8
+ export { ChatInputContext, useChatInputContext };
@@ -0,0 +1,10 @@
1
+ import { type ButtonHTMLAttributes, type FC, type Ref } from 'react';
2
+ import { type TestableProps } from '../../utils/testId.js';
3
+ export interface ChatInputSubmitProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'type' | 'children' | 'color'>, TestableProps {
4
+ ref?: Ref<HTMLButtonElement>;
5
+ /** Accessible name while idle. */
6
+ sendLabel?: string;
7
+ /** Accessible name and tooltip while `isRunning`. */
8
+ stopLabel?: string;
9
+ }
10
+ export declare const ChatInputSubmit: FC<ChatInputSubmitProps>;