@useatlas/react 0.0.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/README.md +95 -0
- package/dist/chunk-2WFDP7G5.js +231 -0
- package/dist/chunk-2WFDP7G5.js.map +1 -0
- package/dist/chunk-44HBZYKP.js +224 -0
- package/dist/chunk-44HBZYKP.js.map +1 -0
- package/dist/chunk-5SEVKHS5.cjs +229 -0
- package/dist/chunk-5SEVKHS5.cjs.map +1 -0
- package/dist/chunk-UIRB6L36.cjs +249 -0
- package/dist/chunk-UIRB6L36.cjs.map +1 -0
- package/dist/hooks.cjs +251 -0
- package/dist/hooks.cjs.map +1 -0
- package/dist/hooks.d.cts +132 -0
- package/dist/hooks.d.ts +132 -0
- package/dist/hooks.js +237 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.cjs +2976 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +69 -0
- package/dist/index.d.ts +69 -0
- package/dist/index.js +2926 -0
- package/dist/index.js.map +1 -0
- package/dist/result-chart-NFAJ4IQ5.js +398 -0
- package/dist/result-chart-NFAJ4IQ5.js.map +1 -0
- package/dist/result-chart-YLCKBNV4.cjs +400 -0
- package/dist/result-chart-YLCKBNV4.cjs.map +1 -0
- package/dist/styles.css +59 -0
- package/dist/use-dark-mode-rFxawUv1.d.cts +123 -0
- package/dist/use-dark-mode-rFxawUv1.d.ts +123 -0
- package/dist/widget.css +2 -0
- package/dist/widget.js +445 -0
- package/package.json +113 -0
- package/src/components/__tests__/tool-renderers.test.tsx +239 -0
- package/src/components/actions/action-approval-card.tsx +296 -0
- package/src/components/actions/action-status-badge.tsx +50 -0
- package/src/components/admin/change-password-dialog.tsx +128 -0
- package/src/components/atlas-chat.tsx +656 -0
- package/src/components/chart/chart-detection.ts +318 -0
- package/src/components/chart/result-chart.tsx +590 -0
- package/src/components/chat/api-key-bar.tsx +66 -0
- package/src/components/chat/copy-button.tsx +25 -0
- package/src/components/chat/data-table.tsx +104 -0
- package/src/components/chat/error-banner.tsx +32 -0
- package/src/components/chat/explore-card.tsx +41 -0
- package/src/components/chat/follow-up-chips.tsx +29 -0
- package/src/components/chat/loading-card.tsx +10 -0
- package/src/components/chat/managed-auth-card.tsx +116 -0
- package/src/components/chat/markdown.tsx +146 -0
- package/src/components/chat/python-result-card.tsx +245 -0
- package/src/components/chat/sql-block.tsx +54 -0
- package/src/components/chat/sql-result-card.tsx +163 -0
- package/src/components/chat/starter-prompts.ts +6 -0
- package/src/components/chat/tool-part.tsx +106 -0
- package/src/components/chat/typing-indicator.tsx +22 -0
- package/src/components/conversations/conversation-item.tsx +135 -0
- package/src/components/conversations/conversation-list.tsx +69 -0
- package/src/components/conversations/conversation-sidebar.tsx +113 -0
- package/src/components/conversations/delete-confirmation.tsx +27 -0
- package/src/components/schema-explorer/schema-explorer.tsx +517 -0
- package/src/components/ui/alert-dialog.tsx +196 -0
- package/src/components/ui/badge.tsx +48 -0
- package/src/components/ui/button.tsx +64 -0
- package/src/components/ui/card.tsx +92 -0
- package/src/components/ui/dialog.tsx +158 -0
- package/src/components/ui/dropdown-menu.tsx +257 -0
- package/src/components/ui/input.tsx +21 -0
- package/src/components/ui/label.tsx +24 -0
- package/src/components/ui/scroll-area.tsx +62 -0
- package/src/components/ui/separator.tsx +28 -0
- package/src/components/ui/sheet.tsx +143 -0
- package/src/components/ui/table.tsx +116 -0
- package/src/components/ui/toggle-group.tsx +83 -0
- package/src/components/ui/toggle.tsx +47 -0
- package/src/context.tsx +85 -0
- package/src/env.d.ts +9 -0
- package/src/hooks/__tests__/provider.test.tsx +83 -0
- package/src/hooks/__tests__/use-atlas-auth.test.tsx +283 -0
- package/src/hooks/__tests__/use-atlas-chat.test.tsx +157 -0
- package/src/hooks/__tests__/use-atlas-conversations.test.tsx +159 -0
- package/src/hooks/__tests__/use-atlas-theme.test.tsx +56 -0
- package/src/hooks/index.ts +47 -0
- package/src/hooks/provider.tsx +77 -0
- package/src/hooks/theme-init-script.ts +17 -0
- package/src/hooks/use-atlas-auth.ts +131 -0
- package/src/hooks/use-atlas-chat.ts +102 -0
- package/src/hooks/use-atlas-conversations.ts +61 -0
- package/src/hooks/use-atlas-theme.ts +34 -0
- package/src/hooks/use-conversations.ts +189 -0
- package/src/hooks/use-dark-mode.ts +150 -0
- package/src/index.ts +36 -0
- package/src/lib/action-types.ts +11 -0
- package/src/lib/helpers.ts +198 -0
- package/src/lib/tool-renderer-types.ts +76 -0
- package/src/lib/types.ts +29 -0
- package/src/lib/utils.ts +6 -0
- package/src/styles.css +59 -0
- package/src/test-setup.ts +55 -0
- package/src/widget-entry.ts +20 -0
- package/src/widget.css +12 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { T as ThemeMode, A as AtlasAuthClient, a as ToolRenderers } from './use-dark-mode-rFxawUv1.cjs';
|
|
3
|
+
export { b as AtlasUIConfig, c as AtlasUIProvider, E as ExploreToolResult, P as PythonToolResult, S as SQLToolResult, d as ToolRendererProps, s as setTheme, u as useAtlasConfig } from './use-dark-mode-rFxawUv1.cjs';
|
|
4
|
+
import { Conversation } from '@useatlas/types';
|
|
5
|
+
export { AUTH_MODES, AuthMode, ChatErrorCode, ChatErrorInfo, Conversation, ConversationWithMessages, Message } from '@useatlas/types';
|
|
6
|
+
export { parseChatError } from '@useatlas/types/errors';
|
|
7
|
+
import { UIMessage } from '@ai-sdk/react';
|
|
8
|
+
import 'react';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Blocking inline script for layout.tsx — prevents dark-mode flash on load.
|
|
12
|
+
*
|
|
13
|
+
* This file intentionally has NO "use client" directive so it can be imported
|
|
14
|
+
* by server components (layout.tsx). The storage key must stay in sync with
|
|
15
|
+
* use-dark-mode.ts.
|
|
16
|
+
*/
|
|
17
|
+
declare const THEME_STORAGE_KEY = "atlas-theme";
|
|
18
|
+
/**
|
|
19
|
+
* Returns the inline script string for the blocking `<script>` in layout.tsx.
|
|
20
|
+
* Reads atlas-theme from localStorage and sets the `dark` class before first paint.
|
|
21
|
+
*/
|
|
22
|
+
declare function buildThemeInitScript(): string;
|
|
23
|
+
|
|
24
|
+
interface AtlasChatProps {
|
|
25
|
+
/** Atlas API server URL (e.g. "https://api.example.com" or "" for same-origin). */
|
|
26
|
+
apiUrl: string;
|
|
27
|
+
/** API key for simple-key auth mode. When provided, sent as Bearer token. */
|
|
28
|
+
apiKey?: string;
|
|
29
|
+
/** Theme preference. Defaults to "system". */
|
|
30
|
+
theme?: ThemeMode;
|
|
31
|
+
/** Enable conversation history sidebar. Defaults to false. */
|
|
32
|
+
sidebar?: boolean;
|
|
33
|
+
/** Enable schema explorer button. Defaults to false. */
|
|
34
|
+
schemaExplorer?: boolean;
|
|
35
|
+
/** Custom auth client for managed auth mode. */
|
|
36
|
+
authClient?: AtlasAuthClient;
|
|
37
|
+
/** Custom renderers for tool results. Keys are tool names (e.g. "executeSQL", "explore", "executePython"). */
|
|
38
|
+
toolRenderers?: ToolRenderers;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Standalone Atlas chat component.
|
|
42
|
+
*
|
|
43
|
+
* Wraps itself in AtlasUIProvider so consumers only need to pass props.
|
|
44
|
+
* For advanced usage (e.g. custom auth client), pass `authClient`.
|
|
45
|
+
*/
|
|
46
|
+
declare function AtlasChat(props: AtlasChatProps): react_jsx_runtime.JSX.Element;
|
|
47
|
+
|
|
48
|
+
interface UseConversationsOptions {
|
|
49
|
+
apiUrl: string;
|
|
50
|
+
enabled: boolean;
|
|
51
|
+
getHeaders: () => Record<string, string>;
|
|
52
|
+
getCredentials: () => RequestCredentials;
|
|
53
|
+
}
|
|
54
|
+
interface UseConversationsReturn {
|
|
55
|
+
conversations: Conversation[];
|
|
56
|
+
total: number;
|
|
57
|
+
loading: boolean;
|
|
58
|
+
available: boolean;
|
|
59
|
+
selectedId: string | null;
|
|
60
|
+
setSelectedId: (id: string | null) => void;
|
|
61
|
+
fetchList: () => Promise<void>;
|
|
62
|
+
loadConversation: (id: string) => Promise<UIMessage[] | null>;
|
|
63
|
+
deleteConversation: (id: string) => Promise<boolean>;
|
|
64
|
+
starConversation: (id: string, starred: boolean) => Promise<boolean>;
|
|
65
|
+
refresh: () => Promise<void>;
|
|
66
|
+
}
|
|
67
|
+
declare function useConversations(opts: UseConversationsOptions): UseConversationsReturn;
|
|
68
|
+
|
|
69
|
+
export { AtlasAuthClient, AtlasChat, type AtlasChatProps, THEME_STORAGE_KEY, ThemeMode, ToolRenderers, type UseConversationsOptions, type UseConversationsReturn, buildThemeInitScript, useConversations };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { T as ThemeMode, A as AtlasAuthClient, a as ToolRenderers } from './use-dark-mode-rFxawUv1.js';
|
|
3
|
+
export { b as AtlasUIConfig, c as AtlasUIProvider, E as ExploreToolResult, P as PythonToolResult, S as SQLToolResult, d as ToolRendererProps, s as setTheme, u as useAtlasConfig } from './use-dark-mode-rFxawUv1.js';
|
|
4
|
+
import { Conversation } from '@useatlas/types';
|
|
5
|
+
export { AUTH_MODES, AuthMode, ChatErrorCode, ChatErrorInfo, Conversation, ConversationWithMessages, Message } from '@useatlas/types';
|
|
6
|
+
export { parseChatError } from '@useatlas/types/errors';
|
|
7
|
+
import { UIMessage } from '@ai-sdk/react';
|
|
8
|
+
import 'react';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Blocking inline script for layout.tsx — prevents dark-mode flash on load.
|
|
12
|
+
*
|
|
13
|
+
* This file intentionally has NO "use client" directive so it can be imported
|
|
14
|
+
* by server components (layout.tsx). The storage key must stay in sync with
|
|
15
|
+
* use-dark-mode.ts.
|
|
16
|
+
*/
|
|
17
|
+
declare const THEME_STORAGE_KEY = "atlas-theme";
|
|
18
|
+
/**
|
|
19
|
+
* Returns the inline script string for the blocking `<script>` in layout.tsx.
|
|
20
|
+
* Reads atlas-theme from localStorage and sets the `dark` class before first paint.
|
|
21
|
+
*/
|
|
22
|
+
declare function buildThemeInitScript(): string;
|
|
23
|
+
|
|
24
|
+
interface AtlasChatProps {
|
|
25
|
+
/** Atlas API server URL (e.g. "https://api.example.com" or "" for same-origin). */
|
|
26
|
+
apiUrl: string;
|
|
27
|
+
/** API key for simple-key auth mode. When provided, sent as Bearer token. */
|
|
28
|
+
apiKey?: string;
|
|
29
|
+
/** Theme preference. Defaults to "system". */
|
|
30
|
+
theme?: ThemeMode;
|
|
31
|
+
/** Enable conversation history sidebar. Defaults to false. */
|
|
32
|
+
sidebar?: boolean;
|
|
33
|
+
/** Enable schema explorer button. Defaults to false. */
|
|
34
|
+
schemaExplorer?: boolean;
|
|
35
|
+
/** Custom auth client for managed auth mode. */
|
|
36
|
+
authClient?: AtlasAuthClient;
|
|
37
|
+
/** Custom renderers for tool results. Keys are tool names (e.g. "executeSQL", "explore", "executePython"). */
|
|
38
|
+
toolRenderers?: ToolRenderers;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Standalone Atlas chat component.
|
|
42
|
+
*
|
|
43
|
+
* Wraps itself in AtlasUIProvider so consumers only need to pass props.
|
|
44
|
+
* For advanced usage (e.g. custom auth client), pass `authClient`.
|
|
45
|
+
*/
|
|
46
|
+
declare function AtlasChat(props: AtlasChatProps): react_jsx_runtime.JSX.Element;
|
|
47
|
+
|
|
48
|
+
interface UseConversationsOptions {
|
|
49
|
+
apiUrl: string;
|
|
50
|
+
enabled: boolean;
|
|
51
|
+
getHeaders: () => Record<string, string>;
|
|
52
|
+
getCredentials: () => RequestCredentials;
|
|
53
|
+
}
|
|
54
|
+
interface UseConversationsReturn {
|
|
55
|
+
conversations: Conversation[];
|
|
56
|
+
total: number;
|
|
57
|
+
loading: boolean;
|
|
58
|
+
available: boolean;
|
|
59
|
+
selectedId: string | null;
|
|
60
|
+
setSelectedId: (id: string | null) => void;
|
|
61
|
+
fetchList: () => Promise<void>;
|
|
62
|
+
loadConversation: (id: string) => Promise<UIMessage[] | null>;
|
|
63
|
+
deleteConversation: (id: string) => Promise<boolean>;
|
|
64
|
+
starConversation: (id: string, starred: boolean) => Promise<boolean>;
|
|
65
|
+
refresh: () => Promise<void>;
|
|
66
|
+
}
|
|
67
|
+
declare function useConversations(opts: UseConversationsOptions): UseConversationsReturn;
|
|
68
|
+
|
|
69
|
+
export { AtlasAuthClient, AtlasChat, type AtlasChatProps, THEME_STORAGE_KEY, ThemeMode, ToolRenderers, type UseConversationsOptions, type UseConversationsReturn, buildThemeInitScript, useConversations };
|