Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create spright-chat-conversation and spright-chat-message components #2529

Merged
merged 68 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
8a3e0f7
Component APIs initial pass
jattasNI Nov 25, 2024
53d8a83
Copy rectange and rename ai-chat-text-bubble
jattasNI Nov 25, 2024
dde0e41
Fix build
jattasNI Nov 25, 2024
ff03a9e
Copy rectangle docs for AI Chat text bubble
jattasNI Nov 25, 2024
f318f03
Refactor into single MDX for all AI Chat components
jattasNI Nov 25, 2024
3996846
Start implementing chat bubble
jattasNI Nov 25, 2024
f31ed38
Remove "AI" from names
jattasNI Nov 25, 2024
2ba3b86
Rename bubbles to messages
jattasNI Nov 26, 2024
3f94aa5
Slot message content
jattasNI Nov 26, 2024
2837ba3
Markdown example
jattasNI Nov 26, 2024
9b5866c
positioning based on who sent message
jattasNI Nov 26, 2024
20f73fc
Move message under chat folder
jattasNI Nov 26, 2024
0b15993
Initial conversation component
jattasNI Nov 26, 2024
badb124
Docs for conversation
jattasNI Nov 26, 2024
5aaf44d
Padding between messages
jattasNI Nov 26, 2024
ecddda6
Only outgoing messages in bubbles
jattasNI Nov 27, 2024
d232c8e
background color
jattasNI Nov 27, 2024
df26a48
More example message types
jattasNI Nov 27, 2024
ad64243
Conversation vertical scroll
jattasNI Nov 27, 2024
dd13b59
Add window component (initially copied from conversation)
jattasNI Nov 27, 2024
3649d59
Window toolbars
jattasNI Nov 27, 2024
81b81aa
Chat input toolbar
jattasNI Nov 27, 2024
0eb06b5
Type in chat window
jattasNI Nov 27, 2024
2ac76a7
Merge branch 'main' into sprigiht-ai-components
jattasNI Dec 2, 2024
a67499c
Padding around conversation
jattasNI Dec 2, 2024
08ad339
Work around theme provider conflict in build
jattasNI Dec 2, 2024
e23117e
work around theme provider styles
jattasNI Dec 2, 2024
ffe0add
Merge branch 'main' into spright-chat-components
jattasNI Jan 17, 2025
2207d4f
Fixture errors
jattasNI Jan 21, 2025
463a99f
More Fixture build errors
jattasNI Jan 21, 2025
a57c934
Fix build
jattasNI Jan 21, 2025
cc8a9b2
Productize ChatConversation and ChatMessage elements
Jan 30, 2025
5809c06
Delete README.md
Jan 30, 2025
1e5b67a
Small tweaks
Jan 30, 2025
d05c23e
Merge branch 'main' into spright-chat-components-final
joseahdz Jan 30, 2025
0f6ab82
Update chat.stories.ts
Jan 31, 2025
d3a1010
Change files
Jan 31, 2025
4b9ca60
Fix lint and beachball errors
Jan 31, 2025
96d9bae
Reverted lock.json files
Jan 31, 2025
5c8584b
Implemented feedback
Jan 31, 2025
48f39dc
Merge branch 'main' into spright-chat-components-final
joseahdz Jan 31, 2025
3160b95
Simpsons reference
jattasNI Feb 3, 2025
5581ea4
Status table
jattasNI Feb 3, 2025
0232ae3
Improve doc content
jattasNI Feb 3, 2025
761c74a
linting
jattasNI Feb 3, 2025
f9558ce
Added chat messages of different sizes
Feb 4, 2025
4dfac11
Ran lint tool and added conversation tests
Feb 4, 2025
4314626
Fixed typo
Feb 4, 2025
a9fce4d
Implemented latest feedback.
Feb 5, 2025
02f1468
More feedback
Feb 6, 2025
75d40cf
Added margins to chat messages in storybook matrix stories
Feb 6, 2025
1d87912
Updating margins
Feb 6, 2025
5956cd5
Removed usage of png file and started using svg image
Feb 6, 2025
d798feb
Fixed formatting
Feb 7, 2025
3cbe591
Implemented Milan's feedback
Feb 9, 2025
ab06456
Use nimble icon svg
rajsite Feb 10, 2025
1e91cac
Merge branch 'main' into spright-chat-components-final
joseahdz Feb 10, 2025
7ab321e
Merge branch 'main' into spright-chat-components-final
rajsite Feb 11, 2025
8dd5207
Consistent chat-conversation naming
rajsite Feb 11, 2025
ab15b5b
Enable overflow on message content
rajsite Feb 11, 2025
df6e01a
Make message stories internal
rajsite Feb 11, 2025
0179425
lint
rajsite Feb 11, 2025
de82196
Remove duplicate config for messages
rajsite Feb 11, 2025
f80c5bb
Template consistency
rajsite Feb 12, 2025
19dc127
Refactor sizing stories
rajsite Feb 12, 2025
7d8c7aa
lint
rajsite Feb 12, 2025
9ee640b
Move overflow to inner message div
rajsite Feb 12, 2025
21b8704
Merge branch 'main' into spright-chat-components-final
rajsite Feb 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improve doc content
  • Loading branch information
