@memori.ai/memori-react 9.0.0-alpha.21 → 9.0.0-alpha.22
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/CHANGELOG.md +18 -0
- package/dist/components/AgeVerificationModal/AgeVerificationModal.css +1 -7
- package/dist/components/AgeVerificationModal/AgeVerificationModal.js +1 -1
- package/dist/components/AgeVerificationModal/AgeVerificationModal.js.map +1 -1
- package/dist/components/Auth/Auth.css +12 -5
- package/dist/components/Auth/Auth.d.ts +1 -1
- package/dist/components/Auth/Auth.js +46 -32
- package/dist/components/Auth/Auth.js.map +1 -1
- package/dist/components/BlockedMemoriBadge/BlockedMemoriBadge.css +7 -6
- package/dist/components/Chat/Chat.css +1 -0
- package/dist/components/Chat/Chat.js +1 -1
- package/dist/components/Chat/Chat.js.map +1 -1
- package/dist/components/ChatBubble/ChatBubble.css +32 -5
- package/dist/components/ChatBubble/ChatBubble.js +2 -4
- package/dist/components/ChatBubble/ChatBubble.js.map +1 -1
- package/dist/components/ChatHistoryDrawer/ChatHistory.d.ts +3 -1
- package/dist/components/ChatHistoryDrawer/ChatHistory.js +2 -2
- package/dist/components/ChatHistoryDrawer/ChatHistory.js.map +1 -1
- package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.css +1 -1
- package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.d.ts +3 -1
- package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.js +7 -57
- package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.js.map +1 -1
- package/dist/components/ChatInputs/ChatInputs.js +10 -1
- package/dist/components/ChatInputs/ChatInputs.js.map +1 -1
- package/dist/components/ChatTextArea/ChatTextArea.css +1 -1
- package/dist/components/ContentPreviewModal/ContentPreviewModal.css +1 -10
- package/dist/components/ContentPreviewModal/ContentPreviewModal.js +1 -1
- package/dist/components/ContentPreviewModal/ContentPreviewModal.js.map +1 -1
- package/dist/components/ExpertsDrawer/ExpertsDrawer.css +0 -6
- package/dist/components/Header/Header.css +8 -3
- package/dist/components/Header/Header.js +15 -18
- package/dist/components/Header/Header.js.map +1 -1
- package/dist/components/IconButton/IconButton.d.ts +1 -1
- package/dist/components/KnownFacts/KnownFacts.css +1 -1
- package/dist/components/KnownFacts/KnownFacts.js +2 -5
- package/dist/components/KnownFacts/KnownFacts.js.map +1 -1
- package/dist/components/LoginDrawer/LoginDrawer.css +16 -14
- package/dist/components/LoginDrawer/LoginDrawer.js +19 -11
- package/dist/components/LoginDrawer/LoginDrawer.js.map +1 -1
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/styles.css +4 -4
- package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +28 -5
- package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js +2 -2
- package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js.map +1 -1
- package/dist/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js +1 -1
- package/dist/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js.map +1 -1
- package/dist/components/MemoriWidget/MemoriWidget.js +35 -31
- package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/dist/components/MobileSessionPanel/MobileSessionPanel.css +2 -2
- package/dist/components/PositionPopover/PositionPopover.css +3 -3
- package/dist/components/PositionPopover/PositionPopover.js +38 -25
- package/dist/components/PositionPopover/PositionPopover.js.map +1 -1
- package/dist/components/Snippet/Snippet.css +1 -1
- package/dist/components/StartPanel/StartPanel.css +19 -3
- package/dist/components/StartPanel/StartPanel.js +12 -18
- package/dist/components/StartPanel/StartPanel.js.map +1 -1
- package/dist/components/layouts/WebsiteAssistant/website-assistant.css +3 -3
- package/dist/components/layouts/totem.css +43 -9
- package/dist/helpers/positionPopover.d.ts +2 -1
- package/dist/helpers/positionPopover.js +10 -2
- package/dist/helpers/positionPopover.js.map +1 -1
- package/dist/icons/MemoriIcon.js +1 -1
- package/dist/icons/MemoriIcon.js.map +1 -1
- package/dist/locales/de.json +4 -1
- package/dist/locales/en.json +3 -1
- package/dist/locales/es.json +3 -1
- package/dist/locales/fr.json +3 -1
- package/dist/locales/it.json +3 -1
- package/dist/styles.css +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/esm/components/AgeVerificationModal/AgeVerificationModal.css +1 -7
- package/esm/components/AgeVerificationModal/AgeVerificationModal.js +1 -1
- package/esm/components/AgeVerificationModal/AgeVerificationModal.js.map +1 -1
- package/esm/components/Auth/Auth.css +12 -5
- package/esm/components/Auth/Auth.d.ts +1 -1
- package/esm/components/Auth/Auth.js +47 -33
- package/esm/components/Auth/Auth.js.map +1 -1
- package/esm/components/BlockedMemoriBadge/BlockedMemoriBadge.css +7 -6
- package/esm/components/Chat/Chat.css +1 -0
- package/esm/components/Chat/Chat.js +1 -1
- package/esm/components/Chat/Chat.js.map +1 -1
- package/esm/components/ChatBubble/ChatBubble.css +32 -5
- package/esm/components/ChatBubble/ChatBubble.js +2 -4
- package/esm/components/ChatBubble/ChatBubble.js.map +1 -1
- package/esm/components/ChatHistoryDrawer/ChatHistory.d.ts +3 -1
- package/esm/components/ChatHistoryDrawer/ChatHistory.js +2 -2
- package/esm/components/ChatHistoryDrawer/ChatHistory.js.map +1 -1
- package/esm/components/ChatHistoryDrawer/ChatResumeDrawer.css +1 -1
- package/esm/components/ChatHistoryDrawer/ChatResumeDrawer.d.ts +3 -1
- package/esm/components/ChatHistoryDrawer/ChatResumeDrawer.js +9 -59
- package/esm/components/ChatHistoryDrawer/ChatResumeDrawer.js.map +1 -1
- package/esm/components/ChatInputs/ChatInputs.js +11 -2
- package/esm/components/ChatInputs/ChatInputs.js.map +1 -1
- package/esm/components/ChatTextArea/ChatTextArea.css +1 -1
- package/esm/components/ContentPreviewModal/ContentPreviewModal.css +1 -10
- package/esm/components/ContentPreviewModal/ContentPreviewModal.js +1 -1
- package/esm/components/ContentPreviewModal/ContentPreviewModal.js.map +1 -1
- package/esm/components/ExpertsDrawer/ExpertsDrawer.css +0 -6
- package/esm/components/Header/Header.css +8 -3
- package/esm/components/Header/Header.js +15 -18
- package/esm/components/Header/Header.js.map +1 -1
- package/esm/components/IconButton/IconButton.d.ts +1 -1
- package/esm/components/KnownFacts/KnownFacts.css +1 -1
- package/esm/components/KnownFacts/KnownFacts.js +2 -5
- package/esm/components/KnownFacts/KnownFacts.js.map +1 -1
- package/esm/components/LoginDrawer/LoginDrawer.css +16 -14
- package/esm/components/LoginDrawer/LoginDrawer.js +20 -12
- package/esm/components/LoginDrawer/LoginDrawer.js.map +1 -1
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/styles.css +4 -4
- package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +28 -5
- package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js +2 -2
- package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js.map +1 -1
- package/esm/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js +1 -1
- package/esm/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js.map +1 -1
- package/esm/components/MemoriWidget/MemoriWidget.js +36 -32
- package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/esm/components/MobileSessionPanel/MobileSessionPanel.css +2 -2
- package/esm/components/PositionPopover/PositionPopover.css +3 -3
- package/esm/components/PositionPopover/PositionPopover.js +39 -26
- package/esm/components/PositionPopover/PositionPopover.js.map +1 -1
- package/esm/components/Snippet/Snippet.css +1 -1
- package/esm/components/StartPanel/StartPanel.css +19 -3
- package/esm/components/StartPanel/StartPanel.js +12 -18
- package/esm/components/StartPanel/StartPanel.js.map +1 -1
- package/esm/components/layouts/WebsiteAssistant/website-assistant.css +3 -3
- package/esm/components/layouts/totem.css +43 -9
- package/esm/helpers/positionPopover.d.ts +2 -1
- package/esm/helpers/positionPopover.js +9 -2
- package/esm/helpers/positionPopover.js.map +1 -1
- package/esm/icons/MemoriIcon.js +1 -1
- package/esm/icons/MemoriIcon.js.map +1 -1
- package/esm/locales/de.json +4 -1
- package/esm/locales/en.json +3 -1
- package/esm/locales/es.json +3 -1
- package/esm/locales/fr.json +3 -1
- package/esm/locales/it.json +3 -1
- package/esm/styles.css +1 -1
- package/esm/version.d.ts +1 -1
- package/esm/version.js +1 -1
- package/package.json +5 -3
- package/src/Live/Agents.stories.tsx +49 -0
- package/src/Live/KnownFacts.stories.tsx +50 -0
- package/src/Showcase.stories.tsx +3 -14
- package/src/components/AgeVerificationModal/AgeVerificationModal.css +1 -7
- package/src/components/AgeVerificationModal/AgeVerificationModal.stories.tsx +1 -1
- package/src/components/AgeVerificationModal/AgeVerificationModal.tsx +1 -0
- package/src/components/Auth/Auth.css +12 -5
- package/src/components/Auth/Auth.stories.tsx +1 -1
- package/src/components/Auth/Auth.test.tsx +68 -1
- package/src/components/Auth/Auth.tsx +69 -54
- package/src/components/Auth/__snapshots__/Auth.test.tsx.snap +5 -6
- package/src/components/Avatar/Avatar.stories.tsx +1 -18
- package/src/components/Avatar/AvatarView/AvatarView.stories.tsx +1 -103
- package/src/components/Blob/Blob.stories.tsx +1 -1
- package/src/components/BlockedMemoriBadge/BlockedMemoriBadge.css +7 -6
- package/src/components/BlockedMemoriBadge/BlockedMemoriBadge.stories.tsx +1 -1
- package/src/components/ChangeMode/ChangeMode.stories.tsx +1 -1
- package/src/components/Chat/Chat.css +1 -0
- package/src/components/Chat/Chat.stories.tsx +61 -7
- package/src/components/Chat/Chat.tsx +1 -0
- package/src/components/Chat/__snapshots__/Chat.test.tsx.snap +80 -80
- package/src/components/ChatBubble/ChatBubble.css +32 -5
- package/src/components/ChatBubble/ChatBubble.stories.tsx +13 -2
- package/src/components/ChatBubble/ChatBubble.test.tsx +21 -1
- package/src/components/ChatBubble/ChatBubble.tsx +7 -13
- package/src/components/ChatBubble/__snapshots__/ChatBubble.test.tsx.snap +158 -185
- package/src/components/ChatHistoryDrawer/ChatHistory.stories.tsx +1 -1
- package/src/components/ChatHistoryDrawer/ChatHistory.tsx +6 -0
- package/src/components/ChatHistoryDrawer/ChatResumeDrawer.css +1 -1
- package/src/components/ChatHistoryDrawer/ChatResumeDrawer.tsx +24 -81
- package/src/components/ChatInputs/ChatInputs.stories.tsx +1 -39
- package/src/components/ChatInputs/ChatInputs.test.tsx +47 -0
- package/src/components/ChatInputs/ChatInputs.tsx +12 -2
- package/src/components/ChatTextArea/ChatTextArea.css +1 -1
- package/src/components/CompletionProviderStatus/CompletionProviderStatus.stories.tsx +1 -1
- package/src/components/ContentPreviewModal/ContentPreviewModal.css +1 -10
- package/src/components/ContentPreviewModal/ContentPreviewModal.tsx +1 -1
- package/src/components/ExpertsDrawer/ExpertsDrawer.css +0 -6
- package/src/components/ExpertsDrawer/ExpertsDrawer.stories.tsx +1 -1
- package/src/components/FeedbackButtons/FeedbackButtons.stories.tsx +29 -10
- package/src/components/Header/Header.css +8 -3
- package/src/components/Header/Header.stories.tsx +1 -1
- package/src/components/Header/Header.tsx +146 -117
- package/src/components/KnownFacts/KnownFacts.css +1 -1
- package/src/components/KnownFacts/KnownFacts.stories.tsx +1 -23
- package/src/components/KnownFacts/KnownFacts.tsx +4 -9
- package/src/components/LoginDrawer/LoginDrawer.css +16 -14
- package/src/components/LoginDrawer/LoginDrawer.stories.tsx +2 -52
- package/src/components/LoginDrawer/LoginDrawer.tsx +51 -39
- package/src/components/MediaWidget/MediaItemWidget.stories.tsx +1 -15
- package/src/components/MediaWidget/MediaWidget.stories.tsx +1 -45
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/CopyButton.stories.tsx +1 -1
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/styles.css +4 -4
- package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +28 -5
- package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.tsx +4 -6
- package/src/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.tsx +1 -1
- package/src/components/MemoriArtifactSystem/utils/ArtifactAPI.test.tsx +32 -28
- package/src/components/MemoriWidget/MemoriUIProvider.contract.test.tsx +55 -0
- package/src/components/MemoriWidget/MemoriWidget.stories.tsx +55 -77
- package/src/components/MemoriWidget/MemoriWidget.tsx +49 -44
- package/src/components/MemoriWidget/getChatStyles.test.ts +24 -0
- package/src/components/MicrophoneButton/MicrophoneButton.stories.tsx +1 -1
- package/src/components/MobileSessionPanel/MobileSessionPanel.css +2 -2
- package/src/components/PositionPopover/PositionPopover.css +3 -3
- package/src/components/PositionPopover/PositionPopover.stories.tsx +1 -1
- package/src/components/PositionPopover/PositionPopover.tsx +50 -28
- package/src/components/PoweredBy/PoweredBy.stories.tsx +1 -54
- package/src/components/PoweredBy/__snapshots__/PoweredBy.test.tsx.snap +2 -2
- package/src/components/SendOnEnterMenu/SendOnEnterMenu.stories.tsx +1 -1
- package/src/components/SettingsDrawer/SettingsDrawer.stories.tsx +1 -1
- package/src/components/ShareButton/ShareButton.stories.tsx +1 -1
- package/src/components/Snippet/Snippet.css +1 -1
- package/src/components/Snippet/Snippet.stories.tsx +1 -1
- package/src/components/StartPanel/StartPanel.css +19 -3
- package/src/components/StartPanel/StartPanel.stories.tsx +2 -2
- package/src/components/StartPanel/StartPanel.tsx +22 -35
- package/src/components/StartPanel/__snapshots__/StartPanel.test.tsx.snap +177 -121
- package/src/components/Typing/Typing.stories.tsx +1 -1
- package/src/components/WhyThisAnswer/WhyThisAnswer.stories.tsx +22 -44
- package/src/components/layouts/FullBody/FullBody.stories.tsx +55 -68
- package/src/components/layouts/Totem/Totem.stories.tsx +69 -87
- package/src/components/layouts/WebsiteAssistant/website-assistant.css +3 -3
- package/src/components/layouts/ZoomedFullBody/ZoomedFullBody.stories.tsx +69 -87
- package/src/components/layouts/__snapshots__/Chat.test.tsx.snap +19 -41
- package/src/components/layouts/__snapshots__/FullPage.test.tsx.snap +39 -83
- package/src/components/layouts/__snapshots__/HiddenChat.test.tsx.snap +15 -11
- package/src/components/layouts/__snapshots__/Totem.test.tsx.snap +116 -42
- package/src/components/layouts/__snapshots__/ZoomedFullBody.test.tsx.snap +18 -40
- package/src/components/layouts/layouts.stories.tsx +96 -179
- package/src/components/layouts/totem.css +43 -9
- package/src/helpers/positionPopover.test.ts +36 -1
- package/src/helpers/positionPopover.ts +21 -4
- package/src/i18n.knownFacts.test.ts +40 -0
- package/src/icons/MemoriIcon.tsx +1 -1
- package/src/index.stories.tsx +1 -47
- package/src/locales/de.json +4 -1
- package/src/locales/en.json +3 -1
- package/src/locales/es.json +3 -1
- package/src/locales/fr.json +3 -1
- package/src/locales/it.json +3 -1
- package/src/styles.css +13 -27
- package/src/version.ts +1 -1
- package/src/components/ChatTextArea/ChatTextArea.stories.tsx +0 -55
- package/src/components/CustomGLBModelViewer/ModelViewer.stories.tsx +0 -58
- package/src/components/DateSelector/DateSelector.stories.tsx +0 -47
- package/src/components/FilePreview/FilePreview.stories.tsx +0 -63
- package/src/components/MemoriArtifactSystem/ArtifactDrawer.stories.tsx +0 -265
- package/src/components/UploadButton/UploadButton.stories.tsx +0 -510
- package/src/components/VenueWidget/VenueWidget.stories.tsx +0 -69
- package/src/components/layouts/WebsiteAssistant/WebsiteAssistant.stories.tsx +0 -115
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { Meta, Story } from '@storybook/react';
|
|
3
|
-
import I18nWrapper from '../../I18nWrapper';
|
|
4
|
-
import FilePreview from './FilePreview';
|
|
5
|
-
|
|
6
|
-
import './FilePreview.css';
|
|
7
|
-
|
|
8
|
-
const meta: Meta = {
|
|
9
|
-
title: 'Widget/File Preview',
|
|
10
|
-
component: FilePreview,
|
|
11
|
-
argTypes: {
|
|
12
|
-
disabled: {
|
|
13
|
-
control: {
|
|
14
|
-
type: 'boolean',
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
parameters: {
|
|
19
|
-
controls: { expanded: true },
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
type Props = {
|
|
25
|
-
onUpload: (text: string) => void;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export default meta;
|
|
29
|
-
|
|
30
|
-
const Template: Story<Props> = args => {
|
|
31
|
-
const [previewFiles, setPreviewFiles] = useState<{ name: string; id: string; content: string; }[]>([]);
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<I18nWrapper>
|
|
35
|
-
<div
|
|
36
|
-
style={{
|
|
37
|
-
minHeight: '200px',
|
|
38
|
-
display: 'flex',
|
|
39
|
-
alignItems: 'flex-end',
|
|
40
|
-
}}
|
|
41
|
-
>
|
|
42
|
-
<FilePreview {...args} previewFiles={previewFiles} removeFile={
|
|
43
|
-
(id: string) => {
|
|
44
|
-
setPreviewFiles(previewFiles.filter(file => file.id !== id));
|
|
45
|
-
}
|
|
46
|
-
} />
|
|
47
|
-
</div>
|
|
48
|
-
</I18nWrapper>
|
|
49
|
-
);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
// By passing using the Args format for exported stories, you can control the props for a component for reuse in a test
|
|
53
|
-
// https://storybook.js.org/docs/react/workflows/unit-testing
|
|
54
|
-
export const Default = Template.bind({});
|
|
55
|
-
Default.args = {
|
|
56
|
-
onUpload: () => {},
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export const Disabled = Template.bind({});
|
|
60
|
-
Disabled.args = {
|
|
61
|
-
onUpload: () => {},
|
|
62
|
-
disabled: true,
|
|
63
|
-
};
|
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
import React, { useEffect } from 'react';
|
|
2
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
-
import { Message } from '@memori.ai/memori-api-client/dist/types';
|
|
4
|
-
import { AlertProvider } from '@memori.ai/ui';
|
|
5
|
-
import I18nWrapper from '../../I18nWrapper';
|
|
6
|
-
import {
|
|
7
|
-
ArtifactProvider,
|
|
8
|
-
useArtifact,
|
|
9
|
-
} from './context/ArtifactContext';
|
|
10
|
-
import ArtifactDrawer from './components/ArtifactDrawer/ArtifactDrawer';
|
|
11
|
-
import ArtifactHandler from './components/ArtifactHandler/ArtifactHandler';
|
|
12
|
-
import { ArtifactData } from './types/artifact.types';
|
|
13
|
-
|
|
14
|
-
const HTML_ARTIFACT_CONTENT = `<!DOCTYPE html>
|
|
15
|
-
<html lang="en">
|
|
16
|
-
<head>
|
|
17
|
-
<meta charset="UTF-8">
|
|
18
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
19
|
-
<title>Product Dashboard</title>
|
|
20
|
-
<style>
|
|
21
|
-
* { box-sizing: border-box; }
|
|
22
|
-
body {
|
|
23
|
-
margin: 0;
|
|
24
|
-
padding: 24px;
|
|
25
|
-
font-family: system-ui, -apple-system, sans-serif;
|
|
26
|
-
background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
|
|
27
|
-
color: #0f172a;
|
|
28
|
-
}
|
|
29
|
-
.grid {
|
|
30
|
-
display: grid;
|
|
31
|
-
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
32
|
-
gap: 16px;
|
|
33
|
-
}
|
|
34
|
-
.card {
|
|
35
|
-
background: #fff;
|
|
36
|
-
border-radius: 12px;
|
|
37
|
-
padding: 20px;
|
|
38
|
-
box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
|
|
39
|
-
}
|
|
40
|
-
.metric {
|
|
41
|
-
font-size: 28px;
|
|
42
|
-
font-weight: 700;
|
|
43
|
-
margin: 8px 0 0;
|
|
44
|
-
}
|
|
45
|
-
.label {
|
|
46
|
-
color: #64748b;
|
|
47
|
-
font-size: 13px;
|
|
48
|
-
text-transform: uppercase;
|
|
49
|
-
letter-spacing: 0.04em;
|
|
50
|
-
}
|
|
51
|
-
h1 { margin-top: 0; font-size: 22px; }
|
|
52
|
-
</style>
|
|
53
|
-
</head>
|
|
54
|
-
<body>
|
|
55
|
-
<h1>Product Dashboard</h1>
|
|
56
|
-
<p>Interactive HTML artifact shown in the side drawer panel.</p>
|
|
57
|
-
<div class="grid">
|
|
58
|
-
<div class="card">
|
|
59
|
-
<div class="label">Active users</div>
|
|
60
|
-
<div class="metric">12,480</div>
|
|
61
|
-
</div>
|
|
62
|
-
<div class="card">
|
|
63
|
-
<div class="label">Conversion</div>
|
|
64
|
-
<div class="metric">4.8%</div>
|
|
65
|
-
</div>
|
|
66
|
-
<div class="card">
|
|
67
|
-
<div class="label">Revenue</div>
|
|
68
|
-
<div class="metric">€84,200</div>
|
|
69
|
-
</div>
|
|
70
|
-
<div class="card">
|
|
71
|
-
<div class="label">Support tickets</div>
|
|
72
|
-
<div class="metric">37</div>
|
|
73
|
-
</div>
|
|
74
|
-
</div>
|
|
75
|
-
</body>
|
|
76
|
-
</html>`;
|
|
77
|
-
|
|
78
|
-
const MARKDOWN_ARTIFACT_CONTENT = `# Weekly Report
|
|
79
|
-
|
|
80
|
-
This artifact expands **inline in the chat log** instead of opening the side drawer.
|
|
81
|
-
|
|
82
|
-
## Highlights
|
|
83
|
-
|
|
84
|
-
| Metric | Value | Change |
|
|
85
|
-
|--------|-------|--------|
|
|
86
|
-
| Sessions | 18,420 | +12% |
|
|
87
|
-
| Avg. response time | 1.4s | -8% |
|
|
88
|
-
| Satisfaction | 4.7/5 | +0.2 |
|
|
89
|
-
|
|
90
|
-
## Next steps
|
|
91
|
-
|
|
92
|
-
- Review artifact preview and code tabs
|
|
93
|
-
- Try copy, download, and print actions
|
|
94
|
-
- Collapse the panel with the artifact handler button
|
|
95
|
-
|
|
96
|
-
\`\`\`typescript
|
|
97
|
-
export function summarize(report: WeeklyReport) {
|
|
98
|
-
return report.highlights.map(item => item.title).join(', ');
|
|
99
|
-
}
|
|
100
|
-
\`\`\`
|
|
101
|
-
`;
|
|
102
|
-
|
|
103
|
-
const wrapArtifactTag = (
|
|
104
|
-
content: string,
|
|
105
|
-
mimeType: string,
|
|
106
|
-
title: string
|
|
107
|
-
): string =>
|
|
108
|
-
`<output class="memori-artifact" data-mimetype="${mimeType}" data-title="${title}">${content}</output>`;
|
|
109
|
-
|
|
110
|
-
const createArtifactMessage = (
|
|
111
|
-
content: string,
|
|
112
|
-
mimeType: string,
|
|
113
|
-
title: string,
|
|
114
|
-
timestamp: string
|
|
115
|
-
): Message => ({
|
|
116
|
-
text: wrapArtifactTag(content, mimeType, title),
|
|
117
|
-
fromUser: false,
|
|
118
|
-
timestamp,
|
|
119
|
-
generatedByAI: true,
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
const htmlArtifactMessage = createArtifactMessage(
|
|
123
|
-
HTML_ARTIFACT_CONTENT,
|
|
124
|
-
'html',
|
|
125
|
-
'Product Dashboard',
|
|
126
|
-
'2026-05-27T10:00:00.000Z'
|
|
127
|
-
);
|
|
128
|
-
|
|
129
|
-
const markdownArtifactMessage = createArtifactMessage(
|
|
130
|
-
MARKDOWN_ARTIFACT_CONTENT,
|
|
131
|
-
'markdown',
|
|
132
|
-
'Weekly Report',
|
|
133
|
-
'2026-05-27T11:00:00.000Z'
|
|
134
|
-
);
|
|
135
|
-
|
|
136
|
-
const StoryProviders: React.FC<{ children: React.ReactNode }> = ({
|
|
137
|
-
children,
|
|
138
|
-
}) => (
|
|
139
|
-
<I18nWrapper>
|
|
140
|
-
<AlertProvider defaultDuration={5000}>
|
|
141
|
-
<ArtifactProvider>{children}</ArtifactProvider>
|
|
142
|
-
</AlertProvider>
|
|
143
|
-
</I18nWrapper>
|
|
144
|
-
);
|
|
145
|
-
|
|
146
|
-
const OpenArtifactOnMount: React.FC<{
|
|
147
|
-
artifact: ArtifactData;
|
|
148
|
-
isChatLogPanel?: boolean;
|
|
149
|
-
}> = ({ artifact, isChatLogPanel = false }) => {
|
|
150
|
-
const { openArtifact } = useArtifact();
|
|
151
|
-
|
|
152
|
-
useEffect(() => {
|
|
153
|
-
openArtifact(artifact, { isChatLogPanel });
|
|
154
|
-
}, [artifact, isChatLogPanel, openArtifact]);
|
|
155
|
-
|
|
156
|
-
return null;
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
const DrawerModeDemo: React.FC = () => (
|
|
160
|
-
<div
|
|
161
|
-
style={{
|
|
162
|
-
display: 'flex',
|
|
163
|
-
height: '100vh',
|
|
164
|
-
background: 'var(--memori-main-background)',
|
|
165
|
-
}}
|
|
166
|
-
>
|
|
167
|
-
<div
|
|
168
|
-
style={{
|
|
169
|
-
flex: 1,
|
|
170
|
-
minWidth: 0,
|
|
171
|
-
padding: '24px',
|
|
172
|
-
borderRight: '1px solid var(--memori-border-primary)',
|
|
173
|
-
overflow: 'auto',
|
|
174
|
-
}}
|
|
175
|
-
>
|
|
176
|
-
<p style={{ marginTop: 0, color: 'var(--memori-text-color)' }}>
|
|
177
|
-
Side-drawer mode: the artifact opens in a dedicated layout column while
|
|
178
|
-
the chat stays visible on the left.
|
|
179
|
-
</p>
|
|
180
|
-
<ArtifactHandler
|
|
181
|
-
isChatlogPanel={false}
|
|
182
|
-
message={htmlArtifactMessage}
|
|
183
|
-
/>
|
|
184
|
-
</div>
|
|
185
|
-
<div style={{ width: '55%', minWidth: 360 }}>
|
|
186
|
-
<ArtifactDrawer isLayoutColumn />
|
|
187
|
-
</div>
|
|
188
|
-
</div>
|
|
189
|
-
);
|
|
190
|
-
|
|
191
|
-
const ChatLogModeDemo: React.FC = () => {
|
|
192
|
-
const markdownArtifact: ArtifactData = {
|
|
193
|
-
id: 'storybook-chatlog-artifact',
|
|
194
|
-
content: MARKDOWN_ARTIFACT_CONTENT,
|
|
195
|
-
mimeType: 'markdown',
|
|
196
|
-
title: 'Weekly Report',
|
|
197
|
-
timestamp: new Date('2026-05-27T11:00:00.000Z'),
|
|
198
|
-
size: MARKDOWN_ARTIFACT_CONTENT.length,
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
return (
|
|
202
|
-
<div
|
|
203
|
-
style={{
|
|
204
|
-
maxWidth: 760,
|
|
205
|
-
margin: '0 auto',
|
|
206
|
-
padding: '24px',
|
|
207
|
-
background: 'var(--memori-main-background)',
|
|
208
|
-
minHeight: '100vh',
|
|
209
|
-
}}
|
|
210
|
-
>
|
|
211
|
-
<p style={{ marginTop: 0, color: 'var(--memori-text-color)' }}>
|
|
212
|
-
Chatlog mode: the artifact expands inline below the handler button inside
|
|
213
|
-
the conversation.
|
|
214
|
-
</p>
|
|
215
|
-
<OpenArtifactOnMount artifact={markdownArtifact} isChatLogPanel />
|
|
216
|
-
<ArtifactHandler
|
|
217
|
-
isChatlogPanel
|
|
218
|
-
message={markdownArtifactMessage}
|
|
219
|
-
/>
|
|
220
|
-
</div>
|
|
221
|
-
);
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
const meta: Meta = {
|
|
225
|
-
title: 'Artifact System/ArtifactDrawer',
|
|
226
|
-
parameters: {
|
|
227
|
-
layout: 'fullscreen',
|
|
228
|
-
},
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
export default meta;
|
|
232
|
-
|
|
233
|
-
type Story = StoryObj;
|
|
234
|
-
|
|
235
|
-
export const DrawerMode: Story = {
|
|
236
|
-
render: () => (
|
|
237
|
-
<StoryProviders>
|
|
238
|
-
<DrawerModeDemo />
|
|
239
|
-
</StoryProviders>
|
|
240
|
-
),
|
|
241
|
-
parameters: {
|
|
242
|
-
docs: {
|
|
243
|
-
description: {
|
|
244
|
-
story:
|
|
245
|
-
'HTML artifact opened in side-drawer mode. The handler auto-opens the artifact in the layout column, matching FullPage and Chat layouts.',
|
|
246
|
-
},
|
|
247
|
-
},
|
|
248
|
-
},
|
|
249
|
-
};
|
|
250
|
-
|
|
251
|
-
export const ChatLogMode: Story = {
|
|
252
|
-
render: () => (
|
|
253
|
-
<StoryProviders>
|
|
254
|
-
<ChatLogModeDemo />
|
|
255
|
-
</StoryProviders>
|
|
256
|
-
),
|
|
257
|
-
parameters: {
|
|
258
|
-
docs: {
|
|
259
|
-
description: {
|
|
260
|
-
story:
|
|
261
|
-
'Markdown artifact shown inline in chatlog mode. The drawer renders below the artifact handler inside the message flow.',
|
|
262
|
-
},
|
|
263
|
-
},
|
|
264
|
-
},
|
|
265
|
-
};
|