An open source design system that's fully customizable and agent ready
TypeScript
chore(storybook): ChatComposerInput punctuation trigger story (#7553)
Cindy Zhang9d2b65628e70
diff --git a/apps/storybook/stories/ChatComposerInput.stories.tsx b/apps/storybook/stories/ChatComposerInput.stories.tsxindex 24734cc449..ca6c72df50 100644--- a/apps/storybook/stories/ChatComposerInput.stories.tsx+++ b/apps/storybook/stories/ChatComposerInput.stories.tsx@@ -77,6 +77,16 @@ const COMMANDS: SearchableItem<{description: string}>[] = [const userSource = createStaticSource(USERS);const commandSource = createStaticSource(COMMANDS);+const EMOJIS: SearchableItem[] = [+ {id: 'smile', label: 'smile (π)'},+ {id: 'heart', label: 'heart (β€οΈ)'},+ {id: 'thumbsup', label: 'thumbsup (π)'},+ {id: 'fire', label: 'fire (π₯)'},+ {id: 'rocket', label: 'rocket (π)'},+ {id: 'sparkles', label: 'sparkles (β¨)'},+];+const emojiSource = createStaticSource(EMOJIS);+const asyncUserSource: SearchSource = {search(query: string) {return new Promise(resolve => {@@ -771,3 +781,27 @@ export const GroupedItems: Story = {);},};++/** Punctuation trigger (e.g. emoji picker) β type : to see the menu */+export const PunctuationTrigger: Story = {+ render: () => {+ const emojiTrigger: ChatComposerTrigger = {+ character: ':',+ searchSource: emojiSource,+ renderItem: item => <TypeaheadItem item={item} />,+ onSelect: item => `:${item.id}: `,+ };++ return (+ <ChatComposer+ onSubmit={value => alert(`Sent: ${value}`)}+ input={+ <ChatComposerInput+ triggers={[emojiTrigger]}+ placeholder="Type : to see emoji suggestions..."+ />+ }+ />+ );+ },+};