@gram-ai/elements 1.12.0 → 1.13.1

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.
package/dist/index.d.ts CHANGED
@@ -4,3 +4,4 @@ export { Chat } from './components/Chat';
4
4
  export { ToolUI, ToolUISection } from './components/ui/tool-ui';
5
5
  export type { ToolUIProps, ToolUISectionProps, ToolStatus, } from './components/ui/tool-ui';
6
6
  export type { ElementsConfig, ComposerConfig, AttachmentsConfig, ModalConfig, SidecarConfig, ToolsConfig, ModelConfig, ThemeConfig, WelcomeConfig, Suggestion, Model, ModalTriggerPosition, ColorScheme, Radius, Density, Variant, } from './types';
7
+ export type { Plugin } from './types/plugins';
@@ -1,6 +1,6 @@
1
1
  import { MODELS } from '../lib/models';
2
- import { ToolCallMessagePartComponent } from '@assistant-ui/react';
3
- import { Dispatch, SetStateAction, ReactNode } from 'react';
2
+ import { ImageMessagePartComponent, ReasoningGroupComponent, ReasoningMessagePartComponent, TextMessagePartComponent, ToolCallMessagePartComponent } from '@assistant-ui/react';
3
+ import { ComponentType, Dispatch, PropsWithChildren, SetStateAction, ReactNode } from 'react';
4
4
  import { Plugin } from './plugins';
5
5
  export interface ElementsProviderProps {
6
6
  /**
@@ -20,7 +20,13 @@ export interface ElementsConfig {
20
20
  * The system prompt to use for the Elements library.
21
21
  */
22
22
  systemPrompt?: string;
23
+ /**
24
+ * Any plugins to use for the Elements library.
25
+ *
26
+ * @default import { recommended } from '@gram-ai/elements/plugins'
27
+ */
23
28
  plugins?: Plugin[];
29
+ components?: ComponentOverrides;
24
30
  /**
25
31
  * The project slug to use for the Elements library.
26
32
  */
@@ -155,6 +161,57 @@ export interface ThemeConfig {
155
161
  */
156
162
  radius?: Radius;
157
163
  }
164
+ export interface ComponentOverrides {
165
+ /**
166
+ * The component to use for the composer (the input area where users type messages)
167
+ */
168
+ Composer?: ComponentType;
169
+ /**
170
+ * The component to use for the user message.
171
+ */
172
+ UserMessage?: ComponentType;
173
+ /**
174
+ * The component to use for the edit composer (inline message editor)
175
+ */
176
+ EditComposer?: ComponentType;
177
+ /**
178
+ * The component to use for the assistant message (messages generated by the LLM).
179
+ *
180
+ * Note: if you override this, the Text component will not be used.
181
+ */
182
+ AssistantMessage?: ComponentType;
183
+ /**
184
+ * The component to use for the thread welcome.
185
+ */
186
+ ThreadWelcome?: ComponentType;
187
+ /**
188
+ * The component to use for the text message.
189
+ */
190
+ Text?: TextMessagePartComponent;
191
+ /**
192
+ * The component to use for the image message.
193
+ */
194
+ Image?: ImageMessagePartComponent;
195
+ /**
196
+ * The component to use for the tool fallback (default UI shown when a tool returns a result).
197
+ */
198
+ ToolFallback?: ToolCallMessagePartComponent;
199
+ /**
200
+ * The component to use for the reasoning message.
201
+ */
202
+ Reasoning?: ReasoningMessagePartComponent;
203
+ /**
204
+ * The component to use for the reasoning group.
205
+ */
206
+ ReasoningGroup?: ReasoningGroupComponent;
207
+ /**
208
+ * The component to use for the tool group (a group of tool calls returned by the LLM in a single message).
209
+ */
210
+ ToolGroup?: ComponentType<PropsWithChildren<{
211
+ startIndex: number;
212
+ endIndex: number;
213
+ }>>;
214
+ }
158
215
  /**
159
216
  * ToolsConfig is used to configure tool support in the Elements library.
160
217
  * At the moment, you can override the default React components used by
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@gram-ai/elements",
3
3
  "description": "Gram Elements is a library of UI primitives for building chat-like experiences for MCP Servers.",
4
4
  "type": "module",
5
- "version": "1.12.0",
5
+ "version": "1.13.1",
6
6
  "main": "dist/index.js",
7
7
  "exports": {
8
8
  ".": {