jattasNI committed Feb 3, 2025
commit 0232ae3f3f73b1e1a65f4e73e65556e8d1bb2c51
28 changes: 20 additions & 8 deletions packages/storybook/src/spright/chat/chat.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ import { chatMessageTag } from '../../../../spright-components/src/chat/message'
<Meta of={chatStories} />
<Title of={chatStories} />

Chat components are used to conduct and display a conversation with a chat bot
or other users. The components can collect user input and display responses; the
Chat components are used to display a conversation with a chat bot
or other users. The components can display messages but the
application is responsible for connecting them to a source of data.

Components include low level chat messages and input fields and higher level
composite components representing an entire conversation.
Components include a chat message and a chat conversation, which is a collection of messages.

## API

Expand All @@ -29,20 +28,33 @@ messages in a conversation.
### Chat message

Use the <Tag name={chatMessageTag} /> element to display content in a message.
Clients can place any HTML content within the message.

#### Text message content

<Canvas of={chatStories.chatMessageText} />
<Controls of={chatStories.chatMessageText} />

#### Rich text message content

<Canvas of={chatStories.chatMessageRichText} />
<Controls of={chatStories.chatMessageRichText} />

#### Spinner message content

<Canvas of={chatStories.chatMessageSpinner} />
<Controls of={chatStories.chatMessageSpinner} />

#### Prompt buttons message content

<Canvas of={chatStories.chatMessagePrompts} />
<Controls of={chatStories.chatMessagePrompts} />

{/* ## Usage */}
## Usage

These components are part of [Spright](?path=/docs/spright-docs--docs). They can be used in production
applications but are not yet part of the core Nimble library for reasons including:

1. the interaction and visual design are iterating rapidly
2. we are unsure if the components are sufficiently atomic or general purpose to belong in Nimble
3. the implementation has not yet prioritized Nimble requirements like accessibility and support for all frameworks

{/* ## Accessibility */}

Expand Down
36 changes: 15 additions & 21 deletions packages/storybook/src/spright/chat/chat.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,14 @@ export const chatConversation: StoryObj<ChatConversation> = {
<${buttonTag} appearance='block'>Check core temperature</${buttonTag}>
</${chatMessageTag}>
</${chatConversationTag}>

`)
`),
argTypes: {
content: {
name: 'default',
description: 'The messages to display in the chat conversation. The DOM order of the messages controls their screen order within the conversation (earlier DOM order implies older message)',
table: { category: apiCategory.slots }
},
},
};

interface ChatMessageArgs {
Expand All @@ -67,13 +73,15 @@ export const chatMessageText: StoryObj<ChatMessageTextArgs> = {
`),
argTypes: {
text: {
description: 'The text to display in the chat message.',
name: 'default',
description: 'The content to display in the chat message.',
table: { category: apiCategory.slots }
},
messageType: {
name: 'message-type',
options: Object.keys(ChatMessageType),
control: { type: 'radio' },
description: 'The status of the chat message.',
description: 'The type of the chat message.',
table: { category: apiCategory.attributes }
}
},
Expand Down Expand Up @@ -135,18 +143,14 @@ export const chatMessageSpinner: StoryObj<ChatMessageArgs> = {
}
};

interface ChatMessagePrompts extends ChatMessageArgs {
prompt1: string;
prompt2: string;
}
export const chatMessagePrompts: StoryObj<ChatMessagePrompts> = {
export const chatMessagePrompts: StoryObj<ChatMessageArgs> = {
parameters: {
actions: {}
},
render: createUserSelectedThemeStory(html`
<${chatMessageTag} message-type=${x => x.messageType}>
<${buttonTag} appearance='block'>${x => x.prompt1}</${buttonTag}>
<${buttonTag} appearance='block'>${x => x.prompt2}</${buttonTag}>
<${buttonTag} appearance='block'>Eat my shorts</${buttonTag}>
<${buttonTag} appearance='block'>Do the Bartman</${buttonTag}>
</${chatMessageTag}>
`),
argTypes: {
Expand All @@ -156,18 +160,8 @@ export const chatMessagePrompts: StoryObj<ChatMessagePrompts> = {
description: 'The status of the chat message.',
table: { category: apiCategory.attributes }
},
prompt1: {
description: 'The first prompt text',
table: { category: apiCategory.slots }
},
prompt2: {
description: 'The second prompt text',
table: { category: apiCategory.slots }
}
},
args: {
messageType: ChatMessageType.system,
prompt1: 'Eat my shorts',
prompt2: 'Do the Bartman'
}
};
Loading