@data-club/ai-hub 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/dist/auth/passwordPolicy.d.ts +55 -0
- package/dist/auth/passwordPolicy.d.ts.map +1 -0
- package/dist/auth/passwordPolicy.js +63 -0
- package/dist/auth/passwordPolicy.js.map +1 -0
- package/dist/auth/texts.d.ts +815 -0
- package/dist/auth/texts.d.ts.map +1 -0
- package/dist/auth/texts.js +429 -0
- package/dist/auth/texts.js.map +1 -0
- package/dist/client/AIHubClient.d.ts +1058 -0
- package/dist/client/AIHubClient.d.ts.map +1 -0
- package/dist/client/AIHubClient.js +950 -0
- package/dist/client/AIHubClient.js.map +1 -0
- package/dist/client/index.d.ts +11 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +9 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/sseParser.d.ts +41 -0
- package/dist/client/sseParser.d.ts.map +1 -0
- package/dist/client/sseParser.js +153 -0
- package/dist/client/sseParser.js.map +1 -0
- package/dist/client/tokenStorage.d.ts +56 -0
- package/dist/client/tokenStorage.d.ts.map +1 -0
- package/dist/client/tokenStorage.js +116 -0
- package/dist/client/tokenStorage.js.map +1 -0
- package/dist/components/AgentsPicker/index.d.ts +70 -0
- package/dist/components/AgentsPicker/index.d.ts.map +1 -0
- package/dist/components/AgentsPicker/index.js +63 -0
- package/dist/components/AgentsPicker/index.js.map +1 -0
- package/dist/components/AuthGate/index.d.ts +79 -0
- package/dist/components/AuthGate/index.d.ts.map +1 -0
- package/dist/components/AuthGate/index.js +61 -0
- package/dist/components/AuthGate/index.js.map +1 -0
- package/dist/components/CacheBadge/index.d.ts +88 -0
- package/dist/components/CacheBadge/index.d.ts.map +1 -0
- package/dist/components/CacheBadge/index.js +127 -0
- package/dist/components/CacheBadge/index.js.map +1 -0
- package/dist/components/ChangePassword/index.d.ts +109 -0
- package/dist/components/ChangePassword/index.d.ts.map +1 -0
- package/dist/components/ChangePassword/index.js +142 -0
- package/dist/components/ChangePassword/index.js.map +1 -0
- package/dist/components/ChatShell/ShellHeader.d.ts +44 -0
- package/dist/components/ChatShell/ShellHeader.d.ts.map +1 -0
- package/dist/components/ChatShell/ShellHeader.js +14 -0
- package/dist/components/ChatShell/ShellHeader.js.map +1 -0
- package/dist/components/ChatShell/UserMenu.d.ts +48 -0
- package/dist/components/ChatShell/UserMenu.d.ts.map +1 -0
- package/dist/components/ChatShell/UserMenu.js +86 -0
- package/dist/components/ChatShell/UserMenu.js.map +1 -0
- package/dist/components/ChatShell/index.d.ts +98 -0
- package/dist/components/ChatShell/index.d.ts.map +1 -0
- package/dist/components/ChatShell/index.js +124 -0
- package/dist/components/ChatShell/index.js.map +1 -0
- package/dist/components/DataClubAIHub/index.d.ts +132 -0
- package/dist/components/DataClubAIHub/index.d.ts.map +1 -0
- package/dist/components/DataClubAIHub/index.js +124 -0
- package/dist/components/DataClubAIHub/index.js.map +1 -0
- package/dist/components/DataClubAIHubAdmin/AgentEditorModal.d.ts +89 -0
- package/dist/components/DataClubAIHubAdmin/AgentEditorModal.d.ts.map +1 -0
- package/dist/components/DataClubAIHubAdmin/AgentEditorModal.js +199 -0
- package/dist/components/DataClubAIHubAdmin/AgentEditorModal.js.map +1 -0
- package/dist/components/DataClubAIHubAdmin/AgentsPage.d.ts +33 -0
- package/dist/components/DataClubAIHubAdmin/AgentsPage.d.ts.map +1 -0
- package/dist/components/DataClubAIHubAdmin/AgentsPage.js +137 -0
- package/dist/components/DataClubAIHubAdmin/AgentsPage.js.map +1 -0
- package/dist/components/DataClubAIHubAdmin/CreateUserModal.d.ts +50 -0
- package/dist/components/DataClubAIHubAdmin/CreateUserModal.d.ts.map +1 -0
- package/dist/components/DataClubAIHubAdmin/CreateUserModal.js +93 -0
- package/dist/components/DataClubAIHubAdmin/CreateUserModal.js.map +1 -0
- package/dist/components/DataClubAIHubAdmin/PasswordRevealModal.d.ts +49 -0
- package/dist/components/DataClubAIHubAdmin/PasswordRevealModal.d.ts.map +1 -0
- package/dist/components/DataClubAIHubAdmin/PasswordRevealModal.js +94 -0
- package/dist/components/DataClubAIHubAdmin/PasswordRevealModal.js.map +1 -0
- package/dist/components/DataClubAIHubAdmin/ResetPasswordModal.d.ts +37 -0
- package/dist/components/DataClubAIHubAdmin/ResetPasswordModal.d.ts.map +1 -0
- package/dist/components/DataClubAIHubAdmin/ResetPasswordModal.js +44 -0
- package/dist/components/DataClubAIHubAdmin/ResetPasswordModal.js.map +1 -0
- package/dist/components/DataClubAIHubAdmin/RotatingMessageEditorModal.d.ts +56 -0
- package/dist/components/DataClubAIHubAdmin/RotatingMessageEditorModal.d.ts.map +1 -0
- package/dist/components/DataClubAIHubAdmin/RotatingMessageEditorModal.js +158 -0
- package/dist/components/DataClubAIHubAdmin/RotatingMessageEditorModal.js.map +1 -0
- package/dist/components/DataClubAIHubAdmin/RotatingMessagesPage.d.ts +29 -0
- package/dist/components/DataClubAIHubAdmin/RotatingMessagesPage.d.ts.map +1 -0
- package/dist/components/DataClubAIHubAdmin/RotatingMessagesPage.js +183 -0
- package/dist/components/DataClubAIHubAdmin/RotatingMessagesPage.js.map +1 -0
- package/dist/components/DataClubAIHubAdmin/SessionsOverviewPage.d.ts +38 -0
- package/dist/components/DataClubAIHubAdmin/SessionsOverviewPage.d.ts.map +1 -0
- package/dist/components/DataClubAIHubAdmin/SessionsOverviewPage.js +294 -0
- package/dist/components/DataClubAIHubAdmin/SessionsOverviewPage.js.map +1 -0
- package/dist/components/DataClubAIHubAdmin/SettingsPage.d.ts +36 -0
- package/dist/components/DataClubAIHubAdmin/SettingsPage.d.ts.map +1 -0
- package/dist/components/DataClubAIHubAdmin/SettingsPage.js +373 -0
- package/dist/components/DataClubAIHubAdmin/SettingsPage.js.map +1 -0
- package/dist/components/DataClubAIHubAdmin/UsersPage.d.ts +47 -0
- package/dist/components/DataClubAIHubAdmin/UsersPage.d.ts.map +1 -0
- package/dist/components/DataClubAIHubAdmin/UsersPage.js +233 -0
- package/dist/components/DataClubAIHubAdmin/UsersPage.js.map +1 -0
- package/dist/components/DataClubAIHubAdmin/index.d.ts +87 -0
- package/dist/components/DataClubAIHubAdmin/index.d.ts.map +1 -0
- package/dist/components/DataClubAIHubAdmin/index.js +137 -0
- package/dist/components/DataClubAIHubAdmin/index.js.map +1 -0
- package/dist/components/DataClubAIHubLogin/index.d.ts +113 -0
- package/dist/components/DataClubAIHubLogin/index.d.ts.map +1 -0
- package/dist/components/DataClubAIHubLogin/index.js +123 -0
- package/dist/components/DataClubAIHubLogin/index.js.map +1 -0
- package/dist/components/EffortControl/index.d.ts +57 -0
- package/dist/components/EffortControl/index.d.ts.map +1 -0
- package/dist/components/EffortControl/index.js +84 -0
- package/dist/components/EffortControl/index.js.map +1 -0
- package/dist/components/Layout/index.d.ts +63 -0
- package/dist/components/Layout/index.d.ts.map +1 -0
- package/dist/components/Layout/index.js +45 -0
- package/dist/components/Layout/index.js.map +1 -0
- package/dist/components/MainColumn/index.d.ts +69 -0
- package/dist/components/MainColumn/index.d.ts.map +1 -0
- package/dist/components/MainColumn/index.js +47 -0
- package/dist/components/MainColumn/index.js.map +1 -0
- package/dist/components/MarkdownRenderer/index.d.ts +66 -0
- package/dist/components/MarkdownRenderer/index.d.ts.map +1 -0
- package/dist/components/MarkdownRenderer/index.js +153 -0
- package/dist/components/MarkdownRenderer/index.js.map +1 -0
- package/dist/components/MessageInput/index.d.ts +85 -0
- package/dist/components/MessageInput/index.d.ts.map +1 -0
- package/dist/components/MessageInput/index.js +139 -0
- package/dist/components/MessageInput/index.js.map +1 -0
- package/dist/components/MessageList/index.d.ts +156 -0
- package/dist/components/MessageList/index.d.ts.map +1 -0
- package/dist/components/MessageList/index.js +352 -0
- package/dist/components/MessageList/index.js.map +1 -0
- package/dist/components/ReasoningSelector/index.d.ts +77 -0
- package/dist/components/ReasoningSelector/index.d.ts.map +1 -0
- package/dist/components/ReasoningSelector/index.js +156 -0
- package/dist/components/ReasoningSelector/index.js.map +1 -0
- package/dist/components/ReasoningView/index.d.ts +94 -0
- package/dist/components/ReasoningView/index.d.ts.map +1 -0
- package/dist/components/ReasoningView/index.js +83 -0
- package/dist/components/ReasoningView/index.js.map +1 -0
- package/dist/components/ScrollToPresentButton/index.d.ts +54 -0
- package/dist/components/ScrollToPresentButton/index.d.ts.map +1 -0
- package/dist/components/ScrollToPresentButton/index.js +44 -0
- package/dist/components/ScrollToPresentButton/index.js.map +1 -0
- package/dist/components/SessionsPanel/SessionTitleModal.d.ts +79 -0
- package/dist/components/SessionsPanel/SessionTitleModal.d.ts.map +1 -0
- package/dist/components/SessionsPanel/SessionTitleModal.js +102 -0
- package/dist/components/SessionsPanel/SessionTitleModal.js.map +1 -0
- package/dist/components/SessionsPanel/index.d.ts +100 -0
- package/dist/components/SessionsPanel/index.d.ts.map +1 -0
- package/dist/components/SessionsPanel/index.js +176 -0
- package/dist/components/SessionsPanel/index.js.map +1 -0
- package/dist/components/SystemNotice/index.d.ts +66 -0
- package/dist/components/SystemNotice/index.d.ts.map +1 -0
- package/dist/components/SystemNotice/index.js +81 -0
- package/dist/components/SystemNotice/index.js.map +1 -0
- package/dist/components/ThemeSwitcher/index.d.ts +66 -0
- package/dist/components/ThemeSwitcher/index.d.ts.map +1 -0
- package/dist/components/ThemeSwitcher/index.js +73 -0
- package/dist/components/ThemeSwitcher/index.js.map +1 -0
- package/dist/components/ToolCallView/formatContent.d.ts +36 -0
- package/dist/components/ToolCallView/formatContent.d.ts.map +1 -0
- package/dist/components/ToolCallView/formatContent.js +53 -0
- package/dist/components/ToolCallView/formatContent.js.map +1 -0
- package/dist/components/ToolCallView/index.d.ts +120 -0
- package/dist/components/ToolCallView/index.d.ts.map +1 -0
- package/dist/components/ToolCallView/index.js +104 -0
- package/dist/components/ToolCallView/index.js.map +1 -0
- package/dist/components/TpmBanner/index.d.ts +53 -0
- package/dist/components/TpmBanner/index.d.ts.map +1 -0
- package/dist/components/TpmBanner/index.js +116 -0
- package/dist/components/TpmBanner/index.js.map +1 -0
- package/dist/components/TurnStatusIndicator/index.d.ts +77 -0
- package/dist/components/TurnStatusIndicator/index.d.ts.map +1 -0
- package/dist/components/TurnStatusIndicator/index.js +122 -0
- package/dist/components/TurnStatusIndicator/index.js.map +1 -0
- package/dist/components/internal/PasswordInput.d.ts +62 -0
- package/dist/components/internal/PasswordInput.d.ts.map +1 -0
- package/dist/components/internal/PasswordInput.js +42 -0
- package/dist/components/internal/PasswordInput.js.map +1 -0
- package/dist/context/AIHubContext.d.ts +220 -0
- package/dist/context/AIHubContext.d.ts.map +1 -0
- package/dist/context/AIHubContext.js +19 -0
- package/dist/context/AIHubContext.js.map +1 -0
- package/dist/context/AIHubProvider.d.ts +75 -0
- package/dist/context/AIHubProvider.d.ts.map +1 -0
- package/dist/context/AIHubProvider.js +954 -0
- package/dist/context/AIHubProvider.js.map +1 -0
- package/dist/context/index.d.ts +9 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +9 -0
- package/dist/context/index.js.map +1 -0
- package/dist/context/theme.d.ts +43 -0
- package/dist/context/theme.d.ts.map +1 -0
- package/dist/context/theme.js +70 -0
- package/dist/context/theme.js.map +1 -0
- package/dist/context/useAIHub.d.ts +104 -0
- package/dist/context/useAIHub.d.ts.map +1 -0
- package/dist/context/useAIHub.js +63 -0
- package/dist/context/useAIHub.js.map +1 -0
- package/dist/context/useAIHubAuth.d.ts +44 -0
- package/dist/context/useAIHubAuth.d.ts.map +1 -0
- package/dist/context/useAIHubAuth.js +35 -0
- package/dist/context/useAIHubAuth.js.map +1 -0
- package/dist/index.d.ts +76 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +57 -0
- package/dist/index.js.map +1 -0
- package/dist/primitives/index.d.ts +99 -0
- package/dist/primitives/index.d.ts.map +1 -0
- package/dist/primitives/index.js +97 -0
- package/dist/primitives/index.js.map +1 -0
- package/dist/state/affordances.d.ts +182 -0
- package/dist/state/affordances.d.ts.map +1 -0
- package/dist/state/affordances.js +189 -0
- package/dist/state/affordances.js.map +1 -0
- package/dist/state/stateReducer.d.ts +72 -0
- package/dist/state/stateReducer.d.ts.map +1 -0
- package/dist/state/stateReducer.js +122 -0
- package/dist/state/stateReducer.js.map +1 -0
- package/dist/stories/EffortControl.stories.d.ts +14 -0
- package/dist/stories/EffortControl.stories.d.ts.map +1 -0
- package/dist/stories/EffortControl.stories.js +43 -0
- package/dist/stories/EffortControl.stories.js.map +1 -0
- package/dist/stories/MarkdownRenderer.stories.d.ts +25 -0
- package/dist/stories/MarkdownRenderer.stories.d.ts.map +1 -0
- package/dist/stories/MarkdownRenderer.stories.js +178 -0
- package/dist/stories/MarkdownRenderer.stories.js.map +1 -0
- package/dist/stories/MessageBubble.stories.d.ts +21 -0
- package/dist/stories/MessageBubble.stories.d.ts.map +1 -0
- package/dist/stories/MessageBubble.stories.js +59 -0
- package/dist/stories/MessageBubble.stories.js.map +1 -0
- package/dist/stories/ReasoningView.stories.d.ts +18 -0
- package/dist/stories/ReasoningView.stories.d.ts.map +1 -0
- package/dist/stories/ReasoningView.stories.js +62 -0
- package/dist/stories/ReasoningView.stories.js.map +1 -0
- package/dist/stories/ScrollToPresentButton.stories.d.ts +18 -0
- package/dist/stories/ScrollToPresentButton.stories.d.ts.map +1 -0
- package/dist/stories/ScrollToPresentButton.stories.js +34 -0
- package/dist/stories/ScrollToPresentButton.stories.js.map +1 -0
- package/dist/stories/SystemNotice.stories.d.ts +17 -0
- package/dist/stories/SystemNotice.stories.d.ts.map +1 -0
- package/dist/stories/SystemNotice.stories.js +42 -0
- package/dist/stories/SystemNotice.stories.js.map +1 -0
- package/dist/stories/ThemeSwitcher.stories.d.ts +15 -0
- package/dist/stories/ThemeSwitcher.stories.d.ts.map +1 -0
- package/dist/stories/ThemeSwitcher.stories.js +35 -0
- package/dist/stories/ThemeSwitcher.stories.js.map +1 -0
- package/dist/stories/ToolCallView.stories.d.ts +20 -0
- package/dist/stories/ToolCallView.stories.d.ts.map +1 -0
- package/dist/stories/ToolCallView.stories.js +65 -0
- package/dist/stories/ToolCallView.stories.js.map +1 -0
- package/dist/stories/TpmBanner.stories.d.ts +24 -0
- package/dist/stories/TpmBanner.stories.d.ts.map +1 -0
- package/dist/stories/TpmBanner.stories.js +63 -0
- package/dist/stories/TpmBanner.stories.js.map +1 -0
- package/dist/stories/TurnStatusIndicator.stories.d.ts +25 -0
- package/dist/stories/TurnStatusIndicator.stories.d.ts.map +1 -0
- package/dist/stories/TurnStatusIndicator.stories.js +56 -0
- package/dist/stories/TurnStatusIndicator.stories.js.map +1 -0
- package/dist/stories/_mockProvider.d.ts +44 -0
- package/dist/stories/_mockProvider.d.ts.map +1 -0
- package/dist/stories/_mockProvider.js +84 -0
- package/dist/stories/_mockProvider.js.map +1 -0
- package/dist/types.d.ts +787 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +19 -0
- package/dist/types.js.map +1 -0
- package/dist/webcomponent/defineWebComponent.d.ts +106 -0
- package/dist/webcomponent/defineWebComponent.d.ts.map +1 -0
- package/dist/webcomponent/defineWebComponent.js +126 -0
- package/dist/webcomponent/defineWebComponent.js.map +1 -0
- package/dist/webcomponent/index.d.ts +7 -0
- package/dist/webcomponent/index.d.ts.map +1 -0
- package/dist/webcomponent/index.js +7 -0
- package/dist/webcomponent/index.js.map +1 -0
- package/package.json +63 -0
- package/src/__lint-canary__/step1-lint-canary.ts.disabled +28 -0
- package/src/auth/passwordPolicy.ts +75 -0
- package/src/auth/texts.ts +1294 -0
- package/src/client/AIHubClient.ts +1718 -0
- package/src/client/index.ts +30 -0
- package/src/client/sseParser.ts +168 -0
- package/src/client/tokenStorage.ts +131 -0
- package/src/components/AgentsPicker/index.tsx +147 -0
- package/src/components/AuthGate/index.tsx +132 -0
- package/src/components/CacheBadge/index.tsx +245 -0
- package/src/components/ChangePassword/index.tsx +375 -0
- package/src/components/ChatShell/ShellHeader.tsx +80 -0
- package/src/components/ChatShell/UserMenu.tsx +196 -0
- package/src/components/ChatShell/index.tsx +307 -0
- package/src/components/DataClubAIHub/index.tsx +300 -0
- package/src/components/DataClubAIHubAdmin/AgentEditorModal.tsx +505 -0
- package/src/components/DataClubAIHubAdmin/AgentsPage.tsx +342 -0
- package/src/components/DataClubAIHubAdmin/CreateUserModal.tsx +214 -0
- package/src/components/DataClubAIHubAdmin/PasswordRevealModal.tsx +204 -0
- package/src/components/DataClubAIHubAdmin/ResetPasswordModal.tsx +122 -0
- package/src/components/DataClubAIHubAdmin/RotatingMessageEditorModal.tsx +408 -0
- package/src/components/DataClubAIHubAdmin/RotatingMessagesPage.tsx +373 -0
- package/src/components/DataClubAIHubAdmin/SessionsOverviewPage.tsx +639 -0
- package/src/components/DataClubAIHubAdmin/SettingsPage.tsx +979 -0
- package/src/components/DataClubAIHubAdmin/UsersPage.tsx +495 -0
- package/src/components/DataClubAIHubAdmin/index.tsx +277 -0
- package/src/components/DataClubAIHubLogin/index.tsx +282 -0
- package/src/components/EffortControl/index.tsx +138 -0
- package/src/components/Layout/index.tsx +92 -0
- package/src/components/MainColumn/index.tsx +131 -0
- package/src/components/MarkdownRenderer/index.tsx +256 -0
- package/src/components/MessageInput/index.tsx +283 -0
- package/src/components/MessageList/index.tsx +753 -0
- package/src/components/ReasoningSelector/index.tsx +268 -0
- package/src/components/ReasoningView/index.tsx +183 -0
- package/src/components/ScrollToPresentButton/index.tsx +85 -0
- package/src/components/SessionsPanel/SessionTitleModal.tsx +256 -0
- package/src/components/SessionsPanel/index.tsx +406 -0
- package/src/components/SystemNotice/index.tsx +151 -0
- package/src/components/ThemeSwitcher/index.tsx +136 -0
- package/src/components/ToolCallView/formatContent.ts +50 -0
- package/src/components/ToolCallView/index.tsx +274 -0
- package/src/components/TpmBanner/index.tsx +172 -0
- package/src/components/TurnStatusIndicator/index.tsx +203 -0
- package/src/components/internal/PasswordInput.tsx +145 -0
- package/src/context/AIHubContext.ts +249 -0
- package/src/context/AIHubProvider.tsx +1084 -0
- package/src/context/index.ts +9 -0
- package/src/context/theme.ts +76 -0
- package/src/context/useAIHub.ts +151 -0
- package/src/context/useAIHubAuth.ts +65 -0
- package/src/index.ts +275 -0
- package/src/primitives/index.ts +101 -0
- package/src/state/affordances.ts +321 -0
- package/src/state/stateReducer.ts +131 -0
- package/src/stories/EffortControl.stories.tsx +63 -0
- package/src/stories/MarkdownRenderer.stories.tsx +201 -0
- package/src/stories/MessageBubble.stories.tsx +101 -0
- package/src/stories/ReasoningView.stories.tsx +81 -0
- package/src/stories/ScrollToPresentButton.stories.tsx +52 -0
- package/src/stories/SystemNotice.stories.tsx +59 -0
- package/src/stories/ThemeSwitcher.stories.tsx +55 -0
- package/src/stories/ToolCallView.stories.tsx +95 -0
- package/src/stories/TpmBanner.stories.tsx +93 -0
- package/src/stories/TurnStatusIndicator.stories.tsx +86 -0
- package/src/stories/_mockProvider.tsx +116 -0
- package/src/styles/CLASSES.md +356 -0
- package/src/styles/default.css +2937 -0
- package/src/types.ts +867 -0
- package/src/webcomponent/defineWebComponent.tsx +193 -0
- package/src/webcomponent/index.ts +11 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<ReasoningView />` — collapsible reasoning block inside an assistant
|
|
3
|
+
* bubble.
|
|
4
|
+
*
|
|
5
|
+
* Default-collapsed (the spec calls this out — reasoning is for "I want
|
|
6
|
+
* to inspect this" UX, not "I want to read it inline by default").
|
|
7
|
+
* Header shows the duration when known; body is rendered in monospace.
|
|
8
|
+
*
|
|
9
|
+
* Step 10 only renders reasoning when:
|
|
10
|
+
*
|
|
11
|
+
* - the turn was sent with a non-`none` effort (i.e. the assistant
|
|
12
|
+
* actually produced a reasoning block), AND
|
|
13
|
+
* - `reasoningVisible` (resolved) is true.
|
|
14
|
+
*
|
|
15
|
+
* The decision about whether reasoning is *present* lives upstream in
|
|
16
|
+
* `MessageList` — this primitive just renders whatever block content +
|
|
17
|
+
* timing it's given.
|
|
18
|
+
*
|
|
19
|
+
* Exported under `AIHub.ReasoningView` (re-exported via the namespace).
|
|
20
|
+
*
|
|
21
|
+
* @see SPECIFICATIONS.md §7.3 — showReasoning prop
|
|
22
|
+
* @see ui-sketches/03-chat.md — reasoning_block --collapsed / --expanded
|
|
23
|
+
*/
|
|
24
|
+
import { type ReactNode } from "react";
|
|
25
|
+
import { type AIHubTexts, type DeepPartial } from "../../auth/texts.js";
|
|
26
|
+
/** BEM class names emitted by `<ReasoningView />`. */
|
|
27
|
+
export interface ReasoningViewClassNames {
|
|
28
|
+
/** Outer block. */
|
|
29
|
+
root: string;
|
|
30
|
+
/** Modifier — `--collapsed`. */
|
|
31
|
+
rootCollapsed: string;
|
|
32
|
+
/** Modifier — `--expanded`. */
|
|
33
|
+
rootExpanded: string;
|
|
34
|
+
/** Header element (always present). */
|
|
35
|
+
header: string;
|
|
36
|
+
/** Title text inside the header. */
|
|
37
|
+
title: string;
|
|
38
|
+
/** Expand/collapse toggle button. */
|
|
39
|
+
toggle: string;
|
|
40
|
+
/** Body element (only mounted when expanded). */
|
|
41
|
+
body: string;
|
|
42
|
+
}
|
|
43
|
+
/** Props for `<ReasoningView />`. */
|
|
44
|
+
export interface ReasoningViewProps {
|
|
45
|
+
/** The reasoning text (possibly empty while deltas are still arriving). */
|
|
46
|
+
content: string;
|
|
47
|
+
/** Wall-clock duration in seconds, when known. */
|
|
48
|
+
durationSeconds?: number;
|
|
49
|
+
/**
|
|
50
|
+
* When true, the block is still streaming — placeholder text is
|
|
51
|
+
* shown instead of an empty body and the duration is omitted.
|
|
52
|
+
*/
|
|
53
|
+
streaming?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Override the initial expanded state. Default false (collapsed). When
|
|
56
|
+
* `streaming` is true the initial state is also false — the user opts
|
|
57
|
+
* in to watch the reasoning live.
|
|
58
|
+
*
|
|
59
|
+
* Ignored when `expanded` is passed (controlled mode).
|
|
60
|
+
*/
|
|
61
|
+
defaultExpanded?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Controlled expanded state. When set, `<ReasoningView />` defers all
|
|
64
|
+
* expand/collapse decisions to the parent — `onToggle` fires on toggle
|
|
65
|
+
* clicks and the parent decides whether the next render should pass
|
|
66
|
+
* `true` or `false`. Used by `<MessageList />` to enforce the
|
|
67
|
+
* accordion + auto-expand-while-streaming rules across all blocks in
|
|
68
|
+
* the conversation. When omitted, the component falls back to internal
|
|
69
|
+
* `useState` for backward compatibility (the original uncontrolled
|
|
70
|
+
* behavior, default-collapsed with a per-instance toggle).
|
|
71
|
+
*/
|
|
72
|
+
expanded?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Toggle handler for the controlled mode. Fires when the user clicks
|
|
75
|
+
* the expand/collapse button. The parent inspects its own accordion
|
|
76
|
+
* state to compute the next `expanded` prop. Ignored in uncontrolled
|
|
77
|
+
* mode (the internal `useState` toggles itself).
|
|
78
|
+
*/
|
|
79
|
+
onToggle?: () => void;
|
|
80
|
+
/** Wrapper-supplied i18n. */
|
|
81
|
+
texts?: DeepPartial<AIHubTexts>;
|
|
82
|
+
/** Extra class merged onto the root. */
|
|
83
|
+
className?: string;
|
|
84
|
+
/** Per-element class overrides. */
|
|
85
|
+
classNames?: Partial<ReasoningViewClassNames>;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Renders the reasoning block.
|
|
89
|
+
*
|
|
90
|
+
* @param props - see `ReasoningViewProps`.
|
|
91
|
+
* @returns the rendered block.
|
|
92
|
+
*/
|
|
93
|
+
export declare function ReasoningView(props: ReasoningViewProps): ReactNode;
|
|
94
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ReasoningView/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEjD,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,WAAW,EACjB,MAAM,qBAAqB,CAAC;AAE7B,sDAAsD;AACtD,MAAM,WAAW,uBAAuB;IACtC,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,gCAAgC;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,+BAA+B;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,uCAAuC;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAC;CACd;AAYD,qCAAqC;AACrC,MAAM,WAAW,kBAAkB;IACjC,2EAA2E;IAC3E,OAAO,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,6BAA6B;IAC7B,KAAK,CAAC,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;IAChC,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mCAAmC;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC,CAAC;CAC/C;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,SAAS,CAuElE"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* `<ReasoningView />` — collapsible reasoning block inside an assistant
|
|
4
|
+
* bubble.
|
|
5
|
+
*
|
|
6
|
+
* Default-collapsed (the spec calls this out — reasoning is for "I want
|
|
7
|
+
* to inspect this" UX, not "I want to read it inline by default").
|
|
8
|
+
* Header shows the duration when known; body is rendered in monospace.
|
|
9
|
+
*
|
|
10
|
+
* Step 10 only renders reasoning when:
|
|
11
|
+
*
|
|
12
|
+
* - the turn was sent with a non-`none` effort (i.e. the assistant
|
|
13
|
+
* actually produced a reasoning block), AND
|
|
14
|
+
* - `reasoningVisible` (resolved) is true.
|
|
15
|
+
*
|
|
16
|
+
* The decision about whether reasoning is *present* lives upstream in
|
|
17
|
+
* `MessageList` — this primitive just renders whatever block content +
|
|
18
|
+
* timing it's given.
|
|
19
|
+
*
|
|
20
|
+
* Exported under `AIHub.ReasoningView` (re-exported via the namespace).
|
|
21
|
+
*
|
|
22
|
+
* @see SPECIFICATIONS.md §7.3 — showReasoning prop
|
|
23
|
+
* @see ui-sketches/03-chat.md — reasoning_block --collapsed / --expanded
|
|
24
|
+
*/
|
|
25
|
+
import { useState } from "react";
|
|
26
|
+
import { resolveAIHubTexts, } from "../../auth/texts.js";
|
|
27
|
+
const DEFAULT_CLASS_NAMES = Object.freeze({
|
|
28
|
+
root: "data-club-ai-hub__reasoning-block",
|
|
29
|
+
rootCollapsed: "data-club-ai-hub__reasoning-block--collapsed",
|
|
30
|
+
rootExpanded: "data-club-ai-hub__reasoning-block--expanded",
|
|
31
|
+
header: "data-club-ai-hub__reasoning-block__header",
|
|
32
|
+
title: "data-club-ai-hub__reasoning-block__title",
|
|
33
|
+
toggle: "data-club-ai-hub__reasoning-block__toggle",
|
|
34
|
+
body: "data-club-ai-hub__reasoning-block__body",
|
|
35
|
+
});
|
|
36
|
+
/**
|
|
37
|
+
* Renders the reasoning block.
|
|
38
|
+
*
|
|
39
|
+
* @param props - see `ReasoningViewProps`.
|
|
40
|
+
* @returns the rendered block.
|
|
41
|
+
*/
|
|
42
|
+
export function ReasoningView(props) {
|
|
43
|
+
const texts = resolveAIHubTexts(props.texts);
|
|
44
|
+
const cls = { ...DEFAULT_CLASS_NAMES, ...(props.classNames ?? {}) };
|
|
45
|
+
const [uncontrolledExpanded, setUncontrolledExpanded] = useState(props.defaultExpanded ?? false);
|
|
46
|
+
const isControlled = props.expanded !== undefined;
|
|
47
|
+
const expanded = isControlled ? props.expanded : uncontrolledExpanded;
|
|
48
|
+
const handleToggle = isControlled
|
|
49
|
+
? props.onToggle ?? (() => { })
|
|
50
|
+
: () => setUncontrolledExpanded((e) => !e);
|
|
51
|
+
const seconds = props.durationSeconds ?? 0;
|
|
52
|
+
// Pick the WITH-duration template only when we actually have a
|
|
53
|
+
// duration to show. Historical bubbles (loaded via `getSessionMessages`)
|
|
54
|
+
// don't carry a duration today, so they render the no-duration variant
|
|
55
|
+
// ("🧠 Reasoning") rather than the awkward "🧠 Reasoning (…s)" we'd
|
|
56
|
+
// get from running the placeholder substitution against zero.
|
|
57
|
+
const hasDuration = seconds > 0;
|
|
58
|
+
let headerText;
|
|
59
|
+
if (hasDuration) {
|
|
60
|
+
const template = expanded
|
|
61
|
+
? texts.chat.reasoningExpandedHeader
|
|
62
|
+
: texts.chat.reasoningCollapsedHeader;
|
|
63
|
+
headerText = template.replace("{seconds}", seconds.toFixed(1));
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
headerText = expanded
|
|
67
|
+
? texts.chat.reasoningExpandedHeaderNoDuration
|
|
68
|
+
: texts.chat.reasoningCollapsedHeaderNoDuration;
|
|
69
|
+
}
|
|
70
|
+
const rootClass = [
|
|
71
|
+
cls.root,
|
|
72
|
+
expanded ? cls.rootExpanded : cls.rootCollapsed,
|
|
73
|
+
props.className,
|
|
74
|
+
]
|
|
75
|
+
.filter(Boolean)
|
|
76
|
+
.join(" ");
|
|
77
|
+
return (_jsxs("div", { className: rootClass, "data-testid": "reasoning-view", "data-expanded": expanded ? "true" : "false", children: [_jsxs("div", { className: cls.header, children: [_jsx("span", { className: cls.title, children: headerText }), _jsx("button", { type: "button", className: cls.toggle, onClick: handleToggle, "aria-expanded": expanded, "aria-label": expanded
|
|
78
|
+
? texts.chat.reasoningCollapseAriaLabel
|
|
79
|
+
: texts.chat.reasoningExpandAriaLabel, "data-testid": "reasoning-view-toggle", children: expanded ? "▼" : "▶" })] }), expanded ? (_jsx("div", { className: cls.body, "data-testid": "reasoning-view-body", children: props.streaming && props.content.trim().length === 0
|
|
80
|
+
? texts.chat.reasoningThinkingPlaceholder
|
|
81
|
+
: props.content })) : null] }));
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ReasoningView/index.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAEjD,OAAO,EACL,iBAAiB,GAGlB,MAAM,qBAAqB,CAAC;AAoB7B,MAAM,mBAAmB,GAA4B,MAAM,CAAC,MAAM,CAAC;IACjE,IAAI,EAAE,mCAAmC;IACzC,aAAa,EAAE,8CAA8C;IAC7D,YAAY,EAAE,6CAA6C;IAC3D,MAAM,EAAE,2CAA2C;IACnD,KAAK,EAAE,0CAA0C;IACjD,MAAM,EAAE,2CAA2C;IACnD,IAAI,EAAE,yCAAyC;CAChD,CAA4B,CAAC;AA+C9B;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,KAAyB;IACrD,MAAM,KAAK,GAAG,iBAAiB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC7C,MAAM,GAAG,GAAG,EAAE,GAAG,mBAAmB,EAAE,GAAG,CAAC,KAAK,CAAC,UAAU,IAAI,EAAE,CAAC,EAAE,CAAC;IACpE,MAAM,CAAC,oBAAoB,EAAE,uBAAuB,CAAC,GAAG,QAAQ,CAC9D,KAAK,CAAC,eAAe,IAAI,KAAK,CAC/B,CAAC;IACF,MAAM,YAAY,GAAG,KAAK,CAAC,QAAQ,KAAK,SAAS,CAAC;IAClD,MAAM,QAAQ,GAAG,YAAY,CAAC,CAAC,CAAE,KAAK,CAAC,QAAoB,CAAC,C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AO,aAE1C,eAAK,SAAS,EAAE,GAAG,CAAC,MAAM,aACxB,eAAM,SAAS,EAAE,GAAG,CAAC,KAAK,YAAG,UAAU,GAAQ,EAC/C,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,GAAG,CAAC,MAAM,EACrB,OAAO,EAAE,YAAY,mBACN,QAAQ,gBAErB,QAAQ;4BACN,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,0BAA0B;4BACvC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,wBAAwB,iBAE7B,uBAAuB,YAElC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GACd,IACL,EACL,QAAQ,CAAC,CAAC,CAAC,CACV,cAAK,SAAS,EAAE,GAAG,CAAC,IAAI,iBAAc,qBAAqB,YACxD,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC;oBACnD,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,4BAA4B;oBACzC,CAAC,CAAC,KAAK,CAAC,OAAO,GACb,CACP,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<ScrollToPresentButton />` — floating "↓ Jump to latest" button that
|
|
3
|
+
* appears when the user has scrolled away from the bottom of the
|
|
4
|
+
* message list during a running turn.
|
|
5
|
+
*
|
|
6
|
+
* The §10.4 predicate is `status === "running" && userScrolledAwayFromBottom`.
|
|
7
|
+
* The `status` half is computed via `chatAffordances`; the
|
|
8
|
+
* `userScrolledAwayFromBottom` half is local to the message list. This
|
|
9
|
+
* primitive accepts both as props so the predicate logic stays out of
|
|
10
|
+
* the primitive (which would otherwise need to reach into a scroll
|
|
11
|
+
* ref it doesn't own).
|
|
12
|
+
*
|
|
13
|
+
* Rendering also requires `scrollToPresentVisible` (server toggle ∧
|
|
14
|
+
* React prop) — the parent does that AND-merge upstream before
|
|
15
|
+
* passing `visible` here.
|
|
16
|
+
*
|
|
17
|
+
* Exported under `AIHub.ScrollToPresentButton`.
|
|
18
|
+
*
|
|
19
|
+
* @see SPECIFICATIONS.md §10.4 — scroll-to-present predicate
|
|
20
|
+
* @see ui-sketches/03-chat.md — scroll_to_present_button
|
|
21
|
+
*/
|
|
22
|
+
import { type ReactNode } from "react";
|
|
23
|
+
import { type AIHubTexts, type DeepPartial } from "../../auth/texts.js";
|
|
24
|
+
/** BEM class names emitted by `<ScrollToPresentButton />`. */
|
|
25
|
+
export interface ScrollToPresentButtonClassNames {
|
|
26
|
+
/** Outer button element. */
|
|
27
|
+
root: string;
|
|
28
|
+
}
|
|
29
|
+
/** Props for `<ScrollToPresentButton />`. */
|
|
30
|
+
export interface ScrollToPresentButtonProps {
|
|
31
|
+
/**
|
|
32
|
+
* Whether to render. Caller computes the predicate via
|
|
33
|
+
* `chatAffordances(state).scrollToPresentVisible &&
|
|
34
|
+
* userScrolledAwayFromBottom && scrollToPresentVisibleFlag`.
|
|
35
|
+
* Passing `false` returns `null`.
|
|
36
|
+
*/
|
|
37
|
+
visible: boolean;
|
|
38
|
+
/** Click handler — typically scrolls the message list container. */
|
|
39
|
+
onClick: () => void;
|
|
40
|
+
/** Wrapper-supplied i18n. */
|
|
41
|
+
texts?: DeepPartial<AIHubTexts>;
|
|
42
|
+
/** Extra class merged onto the root. */
|
|
43
|
+
className?: string;
|
|
44
|
+
/** Per-element class overrides. */
|
|
45
|
+
classNames?: Partial<ScrollToPresentButtonClassNames>;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Renders the button.
|
|
49
|
+
*
|
|
50
|
+
* @param props - see `ScrollToPresentButtonProps`.
|
|
51
|
+
* @returns the rendered button, or `null` when hidden.
|
|
52
|
+
*/
|
|
53
|
+
export declare function ScrollToPresentButton(props: ScrollToPresentButtonProps): ReactNode;
|
|
54
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ScrollToPresentButton/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,WAAW,EACjB,MAAM,qBAAqB,CAAC;AAE7B,8DAA8D;AAC9D,MAAM,WAAW,+BAA+B;IAC9C,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAC;CACd;AAMD,6CAA6C;AAC7C,MAAM,WAAW,0BAA0B;IACzC;;;;;OAKG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB,oEAAoE;IACpE,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,6BAA6B;IAC7B,KAAK,CAAC,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;IAChC,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mCAAmC;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC,+BAA+B,CAAC,CAAC;CACvD;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,0BAA0B,GAChC,SAAS,CAiBX"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* `<ScrollToPresentButton />` — floating "↓ Jump to latest" button that
|
|
4
|
+
* appears when the user has scrolled away from the bottom of the
|
|
5
|
+
* message list during a running turn.
|
|
6
|
+
*
|
|
7
|
+
* The §10.4 predicate is `status === "running" && userScrolledAwayFromBottom`.
|
|
8
|
+
* The `status` half is computed via `chatAffordances`; the
|
|
9
|
+
* `userScrolledAwayFromBottom` half is local to the message list. This
|
|
10
|
+
* primitive accepts both as props so the predicate logic stays out of
|
|
11
|
+
* the primitive (which would otherwise need to reach into a scroll
|
|
12
|
+
* ref it doesn't own).
|
|
13
|
+
*
|
|
14
|
+
* Rendering also requires `scrollToPresentVisible` (server toggle ∧
|
|
15
|
+
* React prop) — the parent does that AND-merge upstream before
|
|
16
|
+
* passing `visible` here.
|
|
17
|
+
*
|
|
18
|
+
* Exported under `AIHub.ScrollToPresentButton`.
|
|
19
|
+
*
|
|
20
|
+
* @see SPECIFICATIONS.md §10.4 — scroll-to-present predicate
|
|
21
|
+
* @see ui-sketches/03-chat.md — scroll_to_present_button
|
|
22
|
+
*/
|
|
23
|
+
import {} from "react";
|
|
24
|
+
import { resolveAIHubTexts, } from "../../auth/texts.js";
|
|
25
|
+
const DEFAULT_CLASS_NAMES = Object.freeze({
|
|
26
|
+
root: "data-club-ai-hub__scroll-to-present-button",
|
|
27
|
+
});
|
|
28
|
+
/**
|
|
29
|
+
* Renders the button.
|
|
30
|
+
*
|
|
31
|
+
* @param props - see `ScrollToPresentButtonProps`.
|
|
32
|
+
* @returns the rendered button, or `null` when hidden.
|
|
33
|
+
*/
|
|
34
|
+
export function ScrollToPresentButton(props) {
|
|
35
|
+
if (!props.visible)
|
|
36
|
+
return null;
|
|
37
|
+
const texts = resolveAIHubTexts(props.texts);
|
|
38
|
+
const cls = { ...DEFAULT_CLASS_NAMES, ...(props.classNames ?? {}) };
|
|
39
|
+
const rootClass = props.className
|
|
40
|
+
? `${cls.root} ${props.className}`
|
|
41
|
+
: cls.root;
|
|
42
|
+
return (_jsx("button", { type: "button", className: rootClass, onClick: props.onClick, "data-testid": "scroll-to-present-button", children: texts.chat.scrollToPresentButton }));
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ScrollToPresentButton/index.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,EACL,iBAAiB,GAGlB,MAAM,qBAAqB,CAAC;AAQ7B,MAAM,mBAAmB,GAAoC,MAAM,CAAC,MAAM,CAAC;IACzE,IAAI,EAAE,4CAA4C;CACnD,CAAoC,CAAC;AAqBtC;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CACnC,KAAiC;IAEjC,IAAI,CAAC,KAAK,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAChC,MAAM,KAAK,GAAG,iBAAiB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC7C,MAAM,GAAG,GAAG,EAAE,GAAG,mBAAmB,EAAE,GAAG,CAAC,KAAK,CAAC,UAAU,IAAI,EAAE,CAAC,EAAE,CAAC;IACpE,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS;QAC/B,CAAC,CAAC,GAAG,GAAG,CAAC,IAAI,IAAI,KAAK,CAAC,SAAS,EAAE;QAClC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;IACb,OAAO,CACL,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,KAAK,CAAC,OAAO,iBACV,0BAA0B,YAErC,KAAK,CAAC,IAAI,CAAC,qBAAqB,GAC1B,CACV,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<SessionTitleModal />` — the modal used for both new-session creation
|
|
3
|
+
* and edit-title flow on existing sessions.
|
|
4
|
+
*
|
|
5
|
+
* Single text input ("Chat title"), `[Cancel]` / `[Create]` (new) or
|
|
6
|
+
* `[Cancel]` / `[Save]` (edit). Title is required and 1..80 chars —
|
|
7
|
+
* validated client-side before submit (the server's Zod schema enforces
|
|
8
|
+
* the same bounds for defense-in-depth).
|
|
9
|
+
*
|
|
10
|
+
* The modal is uncontrolled state-wise — `onSubmit` resolves with the
|
|
11
|
+
* server's returned `Session` on success; the caller (`SessionsPanel`)
|
|
12
|
+
* decides whether to close. We close on a successful submit by tying
|
|
13
|
+
* `open` back to the parent's state.
|
|
14
|
+
*
|
|
15
|
+
* @see SPECIFICATIONS.md §6.3.1 — sessions
|
|
16
|
+
* @see ui-sketches/03-chat.md — new_session_modal / edit_session_title_modal
|
|
17
|
+
*/
|
|
18
|
+
import { type ReactNode } from "react";
|
|
19
|
+
import type { AIHubChatTexts } from "../../auth/texts.js";
|
|
20
|
+
/**
|
|
21
|
+
* BEM class names emitted by `<SessionTitleModal />`. Shared with the
|
|
22
|
+
* generic-modal styles in the default stylesheet so admin / settings
|
|
23
|
+
* modals layered in Steps 11+ can reuse them.
|
|
24
|
+
*/
|
|
25
|
+
export interface SessionTitleModalClassNames {
|
|
26
|
+
/** Overlay backdrop. */
|
|
27
|
+
overlay: string;
|
|
28
|
+
/** The modal card. */
|
|
29
|
+
modal: string;
|
|
30
|
+
/** Title bar. */
|
|
31
|
+
title: string;
|
|
32
|
+
/** Form. */
|
|
33
|
+
form: string;
|
|
34
|
+
/** Field group (label + input). */
|
|
35
|
+
fieldGroup: string;
|
|
36
|
+
/** Field label. */
|
|
37
|
+
fieldLabel: string;
|
|
38
|
+
/** Text input. */
|
|
39
|
+
input: string;
|
|
40
|
+
/** Inline-validation error under the input. */
|
|
41
|
+
fieldError: string;
|
|
42
|
+
/** Button row at the bottom of the modal. */
|
|
43
|
+
actions: string;
|
|
44
|
+
/** Cancel button. */
|
|
45
|
+
cancelButton: string;
|
|
46
|
+
/** Submit button. */
|
|
47
|
+
submitButton: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Props for `<SessionTitleModal />`.
|
|
51
|
+
*/
|
|
52
|
+
export interface SessionTitleModalProps {
|
|
53
|
+
/** Discriminates the title + submit-button label. */
|
|
54
|
+
mode: "create" | "edit";
|
|
55
|
+
/** Pre-filled value for edit-mode; empty string for create-mode. */
|
|
56
|
+
initialTitle?: string;
|
|
57
|
+
/** Whether the modal is currently visible. */
|
|
58
|
+
open: boolean;
|
|
59
|
+
/** Called when the user dismisses without saving. */
|
|
60
|
+
onCancel: () => void;
|
|
61
|
+
/**
|
|
62
|
+
* Submission handler. Should `await` the server call and throw on
|
|
63
|
+
* failure — the modal renders the error inline and stays open.
|
|
64
|
+
*/
|
|
65
|
+
onSubmit: (title: string) => Promise<void>;
|
|
66
|
+
/** Resolved chat texts. */
|
|
67
|
+
texts: AIHubChatTexts;
|
|
68
|
+
/** Per-element class overrides. */
|
|
69
|
+
classNames?: Partial<SessionTitleModalClassNames>;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Renders the modal. Validates the input client-side and surfaces server
|
|
73
|
+
* errors inline.
|
|
74
|
+
*
|
|
75
|
+
* @param props - see `SessionTitleModalProps`.
|
|
76
|
+
* @returns the rendered modal, or `null` when `open === false`.
|
|
77
|
+
*/
|
|
78
|
+
export declare function SessionTitleModal(props: SessionTitleModalProps): ReactNode;
|
|
79
|
+
//# sourceMappingURL=SessionTitleModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SessionTitleModal.d.ts","sourceRoot":"","sources":["../../../src/components/SessionsPanel/SessionTitleModal.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAKL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC1C,wBAAwB;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,sBAAsB;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,UAAU,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,qBAAqB;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,qBAAqB;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB;AAmBD;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,qDAAqD;IACrD,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAC;IACxB,oEAAoE;IACpE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8CAA8C;IAC9C,IAAI,EAAE,OAAO,CAAC;IACd,qDAAqD;IACrD,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB;;;OAGG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,2BAA2B;IAC3B,KAAK,EAAE,cAAc,CAAC;IACtB,mCAAmC;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC,2BAA2B,CAAC,CAAC;CACnD;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,SAAS,CAsJ1E"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* `<SessionTitleModal />` — the modal used for both new-session creation
|
|
4
|
+
* and edit-title flow on existing sessions.
|
|
5
|
+
*
|
|
6
|
+
* Single text input ("Chat title"), `[Cancel]` / `[Create]` (new) or
|
|
7
|
+
* `[Cancel]` / `[Save]` (edit). Title is required and 1..80 chars —
|
|
8
|
+
* validated client-side before submit (the server's Zod schema enforces
|
|
9
|
+
* the same bounds for defense-in-depth).
|
|
10
|
+
*
|
|
11
|
+
* The modal is uncontrolled state-wise — `onSubmit` resolves with the
|
|
12
|
+
* server's returned `Session` on success; the caller (`SessionsPanel`)
|
|
13
|
+
* decides whether to close. We close on a successful submit by tying
|
|
14
|
+
* `open` back to the parent's state.
|
|
15
|
+
*
|
|
16
|
+
* @see SPECIFICATIONS.md §6.3.1 — sessions
|
|
17
|
+
* @see ui-sketches/03-chat.md — new_session_modal / edit_session_title_modal
|
|
18
|
+
*/
|
|
19
|
+
import { useEffect, useRef, useState, } from "react";
|
|
20
|
+
const DEFAULT_CLASS_NAMES = Object.freeze({
|
|
21
|
+
overlay: "data-club-ai-hub__modal-overlay",
|
|
22
|
+
modal: "data-club-ai-hub__modal",
|
|
23
|
+
title: "data-club-ai-hub__modal__title",
|
|
24
|
+
form: "data-club-ai-hub__modal__form",
|
|
25
|
+
fieldGroup: "data-club-ai-hub__modal__field",
|
|
26
|
+
fieldLabel: "data-club-ai-hub__modal__label",
|
|
27
|
+
input: "data-club-ai-hub__modal__input",
|
|
28
|
+
fieldError: "data-club-ai-hub__modal__field-error",
|
|
29
|
+
actions: "data-club-ai-hub__modal__actions",
|
|
30
|
+
cancelButton: "data-club-ai-hub__modal__cancel",
|
|
31
|
+
submitButton: "data-club-ai-hub__modal__confirm",
|
|
32
|
+
});
|
|
33
|
+
/** The maximum title length enforced both server- and client-side. */
|
|
34
|
+
const TITLE_MAX = 80;
|
|
35
|
+
/**
|
|
36
|
+
* Renders the modal. Validates the input client-side and surfaces server
|
|
37
|
+
* errors inline.
|
|
38
|
+
*
|
|
39
|
+
* @param props - see `SessionTitleModalProps`.
|
|
40
|
+
* @returns the rendered modal, or `null` when `open === false`.
|
|
41
|
+
*/
|
|
42
|
+
export function SessionTitleModal(props) {
|
|
43
|
+
const { mode, initialTitle = "", open, onCancel, onSubmit, texts, } = props;
|
|
44
|
+
const cls = { ...DEFAULT_CLASS_NAMES, ...(props.classNames ?? {}) };
|
|
45
|
+
const [title, setTitle] = useState(initialTitle);
|
|
46
|
+
const [validationError, setValidationError] = useState(null);
|
|
47
|
+
const [serverError, setServerError] = useState(null);
|
|
48
|
+
const [submitting, setSubmitting] = useState(false);
|
|
49
|
+
const inputRef = useRef(null);
|
|
50
|
+
// Re-seed on open / initialTitle change so reopening for a different
|
|
51
|
+
// session doesn't carry stale text.
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
if (open) {
|
|
54
|
+
setTitle(initialTitle);
|
|
55
|
+
setValidationError(null);
|
|
56
|
+
setServerError(null);
|
|
57
|
+
setSubmitting(false);
|
|
58
|
+
// Defer focus to next tick so the input is mounted.
|
|
59
|
+
queueMicrotask(() => inputRef.current?.focus());
|
|
60
|
+
}
|
|
61
|
+
}, [open, initialTitle]);
|
|
62
|
+
if (!open)
|
|
63
|
+
return null;
|
|
64
|
+
const trimmed = title.trim();
|
|
65
|
+
const isEmpty = trimmed.length === 0;
|
|
66
|
+
const tooLong = trimmed.length > TITLE_MAX;
|
|
67
|
+
const submitDisabled = isEmpty || tooLong || submitting;
|
|
68
|
+
function handleSubmit(e) {
|
|
69
|
+
e.preventDefault();
|
|
70
|
+
if (isEmpty) {
|
|
71
|
+
setValidationError(texts.sessionTitleRequiredError);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (tooLong) {
|
|
75
|
+
setValidationError(texts.sessionTitleTooLongError);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
setValidationError(null);
|
|
79
|
+
setServerError(null);
|
|
80
|
+
setSubmitting(true);
|
|
81
|
+
onSubmit(trimmed)
|
|
82
|
+
.catch((err) => {
|
|
83
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
84
|
+
setServerError(msg || texts.genericRequestError);
|
|
85
|
+
})
|
|
86
|
+
.finally(() => setSubmitting(false));
|
|
87
|
+
}
|
|
88
|
+
const modalTitle = mode === "create"
|
|
89
|
+
? texts.newSessionModalTitle
|
|
90
|
+
: texts.editSessionModalTitle;
|
|
91
|
+
const submitLabel = mode === "create" ? texts.modalCreateButton : texts.modalSaveButton;
|
|
92
|
+
return (_jsx("div", { className: cls.overlay, role: "presentation", "data-testid": "session-title-modal-overlay", onClick: (e) => {
|
|
93
|
+
// Click on the backdrop (not the modal itself) cancels.
|
|
94
|
+
if (e.target === e.currentTarget && !submitting)
|
|
95
|
+
onCancel();
|
|
96
|
+
}, children: _jsxs("div", { className: cls.modal, role: "dialog", "aria-modal": "true", "aria-labelledby": "data-club-ai-hub__session-title-modal__heading", "data-testid": "session-title-modal", "data-mode": mode, children: [_jsx("h2", { id: "data-club-ai-hub__session-title-modal__heading", className: cls.title, children: modalTitle }), _jsxs("form", { className: cls.form, onSubmit: handleSubmit, noValidate: true, children: [_jsxs("div", { className: cls.fieldGroup, children: [_jsx("label", { className: cls.fieldLabel, htmlFor: "session-title-input", children: texts.sessionTitleLabel }), _jsx("input", { id: "session-title-input", ref: inputRef, type: "text", className: cls.input, value: title, onChange: (e) => {
|
|
97
|
+
setTitle(e.target.value);
|
|
98
|
+
if (validationError)
|
|
99
|
+
setValidationError(null);
|
|
100
|
+
}, placeholder: texts.sessionTitlePlaceholder, maxLength: TITLE_MAX + 16 /* let the user paste over, validate on submit */, autoComplete: "off", disabled: submitting, "data-testid": "session-title-input" }), validationError ? (_jsx("p", { className: cls.fieldError, "data-testid": "session-title-validation-error", children: validationError })) : null, serverError ? (_jsx("p", { className: cls.fieldError, "data-testid": "session-title-server-error", children: serverError })) : null] }), _jsxs("div", { className: cls.actions, children: [_jsx("button", { type: "button", className: cls.cancelButton, onClick: onCancel, disabled: submitting, "data-testid": "session-title-cancel", children: texts.modalCancelButton }), _jsx("button", { type: "submit", className: cls.submitButton, disabled: submitDisabled, "data-testid": "session-title-submit", children: submitLabel })] })] })] }) }));
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=SessionTitleModal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SessionTitleModal.js","sourceRoot":"","sources":["../../../src/components/SessionsPanel/SessionTitleModal.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,SAAS,EACT,MAAM,EACN,QAAQ,GAGT,MAAM,OAAO,CAAC;AAkCf,MAAM,mBAAmB,GAAgC,MAAM,CAAC,MAAM,CAAC;IACrE,OAAO,EAAE,i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C,CAAC;oCAChD,CAAC,EACD,WAAW,EAAE,KAAK,CAAC,uBAAuB,EAC1C,SAAS,EAAE,SAAS,GAAG,EAAE,CAAC,iDAAiD,EAC3E,YAAY,EAAC,KAAK,EAClB,QAAQ,EAAE,UAAU,iBACR,qBAAqB,GACjC,EACD,eAAe,CAAC,CAAC,CAAC,CACjB,YACE,SAAS,EAAE,GAAG,CAAC,UAAU,iBACb,gCAAgC,YAE3C,eAAe,GACd,CACL,CAAC,CAAC,CAAC,IAAI,EACP,WAAW,CAAC,CAAC,CAAC,CACb,YACE,SAAS,EAAE,GAAG,CAAC,UAAU,iBACb,4BAA4B,YAEvC,WAAW,GACV,CACL,CAAC,CAAC,CAAC,IAAI,IACJ,EACN,eAAK,SAAS,EAAE,GAAG,CAAC,OAAO,aACzB,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,GAAG,CAAC,YAAY,EAC3B,OAAO,EAAE,QAAQ,EACjB,QAAQ,EAAE,UAAU,iBACR,sBAAsB,YAEjC,KAAK,CAAC,iBAAiB,GACjB,EACT,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,GAAG,CAAC,YAAY,EAC3B,QAAQ,EAAE,cAAc,iBACZ,sBAAsB,YAEjC,WAAW,GACL,IACL,IACD,IACH,GACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<SessionsPanel />` — the left-side list of the caller's sessions for
|
|
3
|
+
* the currently-opened agent.
|
|
4
|
+
*
|
|
5
|
+
* Includes:
|
|
6
|
+
*
|
|
7
|
+
* - `new_session_button` → opens `SessionTitleModal` in create mode.
|
|
8
|
+
* - One `session_item` per row with hover-revealed `edit_title_button` +
|
|
9
|
+
* `archive_session_button` actions. Edit opens the same modal in
|
|
10
|
+
* `edit` mode pre-filled with the row's title. Archive uses a native
|
|
11
|
+
* `confirm()` (v1; future polish is a styled modal).
|
|
12
|
+
* - `archived_filter_toggle` at the bottom of the panel — flipping it
|
|
13
|
+
* re-fetches with `include_archived=true`. Archived rows render with
|
|
14
|
+
* the `--archived` modifier and their hover-actions swap to an
|
|
15
|
+
* Unarchive button.
|
|
16
|
+
* - Collapsible / resizable variants — Step 9 ships the collapsible
|
|
17
|
+
* reveal strip; resizable drag is layout-only and uses a CSS gutter
|
|
18
|
+
* the parent layout owns.
|
|
19
|
+
*
|
|
20
|
+
* **No delete action exists anywhere on this panel by design** — v1
|
|
21
|
+
* sessions are archive-only (§6.3.1).
|
|
22
|
+
*
|
|
23
|
+
* Exported under `AIHub.SessionsPanel`.
|
|
24
|
+
*
|
|
25
|
+
* @see SPECIFICATIONS.md §7.1 — exports
|
|
26
|
+
* @see SPECIFICATIONS.md §6.3.1 — sessions
|
|
27
|
+
* @see ui-sketches/03-chat.md — sessions_panel
|
|
28
|
+
*/
|
|
29
|
+
import { type ReactNode } from "react";
|
|
30
|
+
import { type AIHubTexts, type DeepPartial } from "../../auth/texts.js";
|
|
31
|
+
/**
|
|
32
|
+
* BEM class names emitted by `<SessionsPanel />`.
|
|
33
|
+
*/
|
|
34
|
+
export interface SessionsPanelClassNames {
|
|
35
|
+
/** Outer panel container (the column). */
|
|
36
|
+
root: string;
|
|
37
|
+
/** Modifier applied when the panel is collapsed. */
|
|
38
|
+
rootCollapsed: string;
|
|
39
|
+
/** Optional custom-header slot wrapper at the top of the panel. */
|
|
40
|
+
customHeader: string;
|
|
41
|
+
/** "+ New chat" button. */
|
|
42
|
+
newSessionButton: string;
|
|
43
|
+
/** Reveal-strip rendered when collapsed. */
|
|
44
|
+
reveal: string;
|
|
45
|
+
/** Collapse / expand toggle. */
|
|
46
|
+
collapseToggle: string;
|
|
47
|
+
/** Scrollable list region. */
|
|
48
|
+
list: string;
|
|
49
|
+
/** Empty-state line ("No chats yet."). */
|
|
50
|
+
empty: string;
|
|
51
|
+
/** Loading state. */
|
|
52
|
+
loading: string;
|
|
53
|
+
/** A session-list row. */
|
|
54
|
+
item: string;
|
|
55
|
+
/** Modifier applied to the currently-selected row. */
|
|
56
|
+
itemActive: string;
|
|
57
|
+
/** Modifier applied to archived rows. */
|
|
58
|
+
itemArchived: string;
|
|
59
|
+
/** Row title text. */
|
|
60
|
+
itemTitle: string;
|
|
61
|
+
/** Row meta (relative timestamp). */
|
|
62
|
+
itemMeta: string;
|
|
63
|
+
/** Row hover-action group wrapper. */
|
|
64
|
+
itemActions: string;
|
|
65
|
+
/** A single action button (edit / archive / unarchive). */
|
|
66
|
+
actionButton: string;
|
|
67
|
+
/** Footer wrapper holding the archived-filter toggle + custom footer. */
|
|
68
|
+
footer: string;
|
|
69
|
+
/** Show-archived toggle. */
|
|
70
|
+
archivedToggle: string;
|
|
71
|
+
/** Optional custom-footer slot wrapper. */
|
|
72
|
+
customFooter: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Props for `<SessionsPanel />`.
|
|
76
|
+
*/
|
|
77
|
+
export interface SessionsPanelProps {
|
|
78
|
+
/** Whether to render the "+ New chat" button. Defaults to true. */
|
|
79
|
+
showCreateButton?: boolean;
|
|
80
|
+
/** Whether the panel can be collapsed. Defaults to true. */
|
|
81
|
+
collapsible?: boolean;
|
|
82
|
+
/** Top-of-panel slot. */
|
|
83
|
+
customHeader?: ReactNode;
|
|
84
|
+
/** Bottom-of-panel slot, rendered above the archived-filter toggle. */
|
|
85
|
+
customFooter?: ReactNode;
|
|
86
|
+
/** Extra class merged onto the root. */
|
|
87
|
+
className?: string;
|
|
88
|
+
/** Per-element class overrides. */
|
|
89
|
+
classNames?: Partial<SessionsPanelClassNames>;
|
|
90
|
+
/** Wrapper-supplied i18n. */
|
|
91
|
+
texts?: DeepPartial<AIHubTexts>;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Renders the sessions panel.
|
|
95
|
+
*
|
|
96
|
+
* @param props - see `SessionsPanelProps`.
|
|
97
|
+
* @returns the rendered panel.
|
|
98
|
+
*/
|
|
99
|
+
export declare function SessionsPanel(props: SessionsPanelProps): ReactNode;
|
|
100
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SessionsPanel/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAgC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAErE,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,WAAW,EACjB,MAAM,qBAAqB,CAAC;AAM7B;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,aAAa,EAAE,MAAM,CAAC;IACtB,mEAAmE;IACnE,YAAY,EAAE,MAAM,CAAC;IACrB,2BAA2B;IAC3B,gBAAgB,EAAE,MAAM,CAAC;IACzB,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,gCAAgC;IAChC,cAAc,EAAE,MAAM,CAAC;IACvB,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,qBAAqB;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,UAAU,EAAE,MAAM,CAAC;IACnB,yCAAyC;IACzC,YAAY,EAAE,MAAM,CAAC;IACrB,sBAAsB;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,qCAAqC;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,sCAAsC;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,2DAA2D;IAC3D,YAAY,EAAE,MAAM,CAAC;IACrB,yEAAyE;IACzE,MAAM,EAAE,MAAM,CAAC;IACf,4BAA4B;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,2CAA2C;IAC3C,YAAY,EAAE,MAAM,CAAC;CACt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