@swisper.ai/web-chat-ui 0.0.2 → 0.0.5
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 +30 -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-input/plugins/controlled-value-plugin.d.ts +4 -1
- package/dist/components/chat-input/plugins/controlled-value-plugin.d.ts.map +1 -1
- package/dist/components/chat-input/plugins/value-plugin.d.ts +4 -1
- package/dist/components/chat-input/plugins/value-plugin.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/plugins/controlled-value-plugin.d.ts +4 -1
- package/dist/components/rich-text-area/plugins/controlled-value-plugin.d.ts.map +1 -1
- package/dist/components/rich-text-area/plugins/value-plugin.d.ts +4 -1
- package/dist/components/rich-text-area/plugins/value-plugin.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 +1801 -1806
- 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 +16 -10
- 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/__tests__/chat-input.spec.tsx +100 -0
- package/src/components/chat-input/chat-input.json +11 -2
- package/src/components/chat-input/chat-input.stories.tsx +660 -197
- package/src/components/chat-input/chat-input.tsx +39 -5
- package/src/components/chat-input/plugins/controlled-value-plugin.tsx +16 -3
- package/src/components/chat-input/plugins/value-plugin.tsx +19 -4
- 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/__tests__/rich-text-area.spec.tsx +114 -0
- package/src/components/rich-text-area/plugins/controlled-value-plugin.tsx +20 -3
- package/src/components/rich-text-area/plugins/value-plugin.tsx +16 -3
- package/src/components/rich-text-area/rich-text-area.json +7 -4
- package/src/components/rich-text-area/rich-text-area.stories.tsx +597 -41
- package/src/components/rich-text-area/rich-text-area.tsx +27 -4
- 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
|
@@ -9,7 +9,7 @@ import { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin';
|
|
|
9
9
|
import { TablePlugin } from '@lexical/react/LexicalTablePlugin';
|
|
10
10
|
import { HeadingNode, QuoteNode } from '@lexical/rich-text';
|
|
11
11
|
import { TableCellNode, TableNode, TableRowNode } from '@lexical/table';
|
|
12
|
-
import { forwardRef } from 'react';
|
|
12
|
+
import { forwardRef, useRef } from 'react';
|
|
13
13
|
import type { KeyboardEvent, Ref, ReactNode } from 'react';
|
|
14
14
|
|
|
15
15
|
import { Typography } from '@swisper.ai/ui';
|
|
@@ -57,18 +57,31 @@ export const INITIAL_CONFIG: InitialConfigType = {
|
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
export interface RichTextAreaProps {
|
|
60
|
+
/** Extra Lexical plugins. They render inside the composer, after the built-in ones. */
|
|
60
61
|
children?: ReactNode;
|
|
62
|
+
/** Written to the editable element as `data-name`. It does not create a form field. */
|
|
61
63
|
name?: string;
|
|
64
|
+
/** Controlled content, in the format `source` sets. `''` clears the editor. */
|
|
62
65
|
value?: string;
|
|
66
|
+
/** Format of `value` and of what `onChange` returns. Defaults to `markdown`. */
|
|
63
67
|
source?: 'html' | 'markdown';
|
|
68
|
+
/** Classes for the editable element (`data-slot="rich-text-area-editable"`), not the root. */
|
|
64
69
|
className?: string;
|
|
70
|
+
/** Classes for the root wrapper (`data-slot="rich-text-area"`). */
|
|
65
71
|
containerClassName?: string;
|
|
72
|
+
/** Classes for the placeholder (`data-slot="rich-text-area-placeholder"`). */
|
|
66
73
|
placeholderClassName?: string;
|
|
74
|
+
/** Hint shown while the editor is empty. It is not the editor's accessible name. */
|
|
67
75
|
placeholder?: string;
|
|
76
|
+
/** Makes the editor non-editable and dims it; the root gets `data-disabled="true"`. */
|
|
68
77
|
isDisabled?: boolean;
|
|
78
|
+
/** Called with the whole content, serialised as `source`, on every edit. */
|
|
69
79
|
onChange?: (value: string) => void;
|
|
80
|
+
/** Called when focus leaves the editable element. */
|
|
70
81
|
onBlur?: () => void;
|
|
82
|
+
/** Runs in the capture phase, before Lexical handles the key, so it can prevent `Enter`. */
|
|
71
83
|
onKeyDown?: (event: KeyboardEvent<HTMLDivElement>) => void;
|
|
84
|
+
/** Called with `true` when the editable element gains focus and `false` when it loses it. */
|
|
72
85
|
onFocusChange?: (isFocused: boolean) => void;
|
|
73
86
|
}
|
|
74
87
|
|
|
@@ -89,9 +102,12 @@ function RichTextAreaImpl({
|
|
|
89
102
|
forwardedRef,
|
|
90
103
|
...rest
|
|
91
104
|
}: RichTextAreaProps & { forwardedRef?: Ref<HTMLInputElement> }) {
|
|
105
|
+
const emittedValuesRef = useRef<string[]>([]);
|
|
106
|
+
|
|
92
107
|
return (
|
|
93
108
|
<LexicalComposer initialConfig={INITIAL_CONFIG}>
|
|
94
109
|
<Wrapper
|
|
110
|
+
data-slot="rich-text-area"
|
|
95
111
|
data-testid="rich-text-area"
|
|
96
112
|
aria-disabled={isDisabled}
|
|
97
113
|
data-disabled={isDisabled}
|
|
@@ -106,6 +122,7 @@ function RichTextAreaImpl({
|
|
|
106
122
|
<RichTextPlugin
|
|
107
123
|
contentEditable={
|
|
108
124
|
<ContentEditable
|
|
125
|
+
data-slot="rich-text-area-editable"
|
|
109
126
|
className={cn('relative inset-0 overflow-y-auto', className)}
|
|
110
127
|
data-name={name}
|
|
111
128
|
aria-placeholder={placeholder}
|
|
@@ -118,8 +135,10 @@ function RichTextAreaImpl({
|
|
|
118
135
|
'pointer-events-none user-select-none',
|
|
119
136
|
placeholderClassName,
|
|
120
137
|
)}
|
|
138
|
+
asChild
|
|
121
139
|
>
|
|
122
|
-
{
|
|
140
|
+
{/* Typography stamps its own data-slot unless it renders as its child. */}
|
|
141
|
+
<p data-slot="rich-text-area-placeholder">{placeholder}</p>
|
|
123
142
|
</Typography>
|
|
124
143
|
}
|
|
125
144
|
onKeyDownCapture={onKeyDown}
|
|
@@ -133,8 +152,8 @@ function RichTextAreaImpl({
|
|
|
133
152
|
/>
|
|
134
153
|
|
|
135
154
|
<DisabledPlugin isDisabled={isDisabled} />
|
|
136
|
-
<ControlledValuePlugin value={value} source={source} />
|
|
137
|
-
<ValuePlugin onChange={onChange} source={source} />
|
|
155
|
+
<ControlledValuePlugin value={value} source={source} emittedValuesRef={emittedValuesRef} />
|
|
156
|
+
<ValuePlugin onChange={onChange} source={source} emittedValuesRef={emittedValuesRef} />
|
|
138
157
|
<BlurPlugin onBlur={onBlur} />
|
|
139
158
|
<HistoryPlugin />
|
|
140
159
|
<ControlledPlugin controlledRef={forwardedRef ?? null} />
|
|
@@ -149,6 +168,10 @@ function RichTextAreaImpl({
|
|
|
149
168
|
);
|
|
150
169
|
}
|
|
151
170
|
|
|
171
|
+
/**
|
|
172
|
+
* Toolbar-less Lexical editor whose value is Markdown or HTML. The ref exposes only `focus()`.
|
|
173
|
+
* Pass extra Lexical plugins as children.
|
|
174
|
+
*/
|
|
152
175
|
export const RichTextArea = forwardRef<HTMLInputElement, RichTextAreaProps>((props, ref) => {
|
|
153
176
|
return <RichTextAreaImpl {...props} forwardedRef={ref} />;
|
|
154
177
|
});
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { forwardRef, type HTMLAttributes } from 'react';
|
|
1
|
+
import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';
|
|
2
2
|
|
|
3
3
|
import { cn } from '@swisper.ai/web-core';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
interface WrapperProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const Wrapper = forwardRef<HTMLDivElement, WrapperProps>(
|
|
10
|
+
({ className, children, ...rest }, ref) => {
|
|
7
11
|
return (
|
|
8
12
|
<div
|
|
9
13
|
ref={ref}
|
|
@@ -11,8 +15,10 @@ export const Wrapper = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>
|
|
|
11
15
|
'w-full resize-none border-none outline-none bg-transparent font-[inherit] text-[inherit] flex items-center [&_.editor-paragraph]:m-0 [&_.editor-paragraph]:min-h-[26px] [&_.editor-text-bold]:font-bold [&_.editor-text-italic]:italic [&_.editor-text-underline]:underline',
|
|
12
16
|
className,
|
|
13
17
|
)}
|
|
14
|
-
{...
|
|
15
|
-
|
|
18
|
+
{...rest}
|
|
19
|
+
>
|
|
20
|
+
{children}
|
|
21
|
+
</div>
|
|
16
22
|
);
|
|
17
23
|
},
|
|
18
24
|
);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// An email reply as the field stores it with `source="markdown"`: bold, italics and a list in
|
|
2
|
+
// Markdown, and the right-aligned line as inline HTML, because Markdown has no alignment.
|
|
3
|
+
export const REPLY_DRAFT_MARKDOWN = `Hi Lena,
|
|
4
|
+
|
|
5
|
+
Thanks for the revised offer. **Tuesday at 14:00** works for us, and *Thursday morning* is the fallback.
|
|
6
|
+
|
|
7
|
+
Before the call, could you confirm:
|
|
8
|
+
- The delivery date for the first batch
|
|
9
|
+
- Who signs on your side
|
|
10
|
+
- Whether the price includes installation and the two-year service contract we discussed in March
|
|
11
|
+
|
|
12
|
+
<div style="text-align: right">Best regards, Marco</div>`;
|
|
13
|
+
|
|
14
|
+
// A calendar event description as the field stores it with `source="html"`.
|
|
15
|
+
export const EVENT_DESCRIPTION_HTML =
|
|
16
|
+
'<p>Agenda for the quarterly planning call:</p><ul><li>Review of the Q3 numbers</li><li>Hiring plan for the support team</li></ul><p><b>Please bring</b> the open items of your team.</p>';
|
|
17
|
+
|
|
18
|
+
// A short internal note, for the dialog example.
|
|
19
|
+
export const HANDOVER_NOTE_MARKDOWN = `Customer asked for the invoice to be split by site. **Do not send** the combined one.`;
|
|
20
|
+
|
|
21
|
+
// The message a reply answers, shown above the reply composer.
|
|
22
|
+
export const INCOMING_MESSAGE = {
|
|
23
|
+
sender: 'Lena Brunner',
|
|
24
|
+
receivedAt: 'Today, 09:42',
|
|
25
|
+
text: 'Please find the revised offer attached. Could we go through it on a call next week?',
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// The document types an email attachment may have.
|
|
29
|
+
export const EMAIL_ATTACHMENT_TYPES = ['.pdf', '.doc', '.docx', '.txt', '.md', '.xls', '.xlsx'];
|
|
@@ -15,9 +15,12 @@ import { TextColorButton } from './text-color-button';
|
|
|
15
15
|
import { TypographySelect } from './typography-select';
|
|
16
16
|
import { UnderlineButton } from './underline-button';
|
|
17
17
|
|
|
18
|
-
interface FormattingToolbarPluginProps {
|
|
18
|
+
export interface FormattingToolbarPluginProps {
|
|
19
|
+
/** Classes for the toolbar (`data-slot="rich-text-field-toolbar"`), merged last. */
|
|
19
20
|
className?: string;
|
|
21
|
+
/** Renders the toolbar controls from `{ hasAttachments }`. Defaults to the full control set. */
|
|
20
22
|
children?: ({ hasAttachments }: { hasAttachments: boolean }) => ReactNode;
|
|
23
|
+
/** Handed to `children`; the default controls enable the attachment button with it. */
|
|
21
24
|
hasAttachments?: boolean;
|
|
22
25
|
}
|
|
23
26
|
|
|
@@ -48,6 +51,11 @@ const DefaultFormattingToolbarChildren = ({ hasAttachments }: { hasAttachments:
|
|
|
48
51
|
</>
|
|
49
52
|
);
|
|
50
53
|
|
|
54
|
+
/**
|
|
55
|
+
* The toolbar row `RichTextField` renders. Its controls read the field's formatting context, so it
|
|
56
|
+
* only works inside a `RichTextField`, which already renders one: pass controls through the
|
|
57
|
+
* field's `toolbarChildren` instead of rendering this yourself.
|
|
58
|
+
*/
|
|
51
59
|
export function FormattingToolbarPlugin({
|
|
52
60
|
className,
|
|
53
61
|
children = DefaultFormattingToolbarChildren,
|
|
@@ -56,6 +64,7 @@ export function FormattingToolbarPlugin({
|
|
|
56
64
|
return (
|
|
57
65
|
<div
|
|
58
66
|
data-testid="formatting-toolbar"
|
|
67
|
+
data-slot="rich-text-field-toolbar"
|
|
59
68
|
className={cn(
|
|
60
69
|
'flex items-center gap-[2px]',
|
|
61
70
|
'px-[16px] py-[8px] overflow-x-auto',
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {
|
|
2
|
+
FormattingToolbarPlugin,
|
|
3
|
+
type FormattingToolbarPluginProps,
|
|
4
|
+
} from './formatting-toolbar-plugin';
|
|
2
5
|
|
|
3
|
-
export { SizeSelect } from './size-select';
|
|
4
|
-
export { TypographySelect } from './typography-select';
|
|
5
|
-
export { AlignmentSelect } from './alignment-select';
|
|
6
|
+
export { SizeSelect, type SizeSelectProps } from './size-select';
|
|
7
|
+
export { TypographySelect, type TypographySelectProps } from './typography-select';
|
|
8
|
+
export { AlignmentSelect, type AlignmentSelectProps } from './alignment-select';
|
|
6
9
|
export { BoldButton } from './bold-button';
|
|
7
10
|
export { ItalicButton } from './italic-button';
|
|
8
11
|
export { UnderlineButton } from './underline-button';
|
|
9
|
-
export { TextColorButton } from './text-color-button';
|
|
12
|
+
export { TextColorButton, type TextColorButtonProps } from './text-color-button';
|
|
10
13
|
export { LinkButton } from './link-button';
|
|
11
14
|
export { AttachmentButton } from './attachment-button';
|
|
12
15
|
export { ImageButton } from './image-button';
|
|
@@ -1,13 +1,26 @@
|
|
|
1
1
|
import { type ChangeEvent } from 'react';
|
|
2
2
|
|
|
3
3
|
import { FormatColorIcon } from '@swisper.ai/icons';
|
|
4
|
+
import { cn } from '@swisper.ai/web-core';
|
|
4
5
|
|
|
5
6
|
import { DEFAULT_TEXT_COLOR } from '../constants';
|
|
6
7
|
import { useRichTextFieldContext } from '../context';
|
|
7
8
|
|
|
8
9
|
import { ToolbarButton, type ToolbarButtonProps } from './toolbar-button';
|
|
9
10
|
|
|
10
|
-
export
|
|
11
|
+
export interface TextColorButtonProps extends ToolbarButtonProps {
|
|
12
|
+
/**
|
|
13
|
+
* Classes for the element around the button and its colour input
|
|
14
|
+
* (`data-slot="rich-text-field-text-color"`), merged last. `className` lands on the button.
|
|
15
|
+
*/
|
|
16
|
+
wrapperClassName?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Toolbar button that opens the browser's colour picker and applies the colour to the selected
|
|
21
|
+
* text; its icon takes the colour at the caret. Works only inside a `RichTextField` toolbar.
|
|
22
|
+
*/
|
|
23
|
+
export function TextColorButton({ wrapperClassName, ...props }: TextColorButtonProps) {
|
|
11
24
|
const { textColor, onTextColor } = useRichTextFieldContext();
|
|
12
25
|
const isDefaultColor = textColor === DEFAULT_TEXT_COLOR;
|
|
13
26
|
|
|
@@ -16,7 +29,7 @@ export function TextColorButton({ ...props }: ToolbarButtonProps) {
|
|
|
16
29
|
}
|
|
17
30
|
|
|
18
31
|
return (
|
|
19
|
-
<div
|
|
32
|
+
<div data-slot="rich-text-field-text-color" className={cn('relative', wrapperClassName)}>
|
|
20
33
|
<ToolbarButton data-testid="text-color-button" aria-label="Text Color" {...props}>
|
|
21
34
|
<span style={!isDefaultColor ? { color: textColor } : {}}>
|
|
22
35
|
<FormatColorIcon />
|
|
@@ -24,6 +37,7 @@ export function TextColorButton({ ...props }: ToolbarButtonProps) {
|
|
|
24
37
|
</ToolbarButton>
|
|
25
38
|
<input
|
|
26
39
|
type="color"
|
|
40
|
+
data-slot="rich-text-field-text-color-input"
|
|
27
41
|
value={textColor}
|
|
28
42
|
onChange={handleColorChange}
|
|
29
43
|
tabIndex={-1}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"$schema": "../../../../int-eslint-config/schemas/component.schema.json",
|
|
3
3
|
"component": "rich-text-field",
|
|
4
4
|
"purpose": "Fixed-height rich-text editor with a formatting toolbar (typeface, size, bold, italic, underline, colour, attachment, alignment, clear formatting) above or below the text, built on web-chat-ui/rich-text-area.",
|
|
5
|
+
"anatomy": ["import { RichTextField } from '@swisper.ai/web-chat-ui';", "", "<RichTextField />"],
|
|
5
6
|
"useWhen": [
|
|
6
7
|
"Users write formatted long-form text such as an email reply or a note, and need visible formatting controls",
|
|
7
8
|
"Files are attached to the text through a toolbar button",
|
|
@@ -47,7 +48,8 @@
|
|
|
47
48
|
"The attachment button opens a hidden file picker limited to acceptedFiles; onFileAttach receives the picked files, and only the first file unless isMultipleAttachments is true",
|
|
48
49
|
"toolbarChildren replaces the default controls; it is a function receiving { hasAttachments } (the enableAttachments value) and returning the toolbar content",
|
|
49
50
|
"children is accepted for type compatibility but not rendered; pass toolbar content through toolbarChildren",
|
|
50
|
-
"The field has a fixed height from the rich-text-field-height token and the text scrolls inside it; override it with containerClassName"
|
|
51
|
+
"The field has a fixed height from the rich-text-field-height token and the text scrolls inside it; override it with containerClassName",
|
|
52
|
+
"Each element takes its own classes, merged last: className the editable text, containerClassName the root (data-slot=rich-text-field, which also carries data-toolbar-placement), toolbarClassName the toolbar (data-slot=rich-text-field-toolbar) and placeholderClassName the placeholder; TextColorButton takes wrapperClassName for the element around its button and colour input (data-slot=rich-text-field-text-color)"
|
|
51
53
|
]
|
|
52
54
|
},
|
|
53
55
|
"composition": {
|