diff --git a/apps/storybook/.storybook/preview.ts b/apps/storybook/.storybook/preview.ts index 65f369dd..70cd77bc 100644 --- a/apps/storybook/.storybook/preview.ts +++ b/apps/storybook/.storybook/preview.ts @@ -8,8 +8,16 @@ import { DARK_THEME_BG, LIGTH_THEME_BG } from '../constants' const preview = { decorators: [ (story, context) => { - const classTheme = context.globals?.backgrounds?.value === DARK_THEME_BG ? 'theme-dark' : 'theme-light' - return html`
${story()}
` + const bgTheme = context.globals?.backgrounds?.value === DARK_THEME_BG ? 'theme-dark' : 'theme-light' + const heightValue = context.parameters?.layout === 'set-height' ? '613px' : 'auto' + return html` + +
${story()}
+ ` }, ], parameters: { diff --git a/apps/storybook/stories/docs/Welcome.mdx b/apps/storybook/stories/docs/Welcome.mdx index 8548c9ef..7aa85b95 100644 --- a/apps/storybook/stories/docs/Welcome.mdx +++ b/apps/storybook/stories/docs/Welcome.mdx @@ -1,5 +1,5 @@ import { Meta } from "@storybook/blocks" -import { Basics } from "../components/basics/basics" +import { Basics } from "../../components/basics/basics" diff --git a/apps/storybook/stories/public/orama-chat-box.stories.tsx b/apps/storybook/stories/public/orama-chat-box.stories.tsx index 6f458646..7b9551af 100644 --- a/apps/storybook/stories/public/orama-chat-box.stories.tsx +++ b/apps/storybook/stories/public/orama-chat-box.stories.tsx @@ -27,6 +27,9 @@ const meta: Meta = { control: { type: 'select' }, }, }, + parameters: { + layout: 'set-height', + }, } satisfies Meta export default meta diff --git a/packages/ui-stencil/src/components/internal/orama-chat-messages-container/orama-chat-assistent-message/orama-chat-assistent-message.scss b/packages/ui-stencil/src/components/internal/orama-chat-messages-container/orama-chat-assistent-message/orama-chat-assistent-message.scss index 2841ac52..f84b6824 100644 --- a/packages/ui-stencil/src/components/internal/orama-chat-messages-container/orama-chat-assistent-message/orama-chat-assistent-message.scss +++ b/packages/ui-stencil/src/components/internal/orama-chat-messages-container/orama-chat-assistent-message/orama-chat-assistent-message.scss @@ -4,9 +4,6 @@ } .message-wrapper { - display: flex; - flex-direction: column; - gap: var(--spacing-m, $spacing-m); background: var(--background-color-secondary, background-color('secondary')); border-radius: var(--radius-m, $radius-m); padding: var(--spacing-m, $spacing-m); @@ -28,6 +25,7 @@ .message-actions { display: flex; + margin-top: var(--spacing-m, $spacing-m); gap: var(--spacing-s, $spacing-s); justify-content: end; transition: opacity 0.2s ease-in-out; diff --git a/packages/ui-stencil/src/components/internal/orama-chat-messages-container/orama-chat-assistent-message/orama-markdown/orama-markdown.scss b/packages/ui-stencil/src/components/internal/orama-chat-messages-container/orama-chat-assistent-message/orama-markdown/orama-markdown.scss index bc97ccc6..a98f5d75 100644 --- a/packages/ui-stencil/src/components/internal/orama-chat-messages-container/orama-chat-assistent-message/orama-markdown/orama-markdown.scss +++ b/packages/ui-stencil/src/components/internal/orama-chat-messages-container/orama-chat-assistent-message/orama-markdown/orama-markdown.scss @@ -2,11 +2,6 @@ color: var(--text-color-secondary, text-color('secondary')); } -.orama-markdown-wrapper > :first-child { - padding-top: 0; - margin-top: 0; -} - p, a, li { diff --git a/packages/ui-stencil/src/components/internal/orama-chat-messages-container/orama-chat-assistent-message/orama-markdown/orama-markdown.tsx b/packages/ui-stencil/src/components/internal/orama-chat-messages-container/orama-chat-assistent-message/orama-markdown/orama-markdown.tsx index 93719ac5..d9bf35b3 100644 --- a/packages/ui-stencil/src/components/internal/orama-chat-messages-container/orama-chat-assistent-message/orama-markdown/orama-markdown.tsx +++ b/packages/ui-stencil/src/components/internal/orama-chat-messages-container/orama-chat-assistent-message/orama-markdown/orama-markdown.tsx @@ -183,7 +183,6 @@ export class OramaMarkdown { href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.10.0/build/styles/atom-one-dark.min.css" />
{ this.divElement = ref }} diff --git a/packages/ui-stencil/src/components/internal/orama-chat/orama-chat.scss b/packages/ui-stencil/src/components/internal/orama-chat/orama-chat.scss index c512271f..11b6da68 100644 --- a/packages/ui-stencil/src/components/internal/orama-chat/orama-chat.scss +++ b/packages/ui-stencil/src/components/internal/orama-chat/orama-chat.scss @@ -4,8 +4,7 @@ orama-chat { flex-direction: column; flex-grow: 1; overflow: hidden; - // todo: this is probabily to fix, since now it's not meant for generic purpose, but to be used in orama website - max-height: pxToRem(613); + height: 100%; // background: linear-gradient(180deg, var(--background-ai-gradient-one) 0%, var(--background-ai-gradient-two) 50%); background: var(--background-color-primary, background-color('primary')); } @@ -30,6 +29,10 @@ orama-chat { background-color: #b2b2b285; border-radius: var(--border-radius-l, $radius-l); } + + &.isEmpty { + justify-content: flex-end; + } } .messages-container-wrapper-non-scrollable { @@ -72,14 +75,6 @@ orama-chat { margin-bottom: var(--spacing-s, $spacing-s); } -.suggestions-wrapper { - display: flex; - flex-direction: column; - flex-grow: 1; - justify-content: end; - overflow-x: auto; -} - orama-logo-icon { z-index: -1; position: absolute; diff --git a/packages/ui-stencil/src/components/internal/orama-chat/orama-chat.tsx b/packages/ui-stencil/src/components/internal/orama-chat/orama-chat.tsx index 033e971d..50497cc4 100644 --- a/packages/ui-stencil/src/components/internal/orama-chat/orama-chat.tsx +++ b/packages/ui-stencil/src/components/internal/orama-chat/orama-chat.tsx @@ -136,6 +136,7 @@ export class OramaChat { render() { const lastInteraction = chatContext.interactions?.[chatContext.interactions.length - 1] const lastInteractionStatus = lastInteraction?.status + const lastInteractionStreaming = lastInteractionStatus === TAnswerStatus.streaming // ? Question: Maybe should be a orama-button variant? return ( @@ -153,16 +154,17 @@ export class OramaChat { )} {/* CHAT MESSAGES */}
-
(this.messagesContainerRef = ref)}> +
(this.messagesContainerRef = ref)} + > {chatContext.interactions?.length ? ( ) : null} {/* TODO: Provide a better animation */} {!chatContext.interactions?.length ? ( -
- -
+ ) : null} {/* TODO: not required for chatbox, but maybe required for Searchbox v2 */} {/* */} @@ -201,7 +203,7 @@ export class OramaChat { placeholder={this.placeholder} >
- {[TAnswerStatus.streaming, TAnswerStatus.loading].includes(lastInteractionStatus) ? ( + {lastInteractionStreaming ? ( ; colors?: DeepPartial<{ gray50: string; gray100: string; gray200: string; gray300: string; gray400: string; gray500: string; gray600: string; gray700: string; gray800: string; gray900: string; gray950: string; purple100: string; purple200: string; purple300: string; purple500: string; purple700: string; light: { "--text-color-primary": string; "--text-color-secondary": string; "--text-color-tertiary": string; "--text-color-accent": string; "--text-color-inactive": string; "--text-color-reverse": string; "--background-color-primary": string; "--background-color-secondary": string; "--background-color-tertiary": string; "--background-color-fourth": string; "--background-color-reverse": string; "--border-color-primary": string; "--border-color-secondary": string; "--border-color-tertiary": string; "--border-color-accent": string; "--icon-color-primary": string; "--icon-color-secondary": string; "--icon-color-tertiary": string; "--icon-color-inactive": string; "--icon-color-accent": string; "--shadow-color-primary": string; "--button-text-color-primary": string; "--button-text-color-inactive": string; "--button-background-color-primary": string; "--button-background-color-inactive": string; }; dark: { "--text-color-primary": string; "--text-color-secondary": string; "--text-color-tertiary": string; "--text-color-accent": string; "--text-color-inactive": string; "--text-color-reverse": string; "--background-color-primary": string; "--background-color-secondary": string; "--background-color-tertiary": string; "--background-color-fourth": string; "--background-color-reverse": string; "--border-color-primary": string; "--border-color-secondary": string; "--border-color-tertiary": string; "--border-color-accent": string; "--icon-color-primary": string; "--icon-color-secondary": string; "--icon-color-tertiary": string; "--icon-color-inactive": string; "--icon-color-accent": string; "--shadow-color-primary": string; "--button-text-color-primary": string; "--button-background-color-primary": string; }; }>; }` | `undefined` |