@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
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
/** @deprecated Use `FlexibleContainerVariant` from `@swisper.ai/cards-ui`. */
|
|
2
3
|
export type ChatCardContainerVariant = 'fixed' | 'fluid' | 'full';
|
|
4
|
+
/** @deprecated Use `FlexibleContainerProps` from `@swisper.ai/cards-ui`. */
|
|
3
5
|
export interface ChatCardContainerProps extends ComponentProps<'div'> {
|
|
4
6
|
children: ReactNode;
|
|
5
7
|
/**
|
|
@@ -38,6 +40,8 @@ export interface ChatCardContainerProps extends ComponentProps<'div'> {
|
|
|
38
40
|
* Both variables are read with a `100%` fallback, so a card rendered outside a
|
|
39
41
|
* `ChatContainer` (a portal, a test, a Storybook story) degrades to its parent's width
|
|
40
42
|
* instead of collapsing to zero.
|
|
43
|
+
*
|
|
44
|
+
* @deprecated Use `FlexibleContainer` from `@swisper.ai/cards-ui`.
|
|
41
45
|
*/
|
|
42
46
|
export declare function ChatCardContainer({ children, variant, inline, className, ...rest }: ChatCardContainerProps): import('react').JSX.Element;
|
|
43
47
|
//# sourceMappingURL=chat-card-container.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-card-container.d.ts","sourceRoot":"","sources":["../../../src/components/chat-card-container/chat-card-container.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvD,MAAM,MAAM,wBAAwB,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;AAElE,MAAM,WAAW,sBAAuB,SAAQ,cAAc,CAAC,KAAK,CAAC;IACnE,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,wBAAwB,CAAC;IACnC;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED
|
|
1
|
+
{"version":3,"file":"chat-card-container.d.ts","sourceRoot":"","sources":["../../../src/components/chat-card-container/chat-card-container.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvD,8EAA8E;AAC9E,MAAM,MAAM,wBAAwB,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;AAElE,4EAA4E;AAC5E,MAAM,WAAW,sBAAuB,SAAQ,cAAc,CAAC,KAAK,CAAC;IACnE,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,wBAAwB,CAAC;IACnC;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,OAAiB,EACjB,MAAc,EACd,SAAS,EACT,GAAG,IAAI,EACR,EAAE,sBAAsB,+BAuBxB"}
|
|
@@ -3,6 +3,11 @@ import { ChatCardContainer } from './chat-card-container';
|
|
|
3
3
|
declare const meta: Meta<typeof ChatCardContainer>;
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof ChatCardContainer>;
|
|
6
|
+
/**
|
|
7
|
+
* One card in the default `fixed` variant: it fills a narrow chat window and stops growing at
|
|
8
|
+
* the reading column in a wide one.
|
|
9
|
+
*/
|
|
10
|
+
export declare const Default: Story;
|
|
6
11
|
/**
|
|
7
12
|
* Drag the right edge past 820px: `fixed` stops growing at the reading column
|
|
8
13
|
* (736 − 16 = 720px), `fluid` hugs its content, `full` keeps tracking the window.
|
|
@@ -10,8 +15,14 @@ type Story = StoryObj<typeof ChatCardContainer>;
|
|
|
10
15
|
export declare const Variants: Story;
|
|
11
16
|
/**
|
|
12
17
|
* The inlined card must sit at the same visual inset as the text around it — one
|
|
13
|
-
* `--spacing-message` gutter, not two.
|
|
18
|
+
* `--spacing-message` gutter, not two. Drag the window below 820px and compare the card's left
|
|
19
|
+
* edge to the paragraphs; above that, `fixed` also centres the card in the reading column.
|
|
14
20
|
*/
|
|
15
21
|
export declare const Inline: Story;
|
|
22
|
+
/** Checks that an inline `full` card starts at the same left edge as the message text around it. */
|
|
23
|
+
export declare const InlineAlignsWithText: Story;
|
|
24
|
+
/** The container in each parent it's allowed in, then in a chat message list and a message body. */
|
|
25
|
+
export declare const Examples: Story;
|
|
26
|
+
/** Both props and both kinds of content on the Controls panel; drag the right edge to resize the chat window. */
|
|
16
27
|
export declare const Playground: Story;
|
|
17
28
|
//# sourceMappingURL=chat-card-container.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-card-container.stories.d.ts","sourceRoot":"","sources":["../../../src/components/chat-card-container/chat-card-container.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"chat-card-container.stories.d.ts","sourceRoot":"","sources":["../../../src/components/chat-card-container/chat-card-container.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAe5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,iBAAiB,CAgCxC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAmBhD;;;GAGG;AACH,eAAO,MAAM,OAAO,EAAE,KAQrB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,QAAQ,EAAE,KA2DtB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,MAAM,EAAE,KAmBpB,CAAC;AAEF,oGAAoG;AACpG,eAAO,MAAM,oBAAoB,EAAE,KAmClC,CAAC;AAEF,oGAAoG;AACpG,eAAO,MAAM,QAAQ,EAAE,KA2DtB,CAAC;AAEF,iHAAiH;AACjH,eAAO,MAAM,UAAU,EAAE,KAwBxB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-container.d.ts","sourceRoot":"","sources":["../../../src/components/chat-container/chat-container.tsx"],"names":[],"mappings":"AACA,OAAO,EAOL,KAAK,cAAc,EAEnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAyDf,MAAM,WAAW,kBAAmB,SAAQ,cAAc,CAAC,SAAS,CAAC;IACnE,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,aAAa,CAAC,EAC5B,OAAe,EACf,QAAQ,EACR,SAAS,EACT,YAAoC,EACpC,KAAK,EACL,GAAG,IAAI,EACR,EAAE,kBAAkB,+
|
|
1
|
+
{"version":3,"file":"chat-container.d.ts","sourceRoot":"","sources":["../../../src/components/chat-container/chat-container.tsx"],"names":[],"mappings":"AACA,OAAO,EAOL,KAAK,cAAc,EAEnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAyDf,MAAM,WAAW,kBAAmB,SAAQ,cAAc,CAAC,SAAS,CAAC;IACnE,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,aAAa,CAAC,EAC5B,OAAe,EACf,QAAQ,EACR,SAAS,EACT,YAAoC,EACpC,KAAK,EACL,GAAG,IAAI,EACR,EAAE,kBAAkB,+BAgDpB;AAoBD,MAAM,WAAW,sBAAuB,SAAQ,cAAc,CAAC,KAAK,CAAC;IACnE,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,OAAe,EACf,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACR,EAAE,sBAAsB,+BAexB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,OAAe,EACf,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACR,EAAE,sBAAsB,+BAexB"}
|
|
@@ -1,21 +1,46 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import {
|
|
2
|
+
import { ChatCardContainerVariant } from '../chat-card-container';
|
|
3
|
+
import { ChatContainer, ChatContainerProps } from './chat-container';
|
|
3
4
|
declare const meta: Meta<typeof ChatContainer>;
|
|
4
5
|
export default meta;
|
|
5
6
|
type Story = StoryObj<typeof ChatContainer>;
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* A chat window with its message list, a result card and the composer. Drag the dashed
|
|
9
|
+
* wrapper's right edge: `--chat-window-width` tracks the measured box, and
|
|
10
|
+
* `--message-list-content-width` stops at 736px in a wide window and follows a narrow one.
|
|
10
11
|
*/
|
|
11
12
|
export declare const Default: Story;
|
|
13
|
+
/** The window variables follow the measured box, and the reading column is clamped to the window. */
|
|
14
|
+
export declare const DefaultTracksWindow: Story;
|
|
15
|
+
/** `contentWidth` sets the reading column, and the window width still caps it. */
|
|
16
|
+
export declare const DefaultContentWidth: Story;
|
|
17
|
+
interface NewChatProps {
|
|
18
|
+
greeting: string;
|
|
19
|
+
onSend: (message: string) => void;
|
|
20
|
+
}
|
|
21
|
+
declare function NewChat({ greeting, onSend }: NewChatProps): import('react').JSX.Element;
|
|
22
|
+
type NewChatStory = StoryObj<typeof NewChat>;
|
|
12
23
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* box off and `--welcome-screen-box-height` returns to `unset` rather than leaving a
|
|
18
|
-
* stale height behind for the message list to reserve space for.
|
|
24
|
+
* The slot round-trip on a new chat: the welcome box and the composer measure themselves and
|
|
25
|
+
* their heights land on the container, where the message list reads them. Type a few lines and
|
|
26
|
+
* `--type-window-height` follows the composer; send the message and the welcome box unmounts,
|
|
27
|
+
* returning `--welcome-screen-box-height` to `unset`.
|
|
19
28
|
*/
|
|
20
|
-
export declare const MeasuredSlots:
|
|
29
|
+
export declare const MeasuredSlots: NewChatStory;
|
|
30
|
+
/** Grows the composer and sends the first message, checking both slot heights on the container. */
|
|
31
|
+
export declare const MeasuredSlotsRoundTrip: NewChatStory;
|
|
32
|
+
/** The container in each place it goes: a chat page, the chat side of a split pane and a full-screen chat. */
|
|
33
|
+
export declare const Examples: Story;
|
|
34
|
+
interface ChatContainerPlaygroundProps extends Omit<ChatContainerProps, 'children'> {
|
|
35
|
+
hasWelcome: boolean;
|
|
36
|
+
greeting: string;
|
|
37
|
+
hasCard: boolean;
|
|
38
|
+
variant: ChatCardContainerVariant;
|
|
39
|
+
hasPrompt: boolean;
|
|
40
|
+
composer: 'ChatPromptBox' | 'ChatInput';
|
|
41
|
+
onSend: (message: string) => void;
|
|
42
|
+
}
|
|
43
|
+
declare function ChatContainerPlayground({ asChild, hasWelcome, greeting, hasCard, variant, hasPrompt, composer, onSend, ...rest }: ChatContainerPlaygroundProps): import('react').JSX.Element;
|
|
44
|
+
/** Every slot and child at once in a resizable window, with each prop and part on the Controls panel. */
|
|
45
|
+
export declare const Playground: StoryObj<typeof ChatContainerPlayground>;
|
|
21
46
|
//# sourceMappingURL=chat-container.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-container.stories.d.ts","sourceRoot":"","sources":["../../../src/components/chat-container/chat-container.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"chat-container.stories.d.ts","sourceRoot":"","sources":["../../../src/components/chat-container/chat-container.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAe5D,OAAO,EAAqB,KAAK,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAO1F,OAAO,EACL,aAAa,EAGb,KAAK,kBAAkB,EACxB,MAAM,kBAAkB,CAAC;AAE1B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,aAAa,CAqCpC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,aAAa,CAAC,CAAC;AAW5C;;;;GAIG;AACH,eAAO,MAAM,OAAO,EAAE,KAsCrB,CAAC;AAYF,qGAAqG;AACrG,eAAO,MAAM,mBAAmB,EAAE,KAsCjC,CAAC;AAEF,kFAAkF;AAClF,eAAO,MAAM,mBAAmB,EAAE,KAkCjC,CAAC;AAEF,UAAU,YAAY;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED,iBAAS,OAAO,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,YAAY,+BA0DlD;AAED,KAAK,YAAY,GAAG,QAAQ,CAAC,OAAO,OAAO,CAAC,CAAC;AAE7C;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAE,YAW3B,CAAC;AAEF,mGAAmG;AACnG,eAAO,MAAM,sBAAsB,EAAE,YA8DpC,CAAC;AAEF,8GAA8G;AAC9G,eAAO,MAAM,QAAQ,EAAE,KAoHtB,CAAC;AAMF,UAAU,4BAA6B,SAAQ,IAAI,CAAC,kBAAkB,EAAE,UAAU,CAAC;IACjF,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,wBAAwB,CAAC;IAClC,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,eAAe,GAAG,WAAW,CAAC;IACxC,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED,iBAAS,uBAAuB,CAAC,EAC/B,OAAO,EACP,UAAU,EACV,QAAQ,EACR,OAAO,EACP,OAAO,EACP,SAAS,EACT,QAAQ,EACR,MAAM,EACN,GAAG,IAAI,EACR,EAAE,4BAA4B,+BA6D9B;AAED,yGAAyG;AACzG,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,OAAO,uBAAuB,CAuC/D,CAAC"}
|
|
@@ -9,27 +9,52 @@ interface ChatInputContextValue {
|
|
|
9
9
|
setHasError: (hasError: boolean) => void;
|
|
10
10
|
setHasValue: (hasValue: boolean) => void;
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* The editor state `ChatInput` tracks (`isFocused`, `hasValue`, `hasError`) and its setters.
|
|
14
|
+
* Throws when called outside a `ChatInput`.
|
|
15
|
+
*/
|
|
12
16
|
export declare function useChatInputContext(): ChatInputContextValue;
|
|
13
17
|
export declare const DEFAULT_CONFIG: ChatInputConfig;
|
|
14
18
|
export interface ChatInputProps extends ComponentPropsWithoutRef<'div'> {
|
|
19
|
+
/** Lexical composer config, read once on mount. Override only to add nodes or retheme. */
|
|
15
20
|
initialConfig?: ChatInputConfig;
|
|
16
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Root of the composer: holds the Lexical editor and puts its state on the wrapper as
|
|
24
|
+
* `data-focused`, `data-empty` and `data-error`. Ships unstyled.
|
|
25
|
+
*/
|
|
17
26
|
export declare const ChatInput: import('react').ForwardRefExoticComponent<ChatInputProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
18
|
-
export
|
|
19
|
-
|
|
27
|
+
export interface ChatInputPlaceholderProps extends ComponentPropsWithoutRef<'span'> {
|
|
28
|
+
}
|
|
29
|
+
export declare const ChatInputPlaceholder: import('react').ForwardRefExoticComponent<ChatInputPlaceholderProps & import('react').RefAttributes<HTMLSpanElement>>;
|
|
20
30
|
export interface ChatInputTextareaProps {
|
|
31
|
+
/** Classes for the editable element (`data-slot="chat-input-editable"`), not its wrapper. */
|
|
21
32
|
className?: string;
|
|
33
|
+
/** Inline styles for the wrapper around the editable element. */
|
|
22
34
|
style?: CSSProperties | undefined;
|
|
35
|
+
/** Classes for the placeholder (`data-slot="chat-input-placeholder"`). */
|
|
23
36
|
placeholderClassName?: string;
|
|
37
|
+
/** Shown while the editor is empty; also the editable's `aria-placeholder`. */
|
|
24
38
|
placeholder?: string;
|
|
39
|
+
/** Custom Lexical plugins; rendered inside the composer, after the built-in ones. */
|
|
25
40
|
children?: ReactNode;
|
|
41
|
+
/** Content as Markdown. When it differs from the editor's, it replaces the content. */
|
|
26
42
|
value?: string;
|
|
43
|
+
/** Focuses the editor on mount, caret at the end. Skipped when disabled or read-only. */
|
|
27
44
|
autoFocus?: boolean;
|
|
45
|
+
/** Blocks editing and selection and dims the wrapper (`data-disabled`). */
|
|
28
46
|
isDisabled?: boolean;
|
|
47
|
+
/** Blocks editing but keeps the text selectable (`data-readonly`). */
|
|
29
48
|
isReadOnly?: boolean;
|
|
49
|
+
/** Called with the content as Markdown on every edit. */
|
|
30
50
|
onChange?: (value: string) => void;
|
|
51
|
+
/** Key handler on the editable element; implement send-on-Enter here. */
|
|
31
52
|
onKeyDown?: (event: KeyboardEvent<HTMLDivElement>) => void;
|
|
32
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* The editable area of a `ChatInput`. Its value is a Markdown string; paste inserts plain
|
|
56
|
+
* text. Must be rendered inside a `ChatInput`.
|
|
57
|
+
*/
|
|
33
58
|
export declare const ChatInputTextarea: import('react').ForwardRefExoticComponent<ChatInputTextareaProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
34
59
|
export {};
|
|
35
60
|
//# sourceMappingURL=chat-input.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-input.d.ts","sourceRoot":"","sources":["../../../src/components/chat-input/chat-input.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,iBAAiB,EAAmB,MAAM,gCAAgC,CAAC;AAOzF,OAAO,KAAK,EAAE,aAAa,EAAE,wBAAwB,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAe/F,MAAM,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAEhD,UAAU,qBAAqB;IAC7B,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAElB,YAAY,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3C,WAAW,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,WAAW,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C;AAID,wBAAgB,mBAAmB,0BAQlC;AAED,eAAO,MAAM,cAAc,EAAE,eAe5B,CAAC;AAEF,MAAM,WAAW,cAAe,SAAQ,wBAAwB,CAAC,KAAK,CAAC;IACrE,aAAa,CAAC,EAAE,eAAe,CAAC;CACjC;AAED,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"chat-input.d.ts","sourceRoot":"","sources":["../../../src/components/chat-input/chat-input.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,iBAAiB,EAAmB,MAAM,gCAAgC,CAAC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AAU,CAAC,EAAE,OAAO,CAAC;IACrB,sEAAsE;IACtE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,yDAAyD;IACzD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,yEAAyE;IACzE,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;CAC5D;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,mHAsE7B,CAAC"}
|
|
@@ -1,14 +1,74 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { KeyboardEvent } from 'react';
|
|
2
3
|
import { ChatInput } from './chat-input';
|
|
3
4
|
declare const meta: Meta<typeof ChatInput>;
|
|
4
5
|
export default meta;
|
|
5
6
|
type Story = StoryObj<typeof ChatInput>;
|
|
7
|
+
/** The reply field under a notification: the unstyled editor with the border and focus colour its consumer gives it. */
|
|
6
8
|
export declare const Default: Story;
|
|
9
|
+
/** The editor takes focus on mount, which is the default; the line below reads the state from `useChatInputContext`. */
|
|
7
10
|
export declare const AutoFocus: Story;
|
|
8
|
-
|
|
11
|
+
interface ReplyDraftProps {
|
|
12
|
+
suggestions: string[];
|
|
13
|
+
onChange: (value: string) => void;
|
|
14
|
+
}
|
|
15
|
+
declare function ReplyDraft({ suggestions, onChange }: ReplyDraftProps): import('react').JSX.Element;
|
|
16
|
+
type ReplyDraftStory = StoryObj<typeof ReplyDraft>;
|
|
17
|
+
/** A controlled draft: picking a reply replaces the content, including one long enough to wrap, and clearing sets it to an empty string. */
|
|
18
|
+
export declare const Controlled: ReplyDraftStory;
|
|
19
|
+
/** A reply that is being sent: the draft stays visible but dimmed, and can't be edited or selected. */
|
|
9
20
|
export declare const Disabled: Story;
|
|
21
|
+
/** A reply Swisper is already acting on: it can't be edited, but stays readable and selectable. */
|
|
10
22
|
export declare const ReadOnly: Story;
|
|
23
|
+
/** The value is Markdown both ways: headings, lists, code and quotes load into the editor and come back in `onChange`, shown below it. */
|
|
11
24
|
export declare const ControlledMarkdown: Story;
|
|
12
|
-
|
|
13
|
-
|
|
25
|
+
interface QuickReplyProps {
|
|
26
|
+
placeholder: string;
|
|
27
|
+
onSend: (message: string) => void;
|
|
28
|
+
}
|
|
29
|
+
declare function QuickReply({ placeholder, onSend }: QuickReplyProps): import('react').JSX.Element;
|
|
30
|
+
type QuickReplyStory = StoryObj<typeof QuickReply>;
|
|
31
|
+
/** Send on Enter is the consumer's `onKeyDown`: it prevents the default, sends the trimmed draft and clears the value. */
|
|
32
|
+
export declare const SubmitOnEnter: QuickReplyStory;
|
|
33
|
+
interface SignalReplyInputProps {
|
|
34
|
+
placeholder: string;
|
|
35
|
+
onAction: (action: string) => void;
|
|
36
|
+
}
|
|
37
|
+
declare function SignalReplyInput({ placeholder, onAction }: SignalReplyInputProps): import('react').JSX.Element;
|
|
38
|
+
type SignalReplyInputStory = StoryObj<typeof SignalReplyInput>;
|
|
39
|
+
/** A small composer built from the editor and a send button beside it: the custom reply under a notification's suggested actions. */
|
|
40
|
+
export declare const SimplePromptBox: SignalReplyInputStory;
|
|
41
|
+
/** Typing fills the editor and flips the root's empty and focused attributes; an empty draft shows the placeholder. */
|
|
42
|
+
export declare const DefaultTypeAndFocus: Story;
|
|
43
|
+
/** The editor is focused as soon as the story mounts, and the context reports it. */
|
|
44
|
+
export declare const AutoFocusOnMount: Story;
|
|
45
|
+
/** Setting `value` replaces the content, and an empty string clears it and brings the placeholder back. */
|
|
46
|
+
export declare const ControlledFillAndClear: ReplyDraftStory;
|
|
47
|
+
/** A disabled editor is not editable, is marked disabled, and typing at it changes nothing. */
|
|
48
|
+
export declare const DisabledBlocksEditing: Story;
|
|
49
|
+
/** A read-only editor is not editable and is marked read-only, not disabled. */
|
|
50
|
+
export declare const ReadOnlyBlocksEditing: Story;
|
|
51
|
+
/** Loads a Markdown draft as formatted blocks and reports edits back as Markdown. */
|
|
52
|
+
export declare const ControlledMarkdownRoundTrip: Story;
|
|
53
|
+
/** Enter sends the trimmed draft and clears the editor; Shift+Enter and an empty draft send nothing. */
|
|
54
|
+
export declare const SubmitOnEnterSends: QuickReplyStory;
|
|
55
|
+
/** The send button submits the draft the same way Enter does, and does nothing while the draft is empty. */
|
|
56
|
+
export declare const SimplePromptBoxSendWithButton: SignalReplyInputStory;
|
|
57
|
+
/** The editor in each place it's allowed: a canvas footer, the chat container's prompt slot, a chat composer and a panel footer. */
|
|
58
|
+
export declare const Examples: Story;
|
|
59
|
+
interface ChatInputPlaygroundProps {
|
|
60
|
+
className: string;
|
|
61
|
+
placeholder: string;
|
|
62
|
+
value: string;
|
|
63
|
+
autoFocus: boolean;
|
|
64
|
+
isDisabled: boolean;
|
|
65
|
+
isReadOnly: boolean;
|
|
66
|
+
hasStateReadout: boolean;
|
|
67
|
+
hasClearOnEscape: boolean;
|
|
68
|
+
onChange: (value: string) => void;
|
|
69
|
+
onKeyDown: (event: KeyboardEvent<HTMLDivElement>) => void;
|
|
70
|
+
}
|
|
71
|
+
declare function ChatInputPlayground({ className, placeholder, value, autoFocus, isDisabled, isReadOnly, hasStateReadout, hasClearOnEscape, onChange, onKeyDown, }: ChatInputPlaygroundProps): import('react').JSX.Element;
|
|
72
|
+
/** The editor with a state readout and a custom plugin, and every textarea prop on the Controls panel. */
|
|
73
|
+
export declare const Playground: StoryObj<typeof ChatInputPlayground>;
|
|
14
74
|
//# sourceMappingURL=chat-input.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-input.stories.d.ts","sourceRoot":"","sources":["../../../src/components/chat-input/chat-input.stories.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chat-input.stories.d.ts","sourceRoot":"","sources":["../../../src/components/chat-input/chat-input.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,KAAK,EAAa,aAAa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B,CAAC,EAC3B,SAAS,EACT,WAAW,EACX,KAAK,EACL,SAAS,EACT,UAAU,EACV,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,SAAS,GACV,EAAE,wBAAwB,+BAiB1B;AAED,0GAA0G;AAC1G,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,OAAO,mBAAmB,CA0D3D,CAAC"}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
2
|
export interface ChatListItemProps extends ComponentPropsWithoutRef<'div'> {
|
|
3
3
|
children?: ReactNode;
|
|
4
|
+
/** Merges the item's props onto its only child, e.g. a link or a button, without adding a `div`. */
|
|
4
5
|
asChild?: boolean;
|
|
6
|
+
/** Marks the open conversation: sets `data-selected` and `aria-selected`. */
|
|
5
7
|
isSelected?: boolean;
|
|
6
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* One row's content, returned from the `ChatListItems` render function. It has no role, tab stop or
|
|
11
|
+
* look of its own: render it `asChild` over a link or button and style that from `data-selected`.
|
|
12
|
+
*/
|
|
7
13
|
export declare const ChatListItem: import('react').ForwardRefExoticComponent<ChatListItemProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
8
14
|
//# sourceMappingURL=chat-list-item.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-list-item.d.ts","sourceRoot":"","sources":["../../../src/components/chat-list/chat-list-item.tsx"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,wBAAwB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAIlF,MAAM,WAAW,iBAAkB,SAAQ,wBAAwB,CAAC,KAAK,CAAC;IACxE,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,YAAY,8GAmBvB,CAAC"}
|
|
1
|
+
{"version":3,"file":"chat-list-item.d.ts","sourceRoot":"","sources":["../../../src/components/chat-list/chat-list-item.tsx"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,wBAAwB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAIlF,MAAM,WAAW,iBAAkB,SAAQ,wBAAwB,CAAC,KAAK,CAAC;IACxE,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,oGAAoG;IACpG,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,6EAA6E;IAC7E,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,YAAY,8GAmBvB,CAAC"}
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
export interface ChatListItemsProps {
|
|
3
|
+
/** Render function called with each loaded row's index; return a `ChatListItem`. */
|
|
3
4
|
children: (index: number) => ReactNode;
|
|
4
5
|
className?: string;
|
|
6
|
+
/** Classes for the `ul` that holds the rows; merged after its defaults. */
|
|
5
7
|
listClassName?: string;
|
|
8
|
+
/** Classes for every `li`, the load-more row included; merged after its defaults. */
|
|
9
|
+
rowClassName?: string;
|
|
10
|
+
/** First guess of a row's height in pixels; rows are measured after they render. */
|
|
6
11
|
estimateSize?: number;
|
|
12
|
+
/** Rows rendered beyond the visible ones, above and below. */
|
|
7
13
|
overscan?: number;
|
|
14
|
+
/** Space between rows, in pixels. */
|
|
8
15
|
gap?: number;
|
|
9
16
|
}
|
|
10
|
-
|
|
17
|
+
/**
|
|
18
|
+
* The scrolling, virtualised rows of a `ChatList`. While `hasMore` is true it appends one row with
|
|
19
|
+
* the `ChatListLoadMore` content and calls `onLoadMore` when that row comes into range.
|
|
20
|
+
*/
|
|
21
|
+
export declare const ChatListItems: import('react').MemoExoticComponent<({ children, className, listClassName, rowClassName, estimateSize, overscan, gap, }: ChatListItemsProps) => import('react').JSX.Element>;
|
|
11
22
|
//# sourceMappingURL=chat-list-items.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-list-items.d.ts","sourceRoot":"","sources":["../../../src/components/chat-list/chat-list-items.tsx"],"names":[],"mappings":"AACA,OAAO,EAAgC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AASrE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,SAAS,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"chat-list-items.d.ts","sourceRoot":"","sources":["../../../src/components/chat-list/chat-list-items.tsx"],"names":[],"mappings":"AACA,OAAO,EAAgC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AASrE,MAAM,WAAW,kBAAkB;IACjC,oFAAoF;IACpF,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,SAAS,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2EAA2E;IAC3E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qFAAqF;IACrF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oFAAoF;IACpF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qCAAqC;IACrC,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,2HAQvB,kBAAkB,iCAyHnB,CAAC"}
|
|
@@ -17,20 +17,35 @@ export interface ChatListContextValue {
|
|
|
17
17
|
skeletonContainer: HTMLElement | null;
|
|
18
18
|
setSkeletonContainer: (node: HTMLElement | null) => void;
|
|
19
19
|
}
|
|
20
|
+
/** The list state `ChatList` shares with its parts. Throws when called outside a `ChatList`. */
|
|
20
21
|
export declare function useChatListContext(): ChatListContextValue;
|
|
21
22
|
export interface ChatListProps {
|
|
23
|
+
/** The list parts: `ChatListItems`, `ChatListSkeleton`, `ChatListLoadMore`, `ChatListEmptyState` and `ChatListError`. */
|
|
22
24
|
children: ReactNode;
|
|
23
25
|
className?: string;
|
|
26
|
+
/** Number of rows already loaded; `ChatListItems` renders this many. */
|
|
24
27
|
loadedCount: number;
|
|
28
|
+
/** Total rows on the server, when known; used to work out `hasMore`. */
|
|
25
29
|
totalCount?: number;
|
|
30
|
+
/** Whether another page can be loaded. Defaults to `loadedCount < totalCount`, and to false without `totalCount`. */
|
|
26
31
|
hasMore?: boolean;
|
|
32
|
+
/** The first page is loading: with no rows loaded, `ChatListSkeleton` shows in place of the rows. */
|
|
27
33
|
isLoading?: boolean;
|
|
34
|
+
/** The next page is loading: stops `onLoadMore` from firing again until it is false. */
|
|
28
35
|
isLoadingMore?: boolean;
|
|
36
|
+
/** Loading failed: with no rows loaded, `ChatListError` shows. */
|
|
29
37
|
hasError?: boolean;
|
|
38
|
+
/** Called when the last rendered row reaches the end of the loaded rows while `hasMore` is true. */
|
|
30
39
|
onLoadMore?: () => void;
|
|
40
|
+
/** Returns a stable key for the row at an index, e.g. the chat id. */
|
|
31
41
|
getItemKey: (index: number) => string | number;
|
|
42
|
+
/** Accessible name of the navigation landmark. Defaults to "Chat list". */
|
|
32
43
|
'aria-label'?: string;
|
|
33
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Root of the conversation list: a `role="navigation"` landmark that holds the fetch state and
|
|
47
|
+
* shares it with its parts. Give it a bounded height; `ChatListItems` scrolls inside it.
|
|
48
|
+
*/
|
|
34
49
|
export declare function ChatList({ children, className, loadedCount, totalCount, hasMore: hasMoreProp, isLoading, isLoadingMore, hasError, onLoadMore, getItemKey, 'aria-label': ariaLabel, }: ChatListProps): import('react').JSX.Element;
|
|
35
50
|
export interface ChatListSkeletonProps {
|
|
36
51
|
/** Your own placeholder rows. Leave it out to get `rows` default rows built from `Skeleton`. */
|
|
@@ -38,26 +53,45 @@ export interface ChatListSkeletonProps {
|
|
|
38
53
|
/** Number of default rows, used only when `children` is not passed. Rows past the list's height are clipped. */
|
|
39
54
|
rows?: number;
|
|
40
55
|
className?: string;
|
|
56
|
+
/** Classes for each default row; merged after its defaults. Not used when `children` is passed. */
|
|
57
|
+
rowClassName?: string;
|
|
41
58
|
}
|
|
42
59
|
/**
|
|
43
60
|
* Placeholder for the first page of chats. Renders only while `isLoading` is true and no chats are
|
|
44
61
|
* loaded, in the space `ChatListItems` will fill. It is a `role="status"` region named
|
|
45
62
|
* "Loading chats"; its rows are `Skeleton`s from `@swisper.ai/ui`, which are `aria-hidden`.
|
|
46
63
|
*/
|
|
47
|
-
export declare function ChatListSkeleton({ children, rows, className }: ChatListSkeletonProps): import('react').ReactPortal | null;
|
|
64
|
+
export declare function ChatListSkeleton({ children, rows, className, rowClassName, }: ChatListSkeletonProps): import('react').ReactPortal | null;
|
|
48
65
|
export interface ChatListEmptyStateProps {
|
|
49
66
|
children?: ReactNode;
|
|
50
67
|
className?: string;
|
|
51
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* What the list says when it has no chats. Renders only when nothing is loaded, nothing is loading
|
|
71
|
+
* and there is no error, as a `role="status"` region named "No chats".
|
|
72
|
+
*/
|
|
52
73
|
export declare function ChatListEmptyState({ children, className }: ChatListEmptyStateProps): import('react').JSX.Element | null;
|
|
53
74
|
export interface ChatListErrorProps {
|
|
75
|
+
/** Your own error content. Leave it out to get the `error` message, or "An error occurred". */
|
|
54
76
|
children?: ReactNode;
|
|
77
|
+
/** The failure to show when `children` is not passed: an `Error`'s message, or the string itself. */
|
|
55
78
|
error?: Error | string;
|
|
56
79
|
className?: string;
|
|
80
|
+
/** Classes for the default message; merged after its defaults. Not used when `children` is passed. */
|
|
81
|
+
messageClassName?: string;
|
|
57
82
|
}
|
|
58
|
-
|
|
83
|
+
/**
|
|
84
|
+
* What the list says when the first page fails. Renders only while `hasError` is true and no chats
|
|
85
|
+
* are loaded, as a `role="alert"` region named "Error loading chats".
|
|
86
|
+
*/
|
|
87
|
+
export declare function ChatListError({ children, error, className, messageClassName, }: ChatListErrorProps): import('react').JSX.Element | null;
|
|
59
88
|
export interface ChatListLoadMoreProps {
|
|
89
|
+
/** Content of the load-more row, e.g. "Loading more…" or a few skeleton rows. */
|
|
60
90
|
children?: ReactNode;
|
|
61
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Registers its children as the content of the row `ChatListItems` appends while `hasMore` is true.
|
|
94
|
+
* It renders nothing where it is placed.
|
|
95
|
+
*/
|
|
62
96
|
export declare function ChatListLoadMore({ children }: ChatListLoadMoreProps): null;
|
|
63
97
|
//# sourceMappingURL=chat-list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-list.d.ts","sourceRoot":"","sources":["../../../src/components/chat-list/chat-list.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAMf,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,OAAO,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,CAAC;IAC/C,gBAAgB,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACnD,gBAAgB,EAAE,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,KAAK,IAAI,CAAC;IACxD,kBAAkB,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC;IAChD,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,iBAAiB,EAAE,WAAW,GAAG,IAAI,CAAC;IACtC,oBAAoB,EAAE,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;CAC1D;AAID,wBAAgB,kBAAkB,yBAQjC;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,CAAC;IAC/C,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,QAAQ,CAAC,EACvB,QAAQ,EACR,SAAS,EACT,WAAW,EACX,UAAU,EACV,OAAO,EAAE,WAAW,EACpB,SAAiB,EACjB,aAAqB,EACrB,QAAgB,EAChB,UAAU,EACV,UAAU,EACV,YAAY,EAAE,SAAuB,GACtC,EAAE,aAAa,+BAwEf;AAED,MAAM,WAAW,qBAAqB;IACpC,gGAAgG;IAChG,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,gHAAgH;IAChH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"chat-list.d.ts","sourceRoot":"","sources":["../../../src/components/chat-list/chat-list.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,gBAAgB,EACrB,KAAK,S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Aa,CAAC,EAC5B,QAAQ,EACR,KAAK,EACL,SAAS,EACT,gBAAgB,GACjB,EAAE,kBAAkB,sCA0BpB;AAED,MAAM,WAAW,qBAAqB;IACpC,iFAAiF;IACjF,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,QAAQ,EAAE,EAAE,qBAAqB,QAenE"}
|
|
@@ -1,13 +1,71 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import {
|
|
2
|
+
import { ChatPage } from './__stories__/types';
|
|
3
|
+
import { ChatList, ChatListProps } from './index';
|
|
3
4
|
declare const meta: Meta<typeof ChatList>;
|
|
4
5
|
export default meta;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
interface SidebarChatListProps {
|
|
7
|
+
/** The first page when it is already cached. Leave it out to request it with `onLoadPage`. */
|
|
8
|
+
initialPage?: ChatPage;
|
|
9
|
+
pageSize: number;
|
|
10
|
+
initialChatId?: string;
|
|
11
|
+
className?: string;
|
|
12
|
+
'aria-label'?: string;
|
|
13
|
+
onLoadPage: (offset: number, limit: number) => Promise<ChatPage>;
|
|
14
|
+
onOpenChat: (chatId: string) => void;
|
|
15
|
+
}
|
|
16
|
+
declare function SidebarChatList({ initialPage, pageSize, initialChatId, className, 'aria-label': ariaLabel, onLoadPage, onOpenChat, }: SidebarChatListProps): import('react').JSX.Element;
|
|
17
|
+
type SidebarStory = StoryObj<typeof SidebarChatList>;
|
|
18
|
+
/** The first page of a chat history with the open chat marked; scrolling to the end loads the next page. */
|
|
19
|
+
export declare const Default: SidebarStory;
|
|
20
|
+
/** A new account with no chats: the empty state says so and how to start one. */
|
|
21
|
+
export declare const Empty: SidebarStory;
|
|
22
|
+
/** The first page fails: the error replaces the skeleton and says what to do next. */
|
|
23
|
+
export declare const ErrorState: SidebarStory;
|
|
24
|
+
/** The first page is on its way: skeleton rows hold the place of the chats. */
|
|
25
|
+
export declare const InitialSkeleton: SidebarStory;
|
|
26
|
+
/** A slow first page: the skeleton stays for 30 seconds, then the chats take its place. */
|
|
27
|
+
export declare const InitialLongLoad: SidebarStory;
|
|
28
|
+
/** The next page is on its way: the load-more row sits under the loaded chats. */
|
|
29
|
+
export declare const LoadingMore: SidebarStory;
|
|
30
|
+
/** Every chat loaded: 80 rows scroll smoothly because only the ones in view are rendered. */
|
|
31
|
+
export declare const LongList: SidebarStory;
|
|
32
|
+
/** The list in each place it's allowed: a sidebar and a navigation drawer. */
|
|
33
|
+
export declare const Examples: SidebarStory;
|
|
34
|
+
/** Scrolls to the end of the loaded chats and checks the next page is requested and appended. */
|
|
35
|
+
export declare const DefaultLoadsNextPage: SidebarStory;
|
|
36
|
+
/** Opens a chat with a click and another with the keyboard, checking which row is marked current. */
|
|
37
|
+
export declare const DefaultOpensAChat: SidebarStory;
|
|
38
|
+
/** With nothing loaded, only the empty state is announced: no skeleton, no error, no rows. */
|
|
39
|
+
export declare const EmptyAnnouncesNoChats: SidebarStory;
|
|
40
|
+
/** The skeleton shows while the first page loads; when it fails, the alert takes its place. */
|
|
41
|
+
export declare const ErrorStateShowsAlert: SidebarStory;
|
|
42
|
+
/** While the first page loads, the skeleton is a busy status region and no rows or empty state show. */
|
|
43
|
+
export declare const InitialSkeletonAnnouncesLoading: SidebarStory;
|
|
44
|
+
/** While the next page loads, the loaded chats stay and the load-more row is a busy status under them. */
|
|
45
|
+
export declare const LoadingMoreKeepsRows: SidebarStory;
|
|
46
|
+
/** A later page fails: the loaded chats stay on screen, no error replaces them and the list stops asking. */
|
|
47
|
+
export declare const LaterPageFailureKeepsRows: SidebarStory;
|
|
48
|
+
interface ChatListPlaygroundProps extends Omit<ChatListProps, 'children' | 'getItemKey'> {
|
|
49
|
+
/** Position of the open chat in the list, from 1; 0 marks none. */
|
|
50
|
+
selectedPosition: number;
|
|
51
|
+
hasSkeleton: boolean;
|
|
52
|
+
hasLoadMore: boolean;
|
|
53
|
+
hasEmptyState: boolean;
|
|
54
|
+
hasErrorState: boolean;
|
|
55
|
+
/** `rows` on `ChatListSkeleton`. */
|
|
56
|
+
rows: number;
|
|
57
|
+
/** `estimateSize`, `overscan` and `gap` on `ChatListItems`. */
|
|
58
|
+
estimateSize: number;
|
|
59
|
+
overscan: number;
|
|
60
|
+
gap: number;
|
|
61
|
+
loadMoreLabel: string;
|
|
62
|
+
emptyTitle: string;
|
|
63
|
+
emptyDescription: string;
|
|
64
|
+
errorTitle: string;
|
|
65
|
+
errorDescription: string;
|
|
66
|
+
onOpenChat: (chatId: string) => void;
|
|
67
|
+
}
|
|
68
|
+
declare function ChatListPlayground({ loadedCount, selectedPosition, hasSkeleton, hasLoadMore, hasEmptyState, hasErrorState, rows, estimateSize, overscan, gap, loadMoreLabel, emptyTitle, emptyDescription, errorTitle, errorDescription, onOpenChat, ...rest }: ChatListPlaygroundProps): import('react').JSX.Element;
|
|
69
|
+
/** Every part of the list at once, with each part and prop on the Controls panel; set `loadedCount` to 0 to reach the skeleton, empty and error states. */
|
|
70
|
+
export declare const Playground: StoryObj<typeof ChatListPlayground>;
|
|
13
71
|
//# sourceMappingURL=chat-list.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-list.stories.d.ts","sourceRoot":"","sources":["../../../src/components/chat-list/chat-list.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"chat-list.stories.d.ts","sourceRoot":"","sources":["../../../src/components/chat-list/chat-list.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAa,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAmBvE,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EACL,QAAQ,EAKR,KAAK,aAAa,EAEnB,MAAM,SAAS,CAAC;AAEjB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,2JAA2J;AAC3J,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,OAAO,kBAAkB,CA6D1D,CAAC"}
|
|
@@ -1,17 +1,28 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
export interface ChatMessageProps {
|
|
3
|
+
/** The message parts, usually a `ChatMessageContent` followed by an optional `ChatMessageActions`. */
|
|
3
4
|
children: React.ReactNode;
|
|
5
|
+
/** Classes merged last onto the root, e.g. `gap-12` to change the gap between the parts. */
|
|
4
6
|
className?: string;
|
|
7
|
+
/** Marks the message as the user's question: end-aligns it and turns its content into a filled bubble. */
|
|
5
8
|
isQuestion?: boolean;
|
|
6
9
|
}
|
|
10
|
+
/** One message in a conversation: the user's question as an end-aligned bubble, or the assistant's answer. */
|
|
7
11
|
export declare function ChatMessage({ children, className, isQuestion }: ChatMessageProps): React.JSX.Element;
|
|
8
12
|
export interface ChatMessageContentProps {
|
|
13
|
+
/** The message body: plain text, a `MarkdownViewer` or a `ChatCardContainer`. */
|
|
9
14
|
children: React.ReactNode;
|
|
15
|
+
/** Classes merged last onto the content element. */
|
|
16
|
+
className?: string;
|
|
10
17
|
}
|
|
11
|
-
|
|
18
|
+
/** The body of a `ChatMessage`. Inside a question it renders as a padded, filled bubble. */
|
|
19
|
+
export declare function ChatMessageContent({ children, className }: ChatMessageContentProps): React.JSX.Element;
|
|
12
20
|
export interface ChatMessageActionsProps {
|
|
21
|
+
/** The controls under the message, usually a `ChatMessageToolbar`. */
|
|
13
22
|
children: React.ReactNode;
|
|
23
|
+
/** Classes merged last onto the actions row. */
|
|
14
24
|
className?: string;
|
|
15
25
|
}
|
|
26
|
+
/** A row under the message body. From `md` up it is hidden until its `ChatMessage` is hovered. */
|
|
16
27
|
export declare function ChatMessageActions({ children, className }: ChatMessageActionsProps): React.JSX.Element;
|
|
17
28
|
//# sourceMappingURL=chat-message.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-message.d.ts","sourceRoot":"","sources":["../../../src/components/chat-message/chat-message.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"chat-message.d.ts","sourceRoot":"","sources":["../../../src/components/chat-message/chat-message.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,WAAW,gBAAgB;IAC/B,sGAAsG;IACtG,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,4FAA4F;IAC5F,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0GAA0G;IAC1G,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,8GAA8G;AAC9G,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,gBAAgB,qBAgBhF;AAED,MAAM,WAAW,uBAAuB;IACtC,iFAAiF;IACjF,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,oDAAoD;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,4FAA4F;AAC5F,wBAAgB,kBAAkB,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,uBAAuB,qBAiBlF;AAED,MAAM,WAAW,uBAAuB;IACtC,sEAAsE;IACtE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,kGAAkG;AAClG,wBAAgB,kBAAkB,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,uBAAuB,qBAalF"}
|
|
@@ -3,9 +3,40 @@ import { ChatMessage } from './chat-message';
|
|
|
3
3
|
declare const meta: Meta<typeof ChatMessage>;
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof ChatMessage>;
|
|
6
|
+
/** The user's question: right-aligned, with its content in a filled bubble. */
|
|
7
|
+
export declare const Default: Story;
|
|
8
|
+
/** A question shows the user's text exactly as sent, in a bubble at the end of the row. */
|
|
6
9
|
export declare const Question: Story;
|
|
10
|
+
/** The assistant's answer: start-aligned with no bubble, its Markdown rendered by a `MarkdownViewer`. */
|
|
7
11
|
export declare const Answer: Story;
|
|
12
|
+
interface AssistantAnswerProps {
|
|
13
|
+
answer: string;
|
|
14
|
+
/** When the answer finished, as the toolbar shows it */
|
|
15
|
+
time: string;
|
|
16
|
+
onCopy: () => void;
|
|
17
|
+
}
|
|
18
|
+
declare function AssistantAnswer({ answer, time, onCopy }: AssistantAnswerProps): import('react').JSX.Element;
|
|
19
|
+
/** A finished answer with its toolbar in `ChatMessageActions`; from `md` up, hover the message to show it. */
|
|
8
20
|
export declare const WithActions: Story;
|
|
21
|
+
/** The actions stay reachable by keyboard while hover has not revealed them. */
|
|
22
|
+
export declare const WithActionsKeyboard: StoryObj<typeof AssistantAnswer>;
|
|
23
|
+
/** One turn of a conversation: the question bubble, then the answer under it. */
|
|
9
24
|
export declare const History: Story;
|
|
25
|
+
/** A long question wraps inside its bubble and keeps to the width of the thread. */
|
|
10
26
|
export declare const LongMessage: Story;
|
|
27
|
+
/** The message in each parent it's allowed in, then in a chat thread, an agent transcript and a side panel. */
|
|
28
|
+
export declare const Examples: Story;
|
|
29
|
+
interface ChatMessagePlaygroundProps {
|
|
30
|
+
isQuestion: boolean;
|
|
31
|
+
className: string;
|
|
32
|
+
text: string;
|
|
33
|
+
hasThinkingProcess: boolean;
|
|
34
|
+
hasAttachment: boolean;
|
|
35
|
+
hasActions: boolean;
|
|
36
|
+
time: string;
|
|
37
|
+
onCopy: () => void;
|
|
38
|
+
}
|
|
39
|
+
declare function ChatMessagePlayground({ isQuestion, className, text, hasThinkingProcess, hasAttachment, hasActions, time, onCopy, }: ChatMessagePlaygroundProps): import('react').JSX.Element;
|
|
40
|
+
/** Every part of a message at once, with each part and prop on the Controls panel. */
|
|
41
|
+
export declare const Playground: StoryObj<typeof ChatMessagePlayground>;
|
|
11
42
|
//# sourceMappingURL=chat-message.stories.d.ts.map
|