@swisper.ai/web-chat-ui 0.0.2 → 0.0.4
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/README.md +9 -12
- package/dist/components/canvas-shell/canvas-shell.d.ts +32 -10
- package/dist/components/canvas-shell/canvas-shell.d.ts.map +1 -1
- package/dist/components/canvas-shell/canvas-shell.stories.d.ts +49 -17
- package/dist/components/canvas-shell/canvas-shell.stories.d.ts.map +1 -1
- package/dist/components/chat-card/chat-card.d.ts +1 -0
- package/dist/components/chat-card/chat-card.d.ts.map +1 -1
- package/dist/components/chat-card/chat-card.stories.d.ts +47 -1
- package/dist/components/chat-card/chat-card.stories.d.ts.map +1 -1
- package/dist/components/chat-card/components/chat-card-body.d.ts +8 -0
- package/dist/components/chat-card/components/chat-card-body.d.ts.map +1 -1
- package/dist/components/chat-card/components/chat-card-footer.d.ts +8 -0
- package/dist/components/chat-card/components/chat-card-footer.d.ts.map +1 -1
- package/dist/components/chat-card/components/chat-card-form.d.ts +15 -2
- package/dist/components/chat-card/components/chat-card-form.d.ts.map +1 -1
- package/dist/components/chat-card/components/chat-card-header.d.ts +23 -2
- package/dist/components/chat-card/components/chat-card-header.d.ts.map +1 -1
- package/dist/components/chat-card/contexts.d.ts +2 -0
- package/dist/components/chat-card/contexts.d.ts.map +1 -1
- package/dist/components/chat-card/hooks.d.ts +1 -0
- package/dist/components/chat-card/hooks.d.ts.map +1 -1
- package/dist/components/chat-card/types.d.ts +3 -0
- package/dist/components/chat-card/types.d.ts.map +1 -1
- package/dist/components/chat-card-container/chat-card-container.d.ts +4 -0
- package/dist/components/chat-card-container/chat-card-container.d.ts.map +1 -1
- package/dist/components/chat-card-container/chat-card-container.stories.d.ts +12 -1
- package/dist/components/chat-card-container/chat-card-container.stories.d.ts.map +1 -1
- package/dist/components/chat-container/chat-container.d.ts.map +1 -1
- package/dist/components/chat-container/chat-container.stories.d.ts +36 -11
- package/dist/components/chat-container/chat-container.stories.d.ts.map +1 -1
- package/dist/components/chat-input/chat-input.d.ts +27 -2
- package/dist/components/chat-input/chat-input.d.ts.map +1 -1
- package/dist/components/chat-input/chat-input.stories.d.ts +63 -3
- package/dist/components/chat-input/chat-input.stories.d.ts.map +1 -1
- package/dist/components/chat-list/chat-list-item.d.ts +6 -0
- package/dist/components/chat-list/chat-list-item.d.ts.map +1 -1
- package/dist/components/chat-list/chat-list-items.d.ts +12 -1
- package/dist/components/chat-list/chat-list-items.d.ts.map +1 -1
- package/dist/components/chat-list/chat-list.d.ts +36 -2
- package/dist/components/chat-list/chat-list.d.ts.map +1 -1
- package/dist/components/chat-list/chat-list.stories.d.ts +67 -9
- package/dist/components/chat-list/chat-list.stories.d.ts.map +1 -1
- package/dist/components/chat-message/chat-message.d.ts +12 -1
- package/dist/components/chat-message/chat-message.d.ts.map +1 -1
- package/dist/components/chat-message/chat-message.stories.d.ts +31 -0
- package/dist/components/chat-message/chat-message.stories.d.ts.map +1 -1
- package/dist/components/chat-message/index.d.ts +1 -1
- package/dist/components/chat-message/index.d.ts.map +1 -1
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card-icon.d.ts +3 -0
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card-icon.d.ts.map +1 -1
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card.d.ts +25 -5
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card.d.ts.map +1 -1
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card.stories.d.ts +32 -1
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card.stories.d.ts.map +1 -1
- package/dist/components/chat-message-attachment-card/index.d.ts +2 -2
- package/dist/components/chat-message-attachment-card/index.d.ts.map +1 -1
- package/dist/components/chat-message-attachment-card/utils.d.ts +1 -0
- package/dist/components/chat-message-attachment-card/utils.d.ts.map +1 -1
- package/dist/components/chat-message-response/chat-message-response.stories.d.ts +13 -0
- package/dist/components/chat-message-response/chat-message-response.stories.d.ts.map +1 -1
- package/dist/components/chat-message-toolbar/chat-message-toolbar.d.ts +22 -5
- package/dist/components/chat-message-toolbar/chat-message-toolbar.d.ts.map +1 -1
- package/dist/components/chat-message-toolbar/chat-message-toolbar.stories.d.ts +42 -0
- package/dist/components/chat-message-toolbar/chat-message-toolbar.stories.d.ts.map +1 -1
- package/dist/components/chat-message-toolbar/index.d.ts +1 -1
- package/dist/components/chat-message-toolbar/index.d.ts.map +1 -1
- package/dist/components/chat-messages/chat-messages.d.ts +34 -2
- package/dist/components/chat-messages/chat-messages.d.ts.map +1 -1
- package/dist/components/chat-messages/chat-messages.stories.d.ts +33 -2
- package/dist/components/chat-messages/chat-messages.stories.d.ts.map +1 -1
- package/dist/components/chat-notification-card/chat-notification-card.d.ts +56 -4
- package/dist/components/chat-notification-card/chat-notification-card.d.ts.map +1 -1
- package/dist/components/chat-notification-card/chat-notification-card.stories.d.ts +50 -1
- package/dist/components/chat-notification-card/chat-notification-card.stories.d.ts.map +1 -1
- package/dist/components/chat-notification-popup/chat-notification-popup.d.ts +6 -0
- package/dist/components/chat-notification-popup/chat-notification-popup.d.ts.map +1 -1
- package/dist/components/chat-notification-popup/chat-notification-popup.stories.d.ts +43 -1
- package/dist/components/chat-notification-popup/chat-notification-popup.stories.d.ts.map +1 -1
- package/dist/components/chat-prompt-box/chat-prompt-box.d.ts +37 -17
- package/dist/components/chat-prompt-box/chat-prompt-box.d.ts.map +1 -1
- package/dist/components/chat-prompt-box/chat-prompt-box.stories.d.ts +53 -1
- package/dist/components/chat-prompt-box/chat-prompt-box.stories.d.ts.map +1 -1
- package/dist/components/chat-reply/chat-reply.d.ts +11 -0
- package/dist/components/chat-reply/chat-reply.d.ts.map +1 -1
- package/dist/components/chat-reply/chat-reply.stories.d.ts +23 -0
- package/dist/components/chat-reply/chat-reply.stories.d.ts.map +1 -1
- package/dist/components/chat-reply/index.d.ts +1 -1
- package/dist/components/chat-reply/index.d.ts.map +1 -1
- package/dist/components/chat-suggestion/chat-suggestion.d.ts +36 -10
- package/dist/components/chat-suggestion/chat-suggestion.d.ts.map +1 -1
- package/dist/components/chat-suggestion/chat-suggestion.stories.d.ts +66 -2
- package/dist/components/chat-suggestion/chat-suggestion.stories.d.ts.map +1 -1
- package/dist/components/chat-suggestion/index.d.ts +2 -1
- package/dist/components/chat-suggestion/index.d.ts.map +1 -1
- package/dist/components/chat-thinking-process/chat-thinking-process.d.ts +26 -1
- package/dist/components/chat-thinking-process/chat-thinking-process.d.ts.map +1 -1
- package/dist/components/chat-thinking-process/chat-thinking-process.stories.d.ts +25 -1
- package/dist/components/chat-thinking-process/chat-thinking-process.stories.d.ts.map +1 -1
- package/dist/components/chat-thread/chat-thread.d.ts +17 -2
- package/dist/components/chat-thread/chat-thread.d.ts.map +1 -1
- package/dist/components/chat-thread/chat-thread.stories.d.ts +75 -10
- package/dist/components/chat-thread/chat-thread.stories.d.ts.map +1 -1
- package/dist/components/index.d.ts +1 -3
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/markdown-viewer/markdown-viewer.d.ts +8 -1
- package/dist/components/markdown-viewer/markdown-viewer.d.ts.map +1 -1
- package/dist/components/markdown-viewer/markdown-viewer.stories.d.ts +18 -1
- package/dist/components/markdown-viewer/markdown-viewer.stories.d.ts.map +1 -1
- package/dist/components/rich-text-area/rich-text-area.d.ts +17 -0
- package/dist/components/rich-text-area/rich-text-area.d.ts.map +1 -1
- package/dist/components/rich-text-area/rich-text-area.stories.d.ts +52 -0
- package/dist/components/rich-text-area/rich-text-area.stories.d.ts.map +1 -1
- package/dist/components/rich-text-area/styled.d.ts +6 -2
- package/dist/components/rich-text-area/styled.d.ts.map +1 -1
- package/dist/components/rich-text-field/components/formatting-toolbar-plugin.d.ts +9 -2
- package/dist/components/rich-text-field/components/formatting-toolbar-plugin.d.ts.map +1 -1
- package/dist/components/rich-text-field/components/index.d.ts +5 -5
- package/dist/components/rich-text-field/components/index.d.ts.map +1 -1
- package/dist/components/rich-text-field/components/text-color-button.d.ts +12 -1
- package/dist/components/rich-text-field/components/text-color-button.d.ts.map +1 -1
- package/dist/components/rich-text-field/rich-text-field.d.ts +22 -0
- package/dist/components/rich-text-field/rich-text-field.d.ts.map +1 -1
- package/dist/components/rich-text-field/rich-text-field.stories.d.ts +28 -1
- package/dist/components/rich-text-field/rich-text-field.stories.d.ts.map +1 -1
- package/dist/components/topmenu/index.d.ts +2 -0
- package/dist/components/topmenu/index.d.ts.map +1 -0
- package/dist/components/topmenu/topmenu.d.ts +22 -0
- package/dist/components/topmenu/topmenu.d.ts.map +1 -0
- package/dist/components/topmenu/topmenu.stories.d.ts +31 -0
- package/dist/components/topmenu/topmenu.stories.d.ts.map +1 -0
- package/dist/docs/agent.stories.d.ts.map +1 -1
- package/dist/docs/chat-panel.d.ts +7 -5
- package/dist/docs/chat-panel.d.ts.map +1 -1
- package/dist/docs/chatbot-panel.d.ts.map +1 -1
- package/dist/docs/chatbot.stories.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.es.js +1227 -1260
- package/dist/index.es.js.map +1 -1
- package/dist/layouts/chat-card-list-layout/chat-card-list-layout.d.ts +9 -7
- package/dist/layouts/chat-card-list-layout/chat-card-list-layout.d.ts.map +1 -1
- package/dist/layouts/chat-card-list-layout/chat-card-list-layout.stories.d.ts +37 -9
- package/dist/layouts/chat-card-list-layout/chat-card-list-layout.stories.d.ts.map +1 -1
- package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.stories.d.ts +41 -16
- package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.stories.d.ts.map +1 -1
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.d.ts +6 -0
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.d.ts.map +1 -1
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.stories.d.ts +22 -1
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.stories.d.ts.map +1 -1
- package/package.json +15 -9
- package/src/__storybook__/parent-block.tsx +21 -0
- package/src/components/canvas-shell/__stories__/canvas-panel.tsx +25 -0
- package/src/components/canvas-shell/__stories__/document-list.tsx +29 -0
- package/src/components/canvas-shell/__stories__/fixtures.ts +222 -0
- package/src/components/canvas-shell/__stories__/holdings-table.tsx +56 -0
- package/src/components/canvas-shell/__stories__/types.ts +47 -0
- package/src/components/canvas-shell/{canvas-shell.test.tsx → __tests__/canvas-shell.spec.tsx} +1 -1
- package/src/components/canvas-shell/canvas-shell.json +24 -0
- package/src/components/canvas-shell/canvas-shell.stories.tsx +581 -122
- package/src/components/canvas-shell/canvas-shell.tsx +44 -17
- package/src/components/chat-card/__stories__/fixtures.ts +119 -0
- package/src/components/chat-card/__stories__/types.ts +44 -0
- package/src/components/chat-card/chat-card.json +67 -3
- package/src/components/chat-card/chat-card.stories.tsx +872 -148
- package/src/components/chat-card/chat-card.tsx +2 -0
- package/src/components/chat-card/components/chat-card-body.tsx +12 -0
- package/src/components/chat-card/components/chat-card-footer.tsx +11 -0
- package/src/components/chat-card/components/chat-card-form.tsx +21 -2
- package/src/components/chat-card/components/chat-card-header.tsx +39 -2
- package/src/components/chat-card/contexts.tsx +2 -0
- package/src/components/chat-card/hooks.ts +1 -0
- package/src/components/chat-card/types.ts +3 -0
- package/src/components/chat-card-container/__stories__/fixtures.ts +54 -0
- package/src/components/chat-card-container/__stories__/resizable-chat-window.tsx +19 -0
- package/src/components/chat-card-container/__stories__/result-card.tsx +31 -0
- package/src/components/chat-card-container/__stories__/types.ts +16 -0
- package/src/components/chat-card-container/chat-card-container.json +7 -0
- package/src/components/chat-card-container/chat-card-container.stories.tsx +209 -56
- package/src/components/chat-card-container/chat-card-container.tsx +5 -0
- package/src/components/chat-container/__stories__/chat-composer.tsx +67 -0
- package/src/components/chat-container/__stories__/fixtures.ts +27 -0
- package/src/components/chat-container/__stories__/measure.ts +22 -0
- package/src/components/chat-container/__stories__/types.ts +7 -0
- package/src/components/chat-container/__stories__/variable-readout.tsx +64 -0
- package/src/components/chat-container/chat-container.json +9 -1
- package/src/components/chat-container/chat-container.stories.tsx +538 -106
- package/src/components/chat-container/chat-container.tsx +3 -0
- package/src/components/chat-input/__stories__/fixtures.ts +31 -0
- package/src/components/chat-input/chat-input.json +10 -2
- package/src/components/chat-input/chat-input.stories.tsx +660 -197
- package/src/components/chat-input/chat-input.tsx +32 -2
- package/src/components/chat-list/__stories__/chat-row.tsx +41 -0
- package/src/components/chat-list/__stories__/fixtures.ts +94 -0
- package/src/components/chat-list/__stories__/types.ts +13 -0
- package/src/components/chat-list/chat-list-item.tsx +6 -0
- package/src/components/chat-list/chat-list-items.tsx +16 -0
- package/src/components/chat-list/chat-list.json +24 -2
- package/src/components/chat-list/chat-list.stories.tsx +631 -215
- package/src/components/chat-list/chat-list.tsx +51 -4
- package/src/components/chat-message/__stories__/fixtures.ts +53 -0
- package/src/components/chat-message/__stories__/sent-attachment.tsx +22 -0
- package/src/components/chat-message/__stories__/tool-steps.tsx +37 -0
- package/src/components/chat-message/chat-message.json +10 -1
- package/src/components/chat-message/chat-message.stories.tsx +282 -20
- package/src/components/chat-message/chat-message.tsx +16 -1
- package/src/components/chat-message/index.ts +8 -1
- package/src/components/chat-message-attachment-card/__stories__/fixtures.ts +30 -0
- package/src/components/chat-message-attachment-card/__stories__/types.ts +14 -0
- package/src/components/chat-message-attachment-card/chat-message-attachment-card-icon.tsx +4 -0
- package/src/components/chat-message-attachment-card/chat-message-attachment-card.json +20 -0
- package/src/components/chat-message-attachment-card/chat-message-attachment-card.stories.tsx +266 -51
- package/src/components/chat-message-attachment-card/chat-message-attachment-card.tsx +37 -4
- package/src/components/chat-message-attachment-card/index.ts +6 -0
- package/src/components/chat-message-attachment-card/utils.ts +1 -0
- package/src/components/chat-message-response/__stories__/fixtures.ts +50 -0
- package/src/components/chat-message-response/chat-message-response.json +5 -0
- package/src/components/chat-message-response/chat-message-response.stories.tsx +135 -26
- package/src/components/chat-message-toolbar/chat-message-toolbar.json +21 -3
- package/src/components/chat-message-toolbar/chat-message-toolbar.stories.tsx +377 -6
- package/src/components/chat-message-toolbar/chat-message-toolbar.tsx +47 -12
- package/src/components/chat-message-toolbar/index.ts +4 -0
- package/src/components/chat-messages/__stories__/conversation-frame.tsx +25 -0
- package/src/components/chat-messages/__stories__/conversation-group.tsx +22 -0
- package/src/components/chat-messages/__stories__/fixtures.ts +70 -0
- package/src/components/chat-messages/__stories__/types.ts +5 -0
- package/src/components/chat-messages/chat-messages.json +30 -12
- package/src/components/chat-messages/chat-messages.stories.tsx +439 -212
- package/src/components/chat-messages/chat-messages.tsx +46 -3
- package/src/components/chat-notification-card/__stories__/fixtures.ts +38 -0
- package/src/components/chat-notification-card/__stories__/types.ts +13 -0
- package/src/components/chat-notification-card/chat-notification-card.json +52 -2
- package/src/components/chat-notification-card/chat-notification-card.stories.tsx +542 -62
- package/src/components/chat-notification-card/chat-notification-card.tsx +97 -6
- package/src/components/chat-notification-popup/__stories__/fixtures.ts +36 -0
- package/src/components/chat-notification-popup/__stories__/notification-item.tsx +93 -0
- package/src/components/chat-notification-popup/__stories__/types.ts +14 -0
- package/src/components/chat-notification-popup/chat-notification-popup.json +14 -1
- package/src/components/chat-notification-popup/chat-notification-popup.stories.tsx +467 -17
- package/src/components/chat-notification-popup/chat-notification-popup.tsx +18 -3
- package/src/components/chat-prompt-box/__stories__/fixtures.ts +16 -0
- package/src/components/chat-prompt-box/__stories__/types.ts +8 -0
- package/src/components/chat-prompt-box/chat-prompt-box.json +25 -2
- package/src/components/chat-prompt-box/chat-prompt-box.stories.tsx +535 -43
- package/src/components/chat-prompt-box/chat-prompt-box.tsx +73 -19
- package/src/components/chat-reply/chat-reply.json +10 -0
- package/src/components/chat-reply/chat-reply.stories.tsx +264 -21
- package/src/components/chat-reply/chat-reply.tsx +15 -0
- package/src/components/chat-reply/index.ts +10 -1
- package/src/components/chat-suggestion/__stories__/fixtures.ts +16 -0
- package/src/components/chat-suggestion/__tests__/chat-suggestion.spec.tsx +185 -0
- package/src/components/chat-suggestion/chat-suggestion.json +62 -20
- package/src/components/chat-suggestion/chat-suggestion.stories.tsx +542 -58
- package/src/components/chat-suggestion/chat-suggestion.tsx +154 -65
- package/src/components/chat-suggestion/index.ts +9 -0
- package/src/components/chat-thinking-process/__stories__/fixtures.ts +56 -0
- package/src/components/chat-thinking-process/chat-thinking-process.json +28 -3
- package/src/components/chat-thinking-process/chat-thinking-process.stories.tsx +354 -78
- package/src/components/chat-thinking-process/chat-thinking-process.tsx +55 -4
- package/src/components/chat-thread/__stories__/fixtures.ts +171 -0
- package/src/components/chat-thread/__stories__/scroll-position.ts +9 -0
- package/src/components/chat-thread/__stories__/snippets.ts +129 -0
- package/src/components/chat-thread/__stories__/thread-frame.tsx +22 -0
- package/src/components/chat-thread/__stories__/thread-turns.tsx +35 -0
- package/src/components/chat-thread/__stories__/types.ts +12 -0
- package/src/components/chat-thread/__stories__/use-turn-stream.ts +78 -0
- package/src/components/chat-thread/chat-thread.json +23 -3
- package/src/components/chat-thread/chat-thread.stories.tsx +804 -142
- package/src/components/chat-thread/chat-thread.tsx +64 -16
- package/src/components/index.ts +1 -3
- package/src/components/markdown-viewer/__stories__/fixtures.ts +67 -0
- package/src/components/markdown-viewer/markdown-viewer.json +7 -1
- package/src/components/markdown-viewer/markdown-viewer.stories.tsx +219 -50
- package/src/components/markdown-viewer/markdown-viewer.tsx +9 -0
- package/src/components/rich-text-area/__stories__/fixtures.ts +30 -0
- package/src/components/rich-text-area/rich-text-area.json +6 -4
- package/src/components/rich-text-area/rich-text-area.stories.tsx +597 -41
- package/src/components/rich-text-area/rich-text-area.tsx +22 -1
- package/src/components/rich-text-area/styled.tsx +11 -5
- package/src/components/rich-text-field/__stories__/fixtures.ts +29 -0
- package/src/components/rich-text-field/components/formatting-toolbar-plugin.tsx +10 -1
- package/src/components/rich-text-field/components/index.ts +8 -5
- package/src/components/rich-text-field/components/text-color-button.tsx +16 -2
- package/src/components/rich-text-field/rich-text-field.json +3 -1
- package/src/components/rich-text-field/rich-text-field.stories.tsx +452 -61
- package/src/components/rich-text-field/rich-text-field.tsx +23 -0
- package/src/components/topmenu/index.ts +1 -0
- package/src/components/topmenu/topmenu.json +107 -0
- package/src/components/topmenu/topmenu.stories.tsx +334 -0
- package/src/components/topmenu/topmenu.tsx +71 -0
- package/src/docs/agent.stories.tsx +16 -16
- package/src/docs/chat-panel.tsx +37 -32
- package/src/docs/chatbot-panel.tsx +11 -2
- package/src/docs/chatbot.mdx +17 -12
- package/src/docs/chatbot.stories.tsx +7 -8
- package/src/layouts/chat-card-list-layout/__stories__/fixtures.ts +112 -0
- package/src/layouts/chat-card-list-layout/__stories__/result-card.tsx +36 -0
- package/src/layouts/chat-card-list-layout/__stories__/types.ts +31 -0
- package/src/layouts/chat-card-list-layout/chat-card-list-layout.json +14 -1
- package/src/layouts/chat-card-list-layout/chat-card-list-layout.stories.tsx +316 -84
- package/src/layouts/chat-card-list-layout/chat-card-list-layout.tsx +11 -7
- package/src/layouts/chat-card-three-column-layout/__stories__/fixtures.ts +117 -0
- package/src/layouts/chat-card-three-column-layout/__stories__/resizable-chat-window.tsx +18 -0
- package/src/layouts/chat-card-three-column-layout/__stories__/stay-details.tsx +85 -0
- package/src/layouts/chat-card-three-column-layout/__stories__/stay-list.tsx +50 -0
- package/src/layouts/chat-card-three-column-layout/__stories__/stay-map.tsx +44 -0
- package/src/layouts/chat-card-three-column-layout/__stories__/stay-rooms.tsx +61 -0
- package/src/layouts/chat-card-three-column-layout/__stories__/types.ts +35 -0
- package/src/layouts/chat-card-three-column-layout/chat-card-three-column-layout.json +16 -0
- package/src/layouts/chat-card-three-column-layout/chat-card-three-column-layout.stories.tsx +603 -182
- package/src/layouts/chat-card-two-column-layout/__stories__/connection-itinerary.tsx +51 -0
- package/src/layouts/chat-card-two-column-layout/__stories__/fixtures.ts +83 -0
- package/src/layouts/chat-card-two-column-layout/__stories__/route-map.tsx +24 -0
- package/src/layouts/chat-card-two-column-layout/__stories__/types.ts +15 -0
- package/src/layouts/chat-card-two-column-layout/chat-card-two-column-layout.json +13 -1
- package/src/layouts/chat-card-two-column-layout/chat-card-two-column-layout.stories.tsx +368 -67
- package/src/layouts/chat-card-two-column-layout/chat-card-two-column-layout.tsx +11 -2
- package/dist/components/card-item-picker/card-item-picker-context.d.ts +0 -21
- package/dist/components/card-item-picker/card-item-picker-context.d.ts.map +0 -1
- package/dist/components/card-item-picker/card-item-picker-list.d.ts +0 -24
- package/dist/components/card-item-picker/card-item-picker-list.d.ts.map +0 -1
- package/dist/components/card-item-picker/card-item-picker-row-parts.d.ts +0 -28
- package/dist/components/card-item-picker/card-item-picker-row-parts.d.ts.map +0 -1
- package/dist/components/card-item-picker/card-item-picker-row.d.ts +0 -12
- package/dist/components/card-item-picker/card-item-picker-row.d.ts.map +0 -1
- package/dist/components/card-item-picker/card-item-picker.stories.d.ts +0 -19
- package/dist/components/card-item-picker/card-item-picker.stories.d.ts.map +0 -1
- package/dist/components/card-item-picker/index.d.ts +0 -9
- package/dist/components/card-item-picker/index.d.ts.map +0 -1
- package/dist/components/chat-message-history/chat-message-history.d.ts +0 -48
- package/dist/components/chat-message-history/chat-message-history.d.ts.map +0 -1
- package/dist/components/chat-message-history/chat-message-history.stories.d.ts +0 -7
- package/dist/components/chat-message-history/chat-message-history.stories.d.ts.map +0 -1
- package/dist/components/chat-message-history/index.d.ts +0 -2
- package/dist/components/chat-message-history/index.d.ts.map +0 -1
- package/dist/components/spinner/index.d.ts +0 -2
- package/dist/components/spinner/index.d.ts.map +0 -1
- package/dist/components/spinner/spinner.d.ts +0 -9
- package/dist/components/spinner/spinner.d.ts.map +0 -1
- package/dist/components/spinner/spinner.stories.d.ts +0 -8
- package/dist/components/spinner/spinner.stories.d.ts.map +0 -1
- package/src/components/card-item-picker/__tests__/card-item-picker.spec.tsx +0 -279
- package/src/components/card-item-picker/card-item-picker-context.tsx +0 -44
- package/src/components/card-item-picker/card-item-picker-list.tsx +0 -95
- package/src/components/card-item-picker/card-item-picker-row-parts.tsx +0 -96
- package/src/components/card-item-picker/card-item-picker-row.tsx +0 -109
- package/src/components/card-item-picker/card-item-picker.json +0 -147
- package/src/components/card-item-picker/card-item-picker.stories.tsx +0 -158
- package/src/components/card-item-picker/index.ts +0 -24
- package/src/components/chat-message-history/chat-message-history.json +0 -99
- package/src/components/chat-message-history/chat-message-history.stories.tsx +0 -136
- package/src/components/chat-message-history/chat-message-history.tsx +0 -277
- package/src/components/chat-message-history/index.ts +0 -13
- package/src/components/spinner/index.ts +0 -1
- package/src/components/spinner/spinner.json +0 -73
- package/src/components/spinner/spinner.stories.tsx +0 -41
- package/src/components/spinner/spinner.tsx +0 -32
package/src/docs/chat-panel.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useState, type ReactNode } from 'react';
|
|
1
|
+
import { useState, type ReactNode, type Ref } from 'react';
|
|
2
2
|
|
|
3
3
|
import { ArrowUpwardAltIcon, StopIcon } from '@swisper.ai/icons';
|
|
4
4
|
import { Button, IconButton } from '@swisper.ai/ui';
|
|
@@ -13,7 +13,12 @@ import {
|
|
|
13
13
|
CanvasShellHeader,
|
|
14
14
|
CanvasShellTitle,
|
|
15
15
|
} from '../components/canvas-shell';
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
ChatPromptBox,
|
|
18
|
+
ChatPromptBoxActionsRight,
|
|
19
|
+
ChatPromptBoxContent,
|
|
20
|
+
ChatPromptBoxInput,
|
|
21
|
+
} from '../components/chat-prompt-box';
|
|
17
22
|
|
|
18
23
|
export interface ChatComposerProps {
|
|
19
24
|
draft: string;
|
|
@@ -23,10 +28,12 @@ export interface ChatComposerProps {
|
|
|
23
28
|
/** While a reply is in progress: sending is disabled, or replaced by Stop when `onStop` is given */
|
|
24
29
|
isBusy: boolean;
|
|
25
30
|
onStop?: () => void;
|
|
31
|
+
/** The editable element, e.g. to return focus to it after a suggestion is sent */
|
|
32
|
+
inputRef?: Ref<HTMLDivElement>;
|
|
26
33
|
className?: string;
|
|
27
34
|
}
|
|
28
35
|
|
|
29
|
-
/** The
|
|
36
|
+
/** The prompt box with its send button, which becomes Stop while busy when `onStop` is given. */
|
|
30
37
|
export function ChatComposer({
|
|
31
38
|
draft,
|
|
32
39
|
onDraftChange,
|
|
@@ -34,24 +41,18 @@ export function ChatComposer({
|
|
|
34
41
|
placeholder,
|
|
35
42
|
isBusy,
|
|
36
43
|
onStop,
|
|
44
|
+
inputRef,
|
|
37
45
|
className,
|
|
38
46
|
}: ChatComposerProps) {
|
|
39
47
|
return (
|
|
40
|
-
<
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
'rounded-[20px] border border-solid border-transparent bg-paper-elevation-2',
|
|
45
|
-
'px-12 py-7 outline-none transition-[border-color] duration-150',
|
|
46
|
-
'data-[focused=true]:border-primary-main',
|
|
47
|
-
)}
|
|
48
|
-
>
|
|
49
|
-
<ChatInputTextarea
|
|
48
|
+
<ChatPromptBox className={className}>
|
|
49
|
+
<ChatPromptBoxContent>
|
|
50
|
+
<ChatPromptBoxInput
|
|
51
|
+
ref={inputRef}
|
|
50
52
|
value={draft}
|
|
51
53
|
onChange={onDraftChange}
|
|
52
54
|
autoFocus={false}
|
|
53
55
|
placeholder={placeholder}
|
|
54
|
-
className="text-text-primary"
|
|
55
56
|
onKeyDown={(event) => {
|
|
56
57
|
if (event.key === 'Enter' && !event.shiftKey) {
|
|
57
58
|
event.preventDefault();
|
|
@@ -59,24 +60,26 @@ export function ChatComposer({
|
|
|
59
60
|
}
|
|
60
61
|
}}
|
|
61
62
|
/>
|
|
62
|
-
</ChatInput>
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
64
|
+
<ChatPromptBoxActionsRight>
|
|
65
|
+
{isBusy && onStop ? (
|
|
66
|
+
<IconButton variant="secondary" size="md" aria-label="Stop" onClick={onStop}>
|
|
67
|
+
<StopIcon />
|
|
68
|
+
</IconButton>
|
|
69
|
+
) : (
|
|
70
|
+
<IconButton
|
|
71
|
+
variant="primary"
|
|
72
|
+
size="md"
|
|
73
|
+
aria-label="Send message"
|
|
74
|
+
isDisabled={!draft.trim() || isBusy}
|
|
75
|
+
onClick={onSend}
|
|
76
|
+
>
|
|
77
|
+
<ArrowUpwardAltIcon />
|
|
78
|
+
</IconButton>
|
|
79
|
+
)}
|
|
80
|
+
</ChatPromptBoxActionsRight>
|
|
81
|
+
</ChatPromptBoxContent>
|
|
82
|
+
</ChatPromptBox>
|
|
80
83
|
);
|
|
81
84
|
}
|
|
82
85
|
|
|
@@ -96,7 +99,7 @@ export interface ChatPanelFrameProps extends Omit<ChatComposerProps, 'className'
|
|
|
96
99
|
|
|
97
100
|
/**
|
|
98
101
|
* The right-hand side panel the Chatbot docs stories share: a CanvasShell with a header (full screen, close),
|
|
99
|
-
* the conversation, and a footer with the
|
|
102
|
+
* the conversation, and a footer with the prompt box and its send button. It fills its parent, so give
|
|
100
103
|
* the story a sized parent.
|
|
101
104
|
*/
|
|
102
105
|
export function ChatPanelFrame({
|
|
@@ -111,6 +114,7 @@ export function ChatPanelFrame({
|
|
|
111
114
|
placeholder,
|
|
112
115
|
isBusy,
|
|
113
116
|
onStop,
|
|
117
|
+
inputRef,
|
|
114
118
|
onClose,
|
|
115
119
|
}: ChatPanelFrameProps) {
|
|
116
120
|
const [isOpen, setIsOpen] = useState(true);
|
|
@@ -164,6 +168,7 @@ export function ChatPanelFrame({
|
|
|
164
168
|
placeholder={placeholder}
|
|
165
169
|
isBusy={isBusy}
|
|
166
170
|
onStop={onStop}
|
|
171
|
+
inputRef={inputRef}
|
|
167
172
|
/>
|
|
168
173
|
</CanvasShellFooter>
|
|
169
174
|
</CanvasShell>
|
|
@@ -192,6 +192,7 @@ export function ChatbotPanel({ initialTurns, initialQuestion, onClose }: Chatbot
|
|
|
192
192
|
const [pending, setPending] = useState<PendingReply | null>(null);
|
|
193
193
|
const [draft, setDraft] = useState('');
|
|
194
194
|
const hasSentInitialQuestion = useRef(false);
|
|
195
|
+
const inputRef = useRef<HTMLDivElement>(null);
|
|
195
196
|
|
|
196
197
|
const isStreaming = pending !== null;
|
|
197
198
|
const suggestions = SUGGESTIONS.filter((text) => !turns.some((turn) => turn.question === text));
|
|
@@ -249,13 +250,21 @@ export function ChatbotPanel({ initialTurns, initialQuestion, onClose }: Chatbot
|
|
|
249
250
|
onSend={() => send(draft)}
|
|
250
251
|
placeholder="Ask about your finances"
|
|
251
252
|
isBusy={isStreaming}
|
|
253
|
+
inputRef={inputRef}
|
|
252
254
|
onClose={onClose}
|
|
253
255
|
footerTop={
|
|
254
256
|
!isStreaming &&
|
|
255
257
|
suggestions.length > 0 && (
|
|
256
|
-
<ChatSuggestions>
|
|
258
|
+
<ChatSuggestions aria-label="Suggested questions">
|
|
257
259
|
{suggestions.map((text) => (
|
|
258
|
-
<ChatSuggestion
|
|
260
|
+
<ChatSuggestion
|
|
261
|
+
key={text}
|
|
262
|
+
onSelect={() => {
|
|
263
|
+
send(text);
|
|
264
|
+
// The suggestions unmount while the reply streams; keep focus in the panel.
|
|
265
|
+
inputRef.current?.focus();
|
|
266
|
+
}}
|
|
267
|
+
>
|
|
259
268
|
<ChatSuggestionLabelIcon />
|
|
260
269
|
<ChatSuggestionLabel isMultiline={false}>{text}</ChatSuggestionLabel>
|
|
261
270
|
<ChatSuggestionActions>
|
package/src/docs/chatbot.mdx
CHANGED
|
@@ -5,7 +5,7 @@ import * as AgentStories from './agent.stories';
|
|
|
5
5
|
|
|
6
6
|
{/* Standalone, not attached to a story file: attaching it would turn that story into a folder */}
|
|
7
7
|
|
|
8
|
-
<Meta title="
|
|
8
|
+
<Meta title="Chat/Overview" />
|
|
9
9
|
|
|
10
10
|
<Title>Chatbot</Title>
|
|
11
11
|
<Subtitle>An assistant chat in a right-hand panel, assembled from the Chatbot parts</Subtitle>
|
|
@@ -54,8 +54,12 @@ stream in.
|
|
|
54
54
|
<CanvasShellFooter>
|
|
55
55
|
<ChatSuggestions />
|
|
56
56
|
{/* follow-up questions */}
|
|
57
|
-
<
|
|
58
|
-
|
|
57
|
+
<ChatPromptBox>
|
|
58
|
+
<ChatPromptBoxContent>
|
|
59
|
+
<ChatPromptBoxInput />
|
|
60
|
+
<ChatPromptBoxActionsRight>{/* the send IconButton */}</ChatPromptBoxActionsRight>
|
|
61
|
+
</ChatPromptBoxContent>
|
|
62
|
+
</ChatPromptBox>
|
|
59
63
|
</CanvasShellFooter>
|
|
60
64
|
</CanvasShell>
|
|
61
65
|
```
|
|
@@ -72,7 +76,8 @@ stream in.
|
|
|
72
76
|
- **`ChatMessageToolbar`**: timestamp and actions under an answer, shown on hover through
|
|
73
77
|
`ChatMessageActions`.
|
|
74
78
|
- **`ChatSuggestions`**: follow-up questions; picking one sends it.
|
|
75
|
-
- **`
|
|
79
|
+
- **`ChatPromptBox`**: the composer box around the rich-text editor, with the send button in its
|
|
80
|
+
trailing slot; Enter sends, Shift+Enter adds a line.
|
|
76
81
|
|
|
77
82
|
## Composition rules
|
|
78
83
|
|
|
@@ -134,11 +139,11 @@ transcript fills the height and the composer sits under it.
|
|
|
134
139
|
|
|
135
140
|
## Parts
|
|
136
141
|
|
|
137
|
-
- [CanvasShell](?path=/docs/
|
|
138
|
-
- [ChatThread](?path=/docs/
|
|
139
|
-
- [ChatMessage](?path=/docs/
|
|
140
|
-
- [ChatThinkingProcess](?path=/docs/
|
|
141
|
-
- [ChatMessageToolbar](?path=/docs/
|
|
142
|
-
- [MarkdownViewer](?path=/docs/
|
|
143
|
-
- [ChatSuggestion](?path=/docs/
|
|
144
|
-
- [
|
|
142
|
+
- [CanvasShell](?path=/docs/chat-canvasshell--docs)
|
|
143
|
+
- [ChatThread](?path=/docs/chat-chatthread--docs)
|
|
144
|
+
- [ChatMessage](?path=/docs/chat-chatmessage--docs)
|
|
145
|
+
- [ChatThinkingProcess](?path=/docs/chat-chatthinkingprocess--docs)
|
|
146
|
+
- [ChatMessageToolbar](?path=/docs/chat-chatmessagetoolbar--docs)
|
|
147
|
+
- [MarkdownViewer](?path=/docs/chat-markdownviewer--docs)
|
|
148
|
+
- [ChatSuggestion](?path=/docs/chat-chatsuggestion--docs)
|
|
149
|
+
- [ChatPromptBox](?path=/docs/chat-chatpromptbox--docs)
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
import { expect, fn, userEvent, within } from 'storybook/test';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { withTooltip } from '@swisper.ai/ui';
|
|
5
5
|
|
|
6
6
|
import { ChatbotPanel, SUGGESTIONS } from './chatbot-panel';
|
|
7
7
|
|
|
8
8
|
// One story whose name matches the title's last segment, so the sidebar shows a single entry
|
|
9
9
|
// instead of a folder
|
|
10
10
|
const meta: Meta<typeof ChatbotPanel> = {
|
|
11
|
-
title: '
|
|
11
|
+
title: 'Chat/Chatbot',
|
|
12
12
|
component: ChatbotPanel,
|
|
13
13
|
parameters: {
|
|
14
14
|
layout: 'fullscreen',
|
|
@@ -16,12 +16,11 @@ const meta: Meta<typeof ChatbotPanel> = {
|
|
|
16
16
|
},
|
|
17
17
|
decorators: [
|
|
18
18
|
(Story) => (
|
|
19
|
-
<
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
</div>
|
|
23
|
-
</TooltipProvider>
|
|
19
|
+
<div className="h-dvh">
|
|
20
|
+
<Story />
|
|
21
|
+
</div>
|
|
24
22
|
),
|
|
23
|
+
withTooltip,
|
|
25
24
|
],
|
|
26
25
|
args: {
|
|
27
26
|
initialTurns: [],
|
|
@@ -55,7 +54,7 @@ export const Chatbot: Story = {
|
|
|
55
54
|
play: async ({ canvasElement }) => {
|
|
56
55
|
const canvas = within(canvasElement);
|
|
57
56
|
|
|
58
|
-
await userEvent.click(canvas.
|
|
57
|
+
await userEvent.click(canvas.getByRole('button', { name: SUGGESTIONS[0] }));
|
|
59
58
|
|
|
60
59
|
const thread = await canvas.findByLabelText('Chat message history');
|
|
61
60
|
await expect(await within(thread).findByText(SUGGESTIONS[0])).toBeVisible();
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { CalendarEvent, EmailSummary, TrainConnection } from './types';
|
|
2
|
+
|
|
3
|
+
// Shaped like the rows an inbox search returns: one long subject, one message without a text body.
|
|
4
|
+
export const EMAILS: EmailSummary[] = [
|
|
5
|
+
{
|
|
6
|
+
id: 'email_01',
|
|
7
|
+
subject: 'Agenda for the offsite on 14 November',
|
|
8
|
+
from: 'mara.keller@company.com',
|
|
9
|
+
date: 'Oct 27, 14:00',
|
|
10
|
+
preview: 'Here is the draft agenda. Tell me by Friday if a session is missing.',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
id: 'email_02',
|
|
14
|
+
subject: 'Invoice 2026-1043 is ready',
|
|
15
|
+
from: 'billing@company.com',
|
|
16
|
+
date: 'Oct 27, 09:12',
|
|
17
|
+
preview: null,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: 'email_03',
|
|
21
|
+
subject: 'Re: Re: Fwd: Updated seating plan for the quarterly review, with the room change',
|
|
22
|
+
from: 'jonas.frei@company.com',
|
|
23
|
+
date: 'Oct 26, 17:48',
|
|
24
|
+
preview: 'The review moves to the large room on the third floor. Seats are as before.',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: 'email_04',
|
|
28
|
+
subject: 'Your train ticket to Geneva',
|
|
29
|
+
from: 'tickets@company.com',
|
|
30
|
+
date: 'Oct 26, 08:03',
|
|
31
|
+
preview: 'Your ticket for 28 October is attached. Show it together with your half-fare card.',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: 'email_05',
|
|
35
|
+
subject: 'Feedback on the onboarding draft',
|
|
36
|
+
from: 'lea.baumann@company.com',
|
|
37
|
+
date: 'Oct 24, 16:20',
|
|
38
|
+
preview: 'Two comments on the second section, the rest reads well.',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: 'email_06',
|
|
42
|
+
subject: 'Lunch on Thursday?',
|
|
43
|
+
from: 'noah.meier@company.com',
|
|
44
|
+
date: 'Oct 24, 11:35',
|
|
45
|
+
preview: 'The place by the river has a table at 12:15 if you are in.',
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
|
|
49
|
+
// Two events: fewer than the default limit of three.
|
|
50
|
+
export const CALENDAR_EVENTS: CalendarEvent[] = [
|
|
51
|
+
{
|
|
52
|
+
id: 'event_01',
|
|
53
|
+
title: 'Quarterly review',
|
|
54
|
+
time: 'Tue, Oct 28, 10:00 to 11:30',
|
|
55
|
+
location: 'Room Säntis, third floor',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: 'event_02',
|
|
59
|
+
title: 'Call with the onboarding team',
|
|
60
|
+
time: 'Tue, Oct 28, 14:00 to 14:30',
|
|
61
|
+
location: null,
|
|
62
|
+
},
|
|
63
|
+
];
|
|
64
|
+
|
|
65
|
+
// Shaped like the connections a transport search returns; the third one has the long route.
|
|
66
|
+
export const TRAIN_CONNECTIONS: TrainConnection[] = [
|
|
67
|
+
{
|
|
68
|
+
id: 'conn_01',
|
|
69
|
+
line: 'IC 1',
|
|
70
|
+
route: 'Zurich HB → Geneva Airport',
|
|
71
|
+
departure: '08:02',
|
|
72
|
+
arrival: '10:57',
|
|
73
|
+
duration: '2h 55m',
|
|
74
|
+
transfers: 0,
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: 'conn_02',
|
|
78
|
+
line: 'IR 15',
|
|
79
|
+
route: 'Zurich HB → Geneva',
|
|
80
|
+
departure: '08:32',
|
|
81
|
+
arrival: '11:16',
|
|
82
|
+
duration: '2h 44m',
|
|
83
|
+
transfers: 0,
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
id: 'conn_03',
|
|
87
|
+
line: 'IC 5',
|
|
88
|
+
route: 'Zurich HB → Geneva Airport via Biel/Bienne and Neuchâtel',
|
|
89
|
+
departure: '09:03',
|
|
90
|
+
arrival: '11:58',
|
|
91
|
+
duration: '2h 55m',
|
|
92
|
+
transfers: 1,
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
id: 'conn_04',
|
|
96
|
+
line: 'IC 1',
|
|
97
|
+
route: 'Zurich HB → Geneva Airport',
|
|
98
|
+
departure: '09:02',
|
|
99
|
+
arrival: '11:57',
|
|
100
|
+
duration: '2h 55m',
|
|
101
|
+
transfers: 0,
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
id: 'conn_05',
|
|
105
|
+
line: 'IR 15',
|
|
106
|
+
route: 'Zurich HB → Geneva',
|
|
107
|
+
departure: '09:32',
|
|
108
|
+
arrival: '12:16',
|
|
109
|
+
duration: '2h 44m',
|
|
110
|
+
transfers: 0,
|
|
111
|
+
},
|
|
112
|
+
];
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
ChatCard,
|
|
5
|
+
ChatCardBody,
|
|
6
|
+
ChatCardContent,
|
|
7
|
+
ChatCardHeader,
|
|
8
|
+
ChatCardHeaderContent,
|
|
9
|
+
ChatCardSubTitle,
|
|
10
|
+
ChatCardTitle,
|
|
11
|
+
} from '../../../components/chat-card';
|
|
12
|
+
|
|
13
|
+
export interface ResultCardProps {
|
|
14
|
+
title: string;
|
|
15
|
+
subTitle: string;
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** One card of a result list: a title, a line under it and, when there is one, a body. */
|
|
20
|
+
export function ResultCard({ title, subTitle, children }: ResultCardProps) {
|
|
21
|
+
return (
|
|
22
|
+
<ChatCard fullWidth>
|
|
23
|
+
<ChatCardHeader>
|
|
24
|
+
<ChatCardHeaderContent>
|
|
25
|
+
<ChatCardTitle>{title}</ChatCardTitle>
|
|
26
|
+
<ChatCardSubTitle>{subTitle}</ChatCardSubTitle>
|
|
27
|
+
</ChatCardHeaderContent>
|
|
28
|
+
</ChatCardHeader>
|
|
29
|
+
{children ? (
|
|
30
|
+
<ChatCardBody>
|
|
31
|
+
<ChatCardContent>{children}</ChatCardContent>
|
|
32
|
+
</ChatCardBody>
|
|
33
|
+
) : null}
|
|
34
|
+
</ChatCard>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** An email as the list shows it: the header fields and a one-line preview. */
|
|
2
|
+
export interface EmailSummary {
|
|
3
|
+
id: string;
|
|
4
|
+
subject: string;
|
|
5
|
+
from: string;
|
|
6
|
+
/** Pre-formatted the way the card header shows it. */
|
|
7
|
+
date: string;
|
|
8
|
+
/** `null` when the message has no text body, only attachments. */
|
|
9
|
+
preview: string | null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** A calendar event as the list shows it. */
|
|
13
|
+
export interface CalendarEvent {
|
|
14
|
+
id: string;
|
|
15
|
+
title: string;
|
|
16
|
+
/** Pre-formatted the way the card header shows it. */
|
|
17
|
+
time: string;
|
|
18
|
+
/** `null` for an event without a room or an address. */
|
|
19
|
+
location: string | null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** One connection of a transport search. */
|
|
23
|
+
export interface TrainConnection {
|
|
24
|
+
id: string;
|
|
25
|
+
line: string;
|
|
26
|
+
route: string;
|
|
27
|
+
departure: string;
|
|
28
|
+
arrival: string;
|
|
29
|
+
duration: string;
|
|
30
|
+
transfers: number;
|
|
31
|
+
}
|
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
"$schema": "../../../../int-eslint-config/schemas/component.schema.json",
|
|
3
3
|
"component": "chat-card-list-layout",
|
|
4
4
|
"purpose": "Holds a list of chat cards in a message and shows only the first few, revealing the rest behind a one-way \"show more\" button. Parts: ChatCardListLayout (root and state), ChatCardListLayoutItems (the visible slice), ChatCardListLayoutShowMore (the reveal button), plus useChatCardListLayoutContext for custom triggers.",
|
|
5
|
+
"anatomy": [
|
|
6
|
+
"import {",
|
|
7
|
+
" ChatCardListLayout,",
|
|
8
|
+
" ChatCardListLayoutItems,",
|
|
9
|
+
" ChatCardListLayoutShowMore,",
|
|
10
|
+
"} from '@swisper.ai/web-chat-ui';",
|
|
11
|
+
"",
|
|
12
|
+
"<ChatCardListLayout>",
|
|
13
|
+
" <ChatCardListLayoutItems />",
|
|
14
|
+
" <ChatCardListLayoutShowMore />",
|
|
15
|
+
"</ChatCardListLayout>"
|
|
16
|
+
],
|
|
5
17
|
"useWhen": [
|
|
6
18
|
"An assistant message returns more cards than fit at a glance (flight options, search results, places) and the rest should stay one click away",
|
|
7
19
|
"A long list of cards would push the reply taller than a phone viewport",
|
|
@@ -52,7 +64,8 @@
|
|
|
52
64
|
"Controlled (expanded) the layout does not expand on its own: clicking reports onExpandedChange(true) and the owner sets expanded; setting expanded back to false re-collapses the list and brings the button back",
|
|
53
65
|
"onExpandedChange is called with true on every show-more click, controlled or not",
|
|
54
66
|
"By default the root stacks its children in a column, left-aligned, with an 8px gap; a className on the root replaces direction, gap and alignment (merged with tailwind-merge), so the same layout serves a horizontal strip",
|
|
55
|
-
"The root carries data-expanded and the group/chat-card-list-layout marker, so descendants can style on group-data-[expanded=true]/chat-card-list-layout",
|
|
67
|
+
"The root carries data-slot=chat-card-list-layout, data-expanded and the group/chat-card-list-layout marker, so descendants can style on group-data-[expanded=true]/chat-card-list-layout",
|
|
68
|
+
"ChatCardListLayoutShowMore carries data-slot=chat-card-list-layout-show-more on the button it renders, in place of the button's own data-slot=button",
|
|
56
69
|
"ChatCardListLayoutShowMore forwards every ui/button prop; by default it is a small tertiary button centred under the cards, and variant, size or className passed to it win",
|
|
57
70
|
"useChatCardListLayoutContext returns visibleCount, isExpanded, expand and hiddenCount; hiddenCount is 0 on the first render and correct before the first paint",
|
|
58
71
|
"Every part and useChatCardListLayoutContext throw \"[web-chat-ui] … must be used within a ChatCardListLayout\" when rendered outside the root",
|