diff --git a/change/@ni-spright-components-53dfedf2-8550-49e2-816e-5988e14affad.json b/change/@ni-spright-components-53dfedf2-8550-49e2-816e-5988e14affad.json new file mode 100644 index 0000000000..fdede57423 --- /dev/null +++ b/change/@ni-spright-components-53dfedf2-8550-49e2-816e-5988e14affad.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "Chat message sizing is more client configurable", + "packageName": "@ni/spright-components", + "email": "jattasNI@users.noreply.github.com", + "dependentChangeType": "patch" +} diff --git a/packages/spright-components/src/chat/message/inbound/styles.ts b/packages/spright-components/src/chat/message/inbound/styles.ts index 90f202ebeb..c1244fb040 100644 --- a/packages/spright-components/src/chat/message/inbound/styles.ts +++ b/packages/spright-components/src/chat/message/inbound/styles.ts @@ -20,9 +20,11 @@ export const styles = css` :host { min-width: ${standardPadding}; min-height: ${standardPadding}; + max-width: 100%; flex-direction: row; justify-content: flex-start; + align-self: flex-start; flex-shrink: 0; font: ${bodyFont}; color: ${bodyFontColor}; @@ -31,7 +33,7 @@ export const styles = css` .container { display: flex; flex-direction: column; - max-width: calc(90%); + width: 100%; } [part='start'] { @@ -41,6 +43,7 @@ export const styles = css` .message-content { width: fit-content; height: fit-content; + max-width: 100%; overflow-x: auto; } diff --git a/packages/spright-components/src/chat/message/outbound/styles.ts b/packages/spright-components/src/chat/message/outbound/styles.ts index 412c3b0667..2a6c69886a 100644 --- a/packages/spright-components/src/chat/message/outbound/styles.ts +++ b/packages/spright-components/src/chat/message/outbound/styles.ts @@ -17,9 +17,11 @@ export const styles = css` :host { min-width: ${standardPadding}; min-height: ${standardPadding}; + max-width: 90%; flex-direction: row; justify-content: flex-end; + align-self: flex-end; flex-shrink: 0; font: ${bodyFont}; color: ${bodyFontColor}; @@ -28,12 +30,13 @@ export const styles = css` .container { display: flex; flex-direction: column; - max-width: calc(90%); + width: 100%; } .message-content { width: fit-content; height: fit-content; + max-width: 100%; overflow-x: auto; } diff --git a/packages/spright-components/src/chat/message/system/styles.ts b/packages/spright-components/src/chat/message/system/styles.ts index 30126d0d32..220708a205 100644 --- a/packages/spright-components/src/chat/message/system/styles.ts +++ b/packages/spright-components/src/chat/message/system/styles.ts @@ -13,9 +13,11 @@ export const styles = css` :host { min-width: ${standardPadding}; min-height: ${standardPadding}; + max-width: 90%; flex-direction: row; justify-content: center; + align-self: center; flex-shrink: 0; font: ${bodyFont}; color: ${bodyFontColor}; @@ -24,12 +26,13 @@ export const styles = css` .container { display: flex; flex-direction: column; - max-width: calc(90%); + width: 100%; } .message-content { width: fit-content; height: fit-content; + max-width: 100%; overflow-x: auto; } `; diff --git a/packages/spright-components/src/chat/message/welcome/styles.ts b/packages/spright-components/src/chat/message/welcome/styles.ts index f68d56bed7..11a500c195 100644 --- a/packages/spright-components/src/chat/message/welcome/styles.ts +++ b/packages/spright-components/src/chat/message/welcome/styles.ts @@ -18,10 +18,12 @@ export const styles = css` :host { min-width: ${standardPadding}; min-height: ${standardPadding}; + max-width: 90%; flex: 1; flex-direction: row; justify-content: center; + align-self: center; align-items: center; font: ${bodyFont}; color: ${bodyFontColor}; @@ -31,7 +33,6 @@ export const styles = css` display: flex; flex-direction: column; align-items: center; - max-width: calc(90%); gap: ${mediumPadding}; } @@ -65,6 +66,7 @@ export const styles = css` align-items: center; width: fit-content; height: fit-content; + max-width: 100%; overflow-x: auto; gap: ${mediumPadding}; } diff --git a/packages/storybook/src/spright/chat/conversation/chat-conversation-matrix.stories.ts b/packages/storybook/src/spright/chat/conversation/chat-conversation-matrix.stories.ts index 861450bcc1..9be62935e4 100644 --- a/packages/storybook/src/spright/chat/conversation/chat-conversation-matrix.stories.ts +++ b/packages/storybook/src/spright/chat/conversation/chat-conversation-matrix.stories.ts @@ -353,10 +353,10 @@ const conversationWithInput = ( height: ${height}; "> <${chatMessageInboundTag}> - Conversation is ${heightLabel} than the height of the messages. Lorem ipsum dolor sit amet. + Conversation is ${heightLabel} than the height of the messages. Lorem ipsum dolor sit amet, consectetur adipiscing elit. <${chatMessageOutboundTag} message-type="outbound"> - Conversation is ${heightLabel} than the height of the messages. Lorem ipsum dolor sit amet. + Conversation is ${heightLabel} than the height of the messages. Lorem ipsum dolor sit amet, consectetur adipiscing elit. <${chatInputTag} slot='input'> @@ -383,10 +383,10 @@ const conversationWithToolbar = ( <${chatMessageInboundTag}> - Conversation is ${heightLabel} than the height of the messages. Lorem ipsum dolor sit amet. + Conversation is ${heightLabel} than the height of the messages. Lorem ipsum dolor sit amet, consectetur adipiscing elit. <${chatMessageOutboundTag} message-type="outbound"> - Conversation is ${heightLabel} than the height of the messages. Lorem ipsum dolor sit amet. + Conversation is ${heightLabel} than the height of the messages. Lorem ipsum dolor sit amet, consectetur adipiscing elit. <${chatInputTag} slot='input'> @@ -410,10 +410,10 @@ const conversationWithStart = ( This is a banner in the start slot. <${chatMessageInboundTag}> - Conversation is ${heightLabel} than the height of the messages. Lorem ipsum dolor sit amet. + Conversation is ${heightLabel} than the height of the messages. Lorem ipsum dolor sit amet, consectetur adipiscing elit. <${chatMessageOutboundTag} message-type="outbound"> - Conversation is ${heightLabel} than the height of the messages. Lorem ipsum dolor sit amet. + Conversation is ${heightLabel} than the height of the messages. Lorem ipsum dolor sit amet, consectetur adipiscing elit. <${chatInputTag} slot='input'> @@ -444,10 +444,10 @@ const conversationWithToolbarAndStart = ( This is a banner in the start slot. <${chatMessageInboundTag}> - Conversation is ${heightLabel} than the height of the messages. Lorem ipsum dolor sit amet. + Conversation is ${heightLabel} than the height of the messages. Lorem ipsum dolor sit amet, consectetur adipiscing elit. <${chatMessageOutboundTag} message-type="outbound"> - Conversation is ${heightLabel} than the height of the messages. Lorem ipsum dolor sit amet. + Conversation is ${heightLabel} than the height of the messages. Lorem ipsum dolor sit amet, consectetur adipiscing elit. <${chatInputTag} slot='input'> @@ -478,10 +478,10 @@ const conversationWithToolbarAndStartAndEnd = ( This is a banner in the start slot. <${chatMessageInboundTag}> - Conversation is ${heightLabel} than the height of the messages. Lorem ipsum dolor sit amet. + Conversation is ${heightLabel} than the height of the messages. Lorem ipsum dolor sit amet, consectetur adipiscing elit. <${chatMessageOutboundTag} message-type="outbound"> - Conversation is ${heightLabel} than the height of the messages. Lorem ipsum dolor sit amet. + Conversation is ${heightLabel} than the height of the messages. Lorem ipsum dolor sit amet, consectetur adipiscing elit. <${chatInputTag} slot='input'> diff --git a/packages/storybook/src/spright/chat/message/chat-message-matrix.stories.ts b/packages/storybook/src/spright/chat/message/chat-message-matrix.stories.ts index 61896c5b2a..8addc7f632 100644 --- a/packages/storybook/src/spright/chat/message/chat-message-matrix.stories.ts +++ b/packages/storybook/src/spright/chat/message/chat-message-matrix.stories.ts @@ -1,5 +1,6 @@ import type { StoryFn, Meta } from '@storybook/html-vite'; import { html } from '@ni/fast-element'; +import { chatConversationTag } from '@ni/spright-components/dist/esm/chat/conversation'; import { chatMessageTag } from '@ni/spright-components/dist/esm/chat/message'; import { chatMessageInboundTag } from '@ni/spright-components/dist/esm/chat/message/inbound'; import { chatMessageOutboundTag } from '@ni/spright-components/dist/esm/chat/message/outbound'; @@ -24,60 +25,80 @@ export default metadata; export const messageHidden: StoryFn = createStory( hiddenWrapper( - html`<${chatMessageTag} hidden>Hidden Chat Message` + html`<${chatConversationTag}> + <${chatMessageTag} hidden>Hidden Chat Message + ` ) ); export const messageTextCustomized: StoryFn = createMatrixThemeStory( textCustomizationWrapper( - html`<${chatMessageTag}>Message` + html`<${chatConversationTag}> + <${chatMessageTag}>Message + ` ) ); export const messageInboundHidden: StoryFn = createStory( hiddenWrapper( - html`<${chatMessageInboundTag} hidden>Hidden Chat Inbound Message` + html`<${chatConversationTag}> + <${chatMessageInboundTag} hidden>Hidden Chat Inbound Message + ` ) ); export const messageInboundTextCustomized: StoryFn = createMatrixThemeStory( textCustomizationWrapper( - html`<${chatMessageInboundTag}>Inbound Message` + html`<${chatConversationTag}> + <${chatMessageInboundTag}>Inbound Message + ` ) ); export const messageOutboundHidden: StoryFn = createStory( hiddenWrapper( - html`<${chatMessageOutboundTag} hidden>Hidden Chat Outbound Message` + html`<${chatConversationTag}> + <${chatMessageOutboundTag} hidden>Hidden Chat Outbound Message + ` ) ); export const messageOutboundTextCustomized: StoryFn = createMatrixThemeStory( textCustomizationWrapper( - html`<${chatMessageOutboundTag}>Outbound Message` + html`<${chatConversationTag}> + <${chatMessageOutboundTag}>Outbound Message + ` ) ); export const messageSystemHidden: StoryFn = createStory( hiddenWrapper( - html`<${chatMessageSystemTag} hidden>Hidden Chat System Message` + html`<${chatConversationTag}> + <${chatMessageSystemTag} hidden>Hidden Chat System Message + ` ) ); export const messageSystemTextCustomized: StoryFn = createMatrixThemeStory( textCustomizationWrapper( - html`<${chatMessageSystemTag}>System Message` + html`<${chatConversationTag}> + <${chatMessageSystemTag}>System Message + ` ) ); export const messageWelcomeHidden: StoryFn = createStory( hiddenWrapper( - html`<${chatMessageWelcomeTag} hidden welcome-title="Welcome" subtitle="Get started">Hidden Chat Welcome Message` + html`<${chatConversationTag}> + <${chatMessageWelcomeTag} hidden welcome-title="Welcome" subtitle="Get started">Hidden Chat Welcome Message + ` ) ); export const messageWelcomeTextCustomized: StoryFn = createMatrixThemeStory( textCustomizationWrapper( - html`<${chatMessageWelcomeTag} welcome-title="Welcome" subtitle="Get started">Welcome Message` + html`<${chatConversationTag}> + <${chatMessageWelcomeTag} welcome-title="Welcome" subtitle="Get started">Welcome Message + ` ) );