@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
|
@@ -34,12 +34,20 @@ function useChatMessagesContext() {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
export interface ChatMessagesProps {
|
|
37
|
+
/** A `ChatMessagesList` and an optional `ChatMessagesScrollButton`. */
|
|
37
38
|
children: ReactNode;
|
|
39
|
+
/** Classes merged last onto the root (`data-slot="chat-messages"`). */
|
|
38
40
|
className?: string;
|
|
41
|
+
/** Number of rows `ChatMessagesList` renders; changing it scrolls the last row into view. */
|
|
39
42
|
messageCount?: number;
|
|
43
|
+
/** Space in px between rows and between the messages inside a `ChatMessageListGroup`. */
|
|
40
44
|
gap?: number;
|
|
41
45
|
}
|
|
42
46
|
|
|
47
|
+
/**
|
|
48
|
+
* Root of a conversation that scrolls itself. It holds the row count and the gap, and has to be
|
|
49
|
+
* rendered inside a `ChatConversationProvider`, which owns the scroll state.
|
|
50
|
+
*/
|
|
43
51
|
export function ChatMessages({
|
|
44
52
|
children,
|
|
45
53
|
className,
|
|
@@ -56,6 +64,7 @@ export function ChatMessages({
|
|
|
56
64
|
return (
|
|
57
65
|
<ChatMessagesContext.Provider value={contextValue}>
|
|
58
66
|
<div
|
|
67
|
+
data-slot="chat-messages"
|
|
59
68
|
data-testid="chat-messages"
|
|
60
69
|
className={cn('relative flex min-h-0 flex-1 flex-col', className)}
|
|
61
70
|
style={{ '--chat-messages-gap': `${gap}px` } as CSSProperties}
|
|
@@ -67,14 +76,27 @@ export function ChatMessages({
|
|
|
67
76
|
}
|
|
68
77
|
|
|
69
78
|
export interface ChatMessagesListProps {
|
|
79
|
+
/** Render function for one row; it gets the row's index and returns a `ChatMessageListGroup`. */
|
|
70
80
|
children: (index: number) => ReactNode;
|
|
81
|
+
/** Classes merged last onto the `role="log"` list (`data-slot="chat-messages-list"`). */
|
|
71
82
|
className?: string;
|
|
83
|
+
/** Classes merged last onto the scroll container (`data-slot="chat-messages-scroll-area"`). */
|
|
84
|
+
scrollAreaClassName?: string;
|
|
85
|
+
/** Classes merged last onto the scrolling viewport (`data-slot="chat-messages-viewport"`). */
|
|
86
|
+
viewportClassName?: string;
|
|
87
|
+
/** Classes merged last onto the hidden end sentinel the list uses to detect the bottom. */
|
|
72
88
|
bottomTriggerClassName?: string;
|
|
73
89
|
}
|
|
74
90
|
|
|
91
|
+
/**
|
|
92
|
+
* The scrolling list: renders `messageCount` rows from its render function inside a `role="log"`
|
|
93
|
+
* list, and scrolls the last row to the top of the view when the count changes.
|
|
94
|
+
*/
|
|
75
95
|
export function ChatMessagesList({
|
|
76
96
|
children,
|
|
77
97
|
className,
|
|
98
|
+
scrollAreaClassName,
|
|
99
|
+
viewportClassName,
|
|
78
100
|
bottomTriggerClassName,
|
|
79
101
|
}: ChatMessagesListProps) {
|
|
80
102
|
const { viewportRef, bottomTriggerRef, scrollToLatest } = useChatConversationContext();
|
|
@@ -92,19 +114,23 @@ export function ChatMessagesList({
|
|
|
92
114
|
|
|
93
115
|
return (
|
|
94
116
|
<ScrollAreaPrimitive.Root
|
|
117
|
+
data-slot="chat-messages-scroll-area"
|
|
95
118
|
className={cn(
|
|
96
119
|
'min-h-0 flex-1',
|
|
97
120
|
'relative group/scroll-area',
|
|
98
121
|
'overflow-y-hidden',
|
|
99
122
|
'transform-gpu',
|
|
123
|
+
scrollAreaClassName,
|
|
100
124
|
)}
|
|
101
125
|
>
|
|
102
126
|
<ScrollAreaPrimitive.Viewport
|
|
103
127
|
ref={viewportRef}
|
|
104
|
-
|
|
128
|
+
data-slot="chat-messages-viewport"
|
|
129
|
+
className={cn('@container-[size]', 'will-change-scroll h-full w-full', viewportClassName)}
|
|
105
130
|
style={{ scrollbarGutter: 'stable both-edges' }}
|
|
106
131
|
>
|
|
107
132
|
<ul
|
|
133
|
+
data-slot="chat-messages-list"
|
|
108
134
|
data-testid="chat-messages-list"
|
|
109
135
|
role="log"
|
|
110
136
|
aria-label="Message list"
|
|
@@ -119,6 +145,7 @@ export function ChatMessagesList({
|
|
|
119
145
|
|
|
120
146
|
<li
|
|
121
147
|
ref={bottomTriggerRef}
|
|
148
|
+
data-slot="chat-messages-bottom-trigger"
|
|
122
149
|
className={cn('h-px -mt-(--chat-messages-gap)', bottomTriggerClassName)}
|
|
123
150
|
aria-hidden="true"
|
|
124
151
|
/>
|
|
@@ -142,7 +169,7 @@ const ChatMessagesListRow = memo(function ChatMessagesListRow({
|
|
|
142
169
|
isLast,
|
|
143
170
|
}: ChatMessagesListRowProps) {
|
|
144
171
|
return (
|
|
145
|
-
<li>
|
|
172
|
+
<li data-slot="chat-messages-row">
|
|
146
173
|
<ChatMessagesListRowContext.Provider value={isLast}>
|
|
147
174
|
{children(index)}
|
|
148
175
|
</ChatMessagesListRowContext.Provider>
|
|
@@ -152,6 +179,10 @@ const ChatMessagesListRow = memo(function ChatMessagesListRow({
|
|
|
152
179
|
|
|
153
180
|
export interface ChatMessageListGroupProps extends ComponentProps<'div'> {}
|
|
154
181
|
|
|
182
|
+
/**
|
|
183
|
+
* One row's content: a question with its answer. The last group is at least as tall as the
|
|
184
|
+
* viewport, so a new question can settle at the top while its answer grows below it.
|
|
185
|
+
*/
|
|
155
186
|
export function ChatMessageListGroup({ children, className, ...rest }: ChatMessageListGroupProps) {
|
|
156
187
|
const isLast = useContext(ChatMessagesListRowContext);
|
|
157
188
|
const { lastItemRef } = useChatConversationContext();
|
|
@@ -159,6 +190,7 @@ export function ChatMessageListGroup({ children, className, ...rest }: ChatMessa
|
|
|
159
190
|
return (
|
|
160
191
|
<div
|
|
161
192
|
ref={isLast ? lastItemRef : undefined}
|
|
193
|
+
data-slot="chat-message-list-group"
|
|
162
194
|
data-is-last={isLast}
|
|
163
195
|
className={cn(
|
|
164
196
|
'flex flex-col gap-(--chat-messages-gap)',
|
|
@@ -173,8 +205,13 @@ export function ChatMessageListGroup({ children, className, ...rest }: ChatMessa
|
|
|
173
205
|
}
|
|
174
206
|
|
|
175
207
|
export interface ChatMessagesScrollButtonProps {
|
|
208
|
+
/** Classes merged last onto the positioned wrapper (`data-slot="chat-messages-scroll-button"`). */
|
|
176
209
|
className?: string;
|
|
210
|
+
/** Classes merged last onto the icon button inside the wrapper. */
|
|
211
|
+
buttonClassName?: string;
|
|
212
|
+
/** The button's tooltip and its `aria-label`. */
|
|
177
213
|
tooltip?: string;
|
|
214
|
+
/** Replaces the chevron icon. */
|
|
178
215
|
children?: ReactNode;
|
|
179
216
|
}
|
|
180
217
|
|
|
@@ -221,8 +258,13 @@ function ChatMessagesScrollBar({
|
|
|
221
258
|
);
|
|
222
259
|
}
|
|
223
260
|
|
|
261
|
+
/**
|
|
262
|
+
* Scroll-to-latest button over the list. It is hidden while the view is at the bottom and scrolls
|
|
263
|
+
* there when clicked.
|
|
264
|
+
*/
|
|
224
265
|
export const ChatMessagesScrollButton = memo(function ChatMessagesScrollButton({
|
|
225
266
|
className,
|
|
267
|
+
buttonClassName,
|
|
226
268
|
tooltip,
|
|
227
269
|
children,
|
|
228
270
|
}: ChatMessagesScrollButtonProps) {
|
|
@@ -230,6 +272,7 @@ export const ChatMessagesScrollButton = memo(function ChatMessagesScrollButton({
|
|
|
230
272
|
|
|
231
273
|
return (
|
|
232
274
|
<div
|
|
275
|
+
data-slot="chat-messages-scroll-button"
|
|
233
276
|
data-testid="chat-message-history-scroll-button"
|
|
234
277
|
data-hidden={isAtBottom}
|
|
235
278
|
aria-hidden={isAtBottom ? true : undefined}
|
|
@@ -249,7 +292,7 @@ export const ChatMessagesScrollButton = memo(function ChatMessagesScrollButton({
|
|
|
249
292
|
>
|
|
250
293
|
<Tooltip tooltip={tooltip} side={'top'}>
|
|
251
294
|
<IconButton
|
|
252
|
-
className=
|
|
295
|
+
className={cn('bg-paper-elevation-2', buttonClassName)}
|
|
253
296
|
color="primary"
|
|
254
297
|
size="md"
|
|
255
298
|
onClick={() => scrollBottom()}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { NotificationSignal } from './types';
|
|
2
|
+
|
|
3
|
+
export const FLIGHT_CHECK_IN: NotificationSignal = {
|
|
4
|
+
id: 'ntf_01',
|
|
5
|
+
category: 'Travel',
|
|
6
|
+
title: 'Check-in is open for your flight to Lisbon',
|
|
7
|
+
body: 'Online check-in for your Friday flight from Zurich to Lisbon opened this morning. It closes 60 minutes before departure at 07:25.',
|
|
8
|
+
createdAt: '1 min. ago',
|
|
9
|
+
isRead: false,
|
|
10
|
+
actions: ['Check in now'],
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
// The awkward row: a body long enough to clamp, and two actions.
|
|
14
|
+
export const BOARD_MEETING_MOVED: NotificationSignal = {
|
|
15
|
+
id: 'ntf_02',
|
|
16
|
+
category: 'Other',
|
|
17
|
+
title: 'Board meeting moved to Thursday',
|
|
18
|
+
body: 'Maya Keller moved the quarterly board meeting from Wednesday 14:00 to Thursday 09:30 and asked everyone to confirm by tomorrow noon. The new slot overlaps with your weekly product review, which has six attendees and no free room after 10:00. The agenda is unchanged: budget approval comes first, followed by the hiring plan and the office move.',
|
|
19
|
+
createdAt: '2 hrs. ago',
|
|
20
|
+
isRead: false,
|
|
21
|
+
actions: ['Confirm attendance', 'Propose another time'],
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const INVOICE_DUE: NotificationSignal = {
|
|
25
|
+
id: 'ntf_03',
|
|
26
|
+
category: 'Other',
|
|
27
|
+
title: 'Invoice from Alpenblick Hosting is due on Monday',
|
|
28
|
+
body: 'The March invoice for CHF 480.00 arrived last week and has not been paid yet.',
|
|
29
|
+
createdAt: '3 days ago',
|
|
30
|
+
isRead: true,
|
|
31
|
+
actions: [],
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const NOTIFICATIONS: NotificationSignal[] = [
|
|
35
|
+
FLIGHT_CHECK_IN,
|
|
36
|
+
BOARD_MEETING_MOVED,
|
|
37
|
+
INVOICE_DUE,
|
|
38
|
+
];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** A notification as the notification centre lists it, trimmed to the fields the card renders. */
|
|
2
|
+
export interface NotificationSignal {
|
|
3
|
+
id: string;
|
|
4
|
+
/** Category label, shown uppercased in the card header. */
|
|
5
|
+
category: 'Travel' | 'Other';
|
|
6
|
+
title: string;
|
|
7
|
+
body: string;
|
|
8
|
+
/** Relative time, pre-formatted the way the list shows it. */
|
|
9
|
+
createdAt: string;
|
|
10
|
+
isRead: boolean;
|
|
11
|
+
/** Labels of the follow-up actions the assistant suggests. */
|
|
12
|
+
actions: string[];
|
|
13
|
+
}
|
|
@@ -2,6 +2,54 @@
|
|
|
2
2
|
"$schema": "../../../../int-eslint-config/schemas/component.schema.json",
|
|
3
3
|
"component": "chat-notification-card",
|
|
4
4
|
"purpose": "Compact, expandable notification item with an icon, an uppercase title, a priority chip, a timestamp and read, snooze, delete or close actions.",
|
|
5
|
+
"anatomy": [
|
|
6
|
+
"import {",
|
|
7
|
+
" ChatNotificationCard,",
|
|
8
|
+
" ChatNotificationCardHead,",
|
|
9
|
+
" ChatNotificationCardHeader,",
|
|
10
|
+
" ChatNotificationCardHeaderIcon,",
|
|
11
|
+
" ChatNotificationCardHeaderTitle,",
|
|
12
|
+
" ChatNotificationCardHeaderTitleLabel,",
|
|
13
|
+
" ChatNotificationCardHeaderStatus,",
|
|
14
|
+
" ChatNotificationCardActions,",
|
|
15
|
+
" ChatNotificationCardTimestamp,",
|
|
16
|
+
" ChatNotificationCardButtons,",
|
|
17
|
+
" ChatNotificationCardReadActionButton,",
|
|
18
|
+
" ChatNotificationCardSnoozeButton,",
|
|
19
|
+
" ChatNotificationCardDeleteButton,",
|
|
20
|
+
" ChatNotificationCardCloseButton,",
|
|
21
|
+
" ChatNotificationCardContent,",
|
|
22
|
+
" ChatNotificationCardContentTitle,",
|
|
23
|
+
" ChatNotificationCardContentDescription,",
|
|
24
|
+
" ChatNotificationCardContentActions,",
|
|
25
|
+
"} from '@swisper.ai/web-chat-ui';",
|
|
26
|
+
"",
|
|
27
|
+
"<ChatNotificationCard>",
|
|
28
|
+
" <ChatNotificationCardHead>",
|
|
29
|
+
" <ChatNotificationCardHeader>",
|
|
30
|
+
" <ChatNotificationCardHeaderIcon />",
|
|
31
|
+
" <ChatNotificationCardHeaderTitle>",
|
|
32
|
+
" <ChatNotificationCardHeaderTitleLabel />",
|
|
33
|
+
" <ChatNotificationCardHeaderStatus />",
|
|
34
|
+
" </ChatNotificationCardHeaderTitle>",
|
|
35
|
+
" </ChatNotificationCardHeader>",
|
|
36
|
+
" <ChatNotificationCardActions>",
|
|
37
|
+
" <ChatNotificationCardTimestamp />",
|
|
38
|
+
" <ChatNotificationCardButtons>",
|
|
39
|
+
" <ChatNotificationCardReadActionButton />",
|
|
40
|
+
" <ChatNotificationCardSnoozeButton />",
|
|
41
|
+
" <ChatNotificationCardDeleteButton />",
|
|
42
|
+
" <ChatNotificationCardCloseButton />",
|
|
43
|
+
" </ChatNotificationCardButtons>",
|
|
44
|
+
" </ChatNotificationCardActions>",
|
|
45
|
+
" </ChatNotificationCardHead>",
|
|
46
|
+
" <ChatNotificationCardContent>",
|
|
47
|
+
" <ChatNotificationCardContentTitle />",
|
|
48
|
+
" <ChatNotificationCardContentDescription />",
|
|
49
|
+
" <ChatNotificationCardContentActions />",
|
|
50
|
+
" </ChatNotificationCardContent>",
|
|
51
|
+
"</ChatNotificationCard>"
|
|
52
|
+
],
|
|
5
53
|
"useWhen": [
|
|
6
54
|
"Listing notifications such as system updates or overdue tasks in a notification panel or popup",
|
|
7
55
|
"Showing one notification on its own over the chat, with snooze and close instead of read and delete",
|
|
@@ -28,7 +76,7 @@
|
|
|
28
76
|
"The expand button stays focusable while invisible (opacity 0 until the card is hovered or expanded)"
|
|
29
77
|
],
|
|
30
78
|
"aria": [
|
|
31
|
-
"Root: role=alert with aria-expanded and data-
|
|
79
|
+
"Root: role=alert with aria-expanded, data-expanded and data-variant",
|
|
32
80
|
"Read, snooze, delete and close buttons carry built-in aria-labels ('Mark notifications as read', 'Snooze notification', 'Delete notification', 'Close notification'); the snoozed state renders a text button instead",
|
|
33
81
|
"Expand button: aria-expanded",
|
|
34
82
|
"ChatNotificationCardActions, ChatNotificationCardButtons and ChatNotificationCardContentActions render role=group"
|
|
@@ -53,7 +101,9 @@
|
|
|
53
101
|
"getSnoozeUntilDate(minutes) returns a Date that many minutes from now; formatSnoozeDate(date) formats the remaining days, hours and minutes",
|
|
54
102
|
"ChatNotificationCardHeaderTitleLabel is semibold, uppercase and truncated to one line",
|
|
55
103
|
"ChatNotificationCardContentActions shows only while the card is expanded",
|
|
56
|
-
"variant is
|
|
104
|
+
"variant is set on the root as data-variant: floating adds a border in the divider colour, default has none",
|
|
105
|
+
"Every part carries data-slot='chat-notification-card-{part}' and takes className, merged last. State is on attributes: data-expanded and data-variant on the root, data-priority on the status chip, data-read on the read button, data-snoozed on the snooze button",
|
|
106
|
+
"Inner elements that are not parts take their own class prop: overlayClassName on the root for the hover overlay, labelClassName and cancelLabelClassName on ChatNotificationCardSnoozeButton for the two labels of the snoozed button",
|
|
57
107
|
"ChatNotificationCardIcon, ChatNotificationCardDescription and ChatNotificationCardTimeStamp are aliases of ChatNotificationCardHeaderIcon, ChatNotificationCardContentDescription and ChatNotificationCardTimestamp; use the full names"
|
|
58
108
|
]
|
|
59
109
|
},
|