@swisper.ai/web-chat-ui 0.0.2
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/LICENSE +202 -0
- package/README.md +251 -0
- package/dist/components/canvas-shell/canvas-shell.d.ts +64 -0
- package/dist/components/canvas-shell/canvas-shell.d.ts.map +1 -0
- package/dist/components/canvas-shell/canvas-shell.stories.d.ts +26 -0
- package/dist/components/canvas-shell/canvas-shell.stories.d.ts.map +1 -0
- package/dist/components/canvas-shell/index.d.ts +2 -0
- package/dist/components/canvas-shell/index.d.ts.map +1 -0
- package/dist/components/card-item-picker/card-item-picker-context.d.ts +21 -0
- package/dist/components/card-item-picker/card-item-picker-context.d.ts.map +1 -0
- package/dist/components/card-item-picker/card-item-picker-list.d.ts +24 -0
- package/dist/components/card-item-picker/card-item-picker-list.d.ts.map +1 -0
- package/dist/components/card-item-picker/card-item-picker-row-parts.d.ts +28 -0
- package/dist/components/card-item-picker/card-item-picker-row-parts.d.ts.map +1 -0
- package/dist/components/card-item-picker/card-item-picker-row.d.ts +12 -0
- package/dist/components/card-item-picker/card-item-picker-row.d.ts.map +1 -0
- package/dist/components/card-item-picker/card-item-picker.stories.d.ts +19 -0
- package/dist/components/card-item-picker/card-item-picker.stories.d.ts.map +1 -0
- package/dist/components/card-item-picker/index.d.ts +9 -0
- package/dist/components/card-item-picker/index.d.ts.map +1 -0
- package/dist/components/chat-card/chat-card.d.ts +4 -0
- package/dist/components/chat-card/chat-card.d.ts.map +1 -0
- package/dist/components/chat-card/chat-card.stories.d.ts +11 -0
- package/dist/components/chat-card/chat-card.stories.d.ts.map +1 -0
- package/dist/components/chat-card/components/chat-card-body.d.ts +22 -0
- package/dist/components/chat-card/components/chat-card-body.d.ts.map +1 -0
- package/dist/components/chat-card/components/chat-card-footer.d.ts +20 -0
- package/dist/components/chat-card/components/chat-card-footer.d.ts.map +1 -0
- package/dist/components/chat-card/components/chat-card-form.d.ts +28 -0
- package/dist/components/chat-card/components/chat-card-form.d.ts.map +1 -0
- package/dist/components/chat-card/components/chat-card-header.d.ts +36 -0
- package/dist/components/chat-card/components/chat-card-header.d.ts.map +1 -0
- package/dist/components/chat-card/components/index.d.ts +5 -0
- package/dist/components/chat-card/components/index.d.ts.map +1 -0
- package/dist/components/chat-card/context.d.ts +13 -0
- package/dist/components/chat-card/context.d.ts.map +1 -0
- package/dist/components/chat-card/contexts.d.ts +16 -0
- package/dist/components/chat-card/contexts.d.ts.map +1 -0
- package/dist/components/chat-card/hooks.d.ts +13 -0
- package/dist/components/chat-card/hooks.d.ts.map +1 -0
- package/dist/components/chat-card/index.d.ts +6 -0
- package/dist/components/chat-card/index.d.ts.map +1 -0
- package/dist/components/chat-card/types.d.ts +21 -0
- package/dist/components/chat-card/types.d.ts.map +1 -0
- package/dist/components/chat-card-container/chat-card-container.d.ts +43 -0
- package/dist/components/chat-card-container/chat-card-container.d.ts.map +1 -0
- package/dist/components/chat-card-container/chat-card-container.stories.d.ts +17 -0
- package/dist/components/chat-card-container/chat-card-container.stories.d.ts.map +1 -0
- package/dist/components/chat-card-container/index.d.ts +3 -0
- package/dist/components/chat-card-container/index.d.ts.map +1 -0
- package/dist/components/chat-container/chat-container.d.ts +51 -0
- package/dist/components/chat-container/chat-container.d.ts.map +1 -0
- package/dist/components/chat-container/chat-container.stories.d.ts +21 -0
- package/dist/components/chat-container/chat-container.stories.d.ts.map +1 -0
- package/dist/components/chat-container/index.d.ts +3 -0
- package/dist/components/chat-container/index.d.ts.map +1 -0
- package/dist/components/chat-input/chat-input.d.ts +35 -0
- package/dist/components/chat-input/chat-input.d.ts.map +1 -0
- package/dist/components/chat-input/chat-input.stories.d.ts +14 -0
- package/dist/components/chat-input/chat-input.stories.d.ts.map +1 -0
- package/dist/components/chat-input/index.d.ts +3 -0
- package/dist/components/chat-input/index.d.ts.map +1 -0
- package/dist/components/chat-input/plugins/auto-focus-plugin.d.ts +8 -0
- package/dist/components/chat-input/plugins/auto-focus-plugin.d.ts.map +1 -0
- package/dist/components/chat-input/plugins/controlled-value-plugin.d.ts +6 -0
- package/dist/components/chat-input/plugins/controlled-value-plugin.d.ts.map +1 -0
- package/dist/components/chat-input/plugins/disabled-plugin.d.ts +7 -0
- package/dist/components/chat-input/plugins/disabled-plugin.d.ts.map +1 -0
- package/dist/components/chat-input/plugins/focus-plugin.d.ts +6 -0
- package/dist/components/chat-input/plugins/focus-plugin.d.ts.map +1 -0
- package/dist/components/chat-input/plugins/has-value-plugin.d.ts +6 -0
- package/dist/components/chat-input/plugins/has-value-plugin.d.ts.map +1 -0
- package/dist/components/chat-input/plugins/hooks.d.ts +2 -0
- package/dist/components/chat-input/plugins/hooks.d.ts.map +1 -0
- package/dist/components/chat-input/plugins/index.d.ts +8 -0
- package/dist/components/chat-input/plugins/index.d.ts.map +1 -0
- package/dist/components/chat-input/plugins/markdown-plain-paste-plugin.d.ts +2 -0
- package/dist/components/chat-input/plugins/markdown-plain-paste-plugin.d.ts.map +1 -0
- package/dist/components/chat-input/plugins/utils.d.ts +4 -0
- package/dist/components/chat-input/plugins/utils.d.ts.map +1 -0
- package/dist/components/chat-input/plugins/value-plugin.d.ts +6 -0
- package/dist/components/chat-input/plugins/value-plugin.d.ts.map +1 -0
- package/dist/components/chat-input/transformers.d.ts +3 -0
- package/dist/components/chat-input/transformers.d.ts.map +1 -0
- package/dist/components/chat-list/chat-list-item.d.ts +8 -0
- package/dist/components/chat-list/chat-list-item.d.ts.map +1 -0
- package/dist/components/chat-list/chat-list-items.d.ts +11 -0
- package/dist/components/chat-list/chat-list-items.d.ts.map +1 -0
- package/dist/components/chat-list/chat-list.d.ts +63 -0
- package/dist/components/chat-list/chat-list.d.ts.map +1 -0
- package/dist/components/chat-list/chat-list.stories.d.ts +13 -0
- package/dist/components/chat-list/chat-list.stories.d.ts.map +1 -0
- package/dist/components/chat-list/index.d.ts +4 -0
- package/dist/components/chat-list/index.d.ts.map +1 -0
- package/dist/components/chat-message/chat-message.d.ts +17 -0
- package/dist/components/chat-message/chat-message.d.ts.map +1 -0
- package/dist/components/chat-message/chat-message.stories.d.ts +11 -0
- package/dist/components/chat-message/chat-message.stories.d.ts.map +1 -0
- package/dist/components/chat-message/index.d.ts +2 -0
- package/dist/components/chat-message/index.d.ts.map +1 -0
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card-icon.d.ts +9 -0
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card-icon.d.ts.map +1 -0
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card.d.ts +30 -0
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card.d.ts.map +1 -0
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card.stories.d.ts +11 -0
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card.stories.d.ts.map +1 -0
- package/dist/components/chat-message-attachment-card/index.d.ts +4 -0
- package/dist/components/chat-message-attachment-card/index.d.ts.map +1 -0
- package/dist/components/chat-message-attachment-card/utils.d.ts +5 -0
- package/dist/components/chat-message-attachment-card/utils.d.ts.map +1 -0
- package/dist/components/chat-message-history/chat-message-history.d.ts +48 -0
- package/dist/components/chat-message-history/chat-message-history.d.ts.map +1 -0
- package/dist/components/chat-message-history/chat-message-history.stories.d.ts +7 -0
- package/dist/components/chat-message-history/chat-message-history.stories.d.ts.map +1 -0
- package/dist/components/chat-message-history/index.d.ts +2 -0
- package/dist/components/chat-message-history/index.d.ts.map +1 -0
- package/dist/components/chat-message-response/chat-message-response.d.ts +7 -0
- package/dist/components/chat-message-response/chat-message-response.d.ts.map +1 -0
- package/dist/components/chat-message-response/chat-message-response.stories.d.ts +7 -0
- package/dist/components/chat-message-response/chat-message-response.stories.d.ts.map +1 -0
- package/dist/components/chat-message-response/index.d.ts +2 -0
- package/dist/components/chat-message-response/index.d.ts.map +1 -0
- package/dist/components/chat-message-toolbar/chat-message-toolbar.d.ts +25 -0
- package/dist/components/chat-message-toolbar/chat-message-toolbar.d.ts.map +1 -0
- package/dist/components/chat-message-toolbar/chat-message-toolbar.stories.d.ts +7 -0
- package/dist/components/chat-message-toolbar/chat-message-toolbar.stories.d.ts.map +1 -0
- package/dist/components/chat-message-toolbar/index.d.ts +2 -0
- package/dist/components/chat-message-toolbar/index.d.ts.map +1 -0
- package/dist/components/chat-messages/chat-messages.d.ts +24 -0
- package/dist/components/chat-messages/chat-messages.d.ts.map +1 -0
- package/dist/components/chat-messages/chat-messages.stories.d.ts +8 -0
- package/dist/components/chat-messages/chat-messages.stories.d.ts.map +1 -0
- package/dist/components/chat-messages/index.d.ts +2 -0
- package/dist/components/chat-messages/index.d.ts.map +1 -0
- package/dist/components/chat-notification-card/chat-notification-card.d.ts +114 -0
- package/dist/components/chat-notification-card/chat-notification-card.d.ts.map +1 -0
- package/dist/components/chat-notification-card/chat-notification-card.stories.d.ts +10 -0
- package/dist/components/chat-notification-card/chat-notification-card.stories.d.ts.map +1 -0
- package/dist/components/chat-notification-card/index.d.ts +4 -0
- package/dist/components/chat-notification-card/index.d.ts.map +1 -0
- package/dist/components/chat-notification-card/types.d.ts +2 -0
- package/dist/components/chat-notification-card/types.d.ts.map +1 -0
- package/dist/components/chat-notification-card/utils.d.ts +3 -0
- package/dist/components/chat-notification-card/utils.d.ts.map +1 -0
- package/dist/components/chat-notification-popup/chat-notification-popup.d.ts +12 -0
- package/dist/components/chat-notification-popup/chat-notification-popup.d.ts.map +1 -0
- package/dist/components/chat-notification-popup/chat-notification-popup.stories.d.ts +8 -0
- package/dist/components/chat-notification-popup/chat-notification-popup.stories.d.ts.map +1 -0
- package/dist/components/chat-notification-popup/index.d.ts +2 -0
- package/dist/components/chat-notification-popup/index.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/chat-prompt-box-context.d.ts +17 -0
- package/dist/components/chat-prompt-box/chat-prompt-box-context.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/chat-prompt-box-focus-plugin.d.ts +2 -0
- package/dist/components/chat-prompt-box/chat-prompt-box-focus-plugin.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/chat-prompt-box.d.ts +27 -0
- package/dist/components/chat-prompt-box/chat-prompt-box.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/chat-prompt-box.stories.d.ts +9 -0
- package/dist/components/chat-prompt-box/chat-prompt-box.stories.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/index.d.ts +3 -0
- package/dist/components/chat-prompt-box/index.d.ts.map +1 -0
- package/dist/components/chat-reply/chat-reply.d.ts +23 -0
- package/dist/components/chat-reply/chat-reply.d.ts.map +1 -0
- package/dist/components/chat-reply/chat-reply.stories.d.ts +7 -0
- package/dist/components/chat-reply/chat-reply.stories.d.ts.map +1 -0
- package/dist/components/chat-reply/index.d.ts +2 -0
- package/dist/components/chat-reply/index.d.ts.map +1 -0
- package/dist/components/chat-suggestion/chat-suggestion.d.ts +37 -0
- package/dist/components/chat-suggestion/chat-suggestion.d.ts.map +1 -0
- package/dist/components/chat-suggestion/chat-suggestion.stories.d.ts +9 -0
- package/dist/components/chat-suggestion/chat-suggestion.stories.d.ts.map +1 -0
- package/dist/components/chat-suggestion/index.d.ts +2 -0
- package/dist/components/chat-suggestion/index.d.ts.map +1 -0
- package/dist/components/chat-thinking-process/chat-thinking-process.d.ts +47 -0
- package/dist/components/chat-thinking-process/chat-thinking-process.d.ts.map +1 -0
- package/dist/components/chat-thinking-process/chat-thinking-process.stories.d.ts +10 -0
- package/dist/components/chat-thinking-process/chat-thinking-process.stories.d.ts.map +1 -0
- package/dist/components/chat-thinking-process/index.d.ts +2 -0
- package/dist/components/chat-thinking-process/index.d.ts.map +1 -0
- package/dist/components/chat-thread/chat-thread.d.ts +78 -0
- package/dist/components/chat-thread/chat-thread.d.ts.map +1 -0
- package/dist/components/chat-thread/chat-thread.stories.d.ts +14 -0
- package/dist/components/chat-thread/chat-thread.stories.d.ts.map +1 -0
- package/dist/components/chat-thread/index.d.ts +2 -0
- package/dist/components/chat-thread/index.d.ts.map +1 -0
- package/dist/components/deprecated-empty-state.d.ts +22 -0
- package/dist/components/deprecated-empty-state.d.ts.map +1 -0
- package/dist/components/index.d.ts +27 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/markdown-viewer/hooks.d.ts +9 -0
- package/dist/components/markdown-viewer/hooks.d.ts.map +1 -0
- package/dist/components/markdown-viewer/index.d.ts +3 -0
- package/dist/components/markdown-viewer/index.d.ts.map +1 -0
- package/dist/components/markdown-viewer/markdown-viewer.d.ts +10 -0
- package/dist/components/markdown-viewer/markdown-viewer.d.ts.map +1 -0
- package/dist/components/markdown-viewer/markdown-viewer.stories.d.ts +9 -0
- package/dist/components/markdown-viewer/markdown-viewer.stories.d.ts.map +1 -0
- package/dist/components/markdown-viewer/types.d.ts +9 -0
- package/dist/components/markdown-viewer/types.d.ts.map +1 -0
- package/dist/components/markdown-viewer/utils.d.ts +3 -0
- package/dist/components/markdown-viewer/utils.d.ts.map +1 -0
- package/dist/components/new-chat-trigger/index.d.ts +2 -0
- package/dist/components/new-chat-trigger/index.d.ts.map +1 -0
- package/dist/components/new-chat-trigger/new-chat-trigger.d.ts +8 -0
- package/dist/components/new-chat-trigger/new-chat-trigger.d.ts.map +1 -0
- package/dist/components/rich-text-area/constants/index.d.ts +3 -0
- package/dist/components/rich-text-area/constants/index.d.ts.map +1 -0
- package/dist/components/rich-text-area/hooks.d.ts +3 -0
- package/dist/components/rich-text-area/hooks.d.ts.map +1 -0
- package/dist/components/rich-text-area/html-config.d.ts +4 -0
- package/dist/components/rich-text-area/html-config.d.ts.map +1 -0
- package/dist/components/rich-text-area/index.d.ts +7 -0
- package/dist/components/rich-text-area/index.d.ts.map +1 -0
- package/dist/components/rich-text-area/nodes/div-block-node.d.ts +18 -0
- package/dist/components/rich-text-area/nodes/div-block-node.d.ts.map +1 -0
- package/dist/components/rich-text-area/nodes/image-node.d.ts +24 -0
- package/dist/components/rich-text-area/nodes/image-node.d.ts.map +1 -0
- package/dist/components/rich-text-area/plugins/blur-plugin.d.ts +6 -0
- package/dist/components/rich-text-area/plugins/blur-plugin.d.ts.map +1 -0
- package/dist/components/rich-text-area/plugins/controlled-plugin.d.ts +7 -0
- package/dist/components/rich-text-area/plugins/controlled-plugin.d.ts.map +1 -0
- package/dist/components/rich-text-area/plugins/controlled-value-plugin.d.ts +7 -0
- package/dist/components/rich-text-area/plugins/controlled-value-plugin.d.ts.map +1 -0
- package/dist/components/rich-text-area/plugins/disabled-plugin.d.ts +6 -0
- package/dist/components/rich-text-area/plugins/disabled-plugin.d.ts.map +1 -0
- package/dist/components/rich-text-area/plugins/file-attachment-plugin.d.ts +10 -0
- package/dist/components/rich-text-area/plugins/file-attachment-plugin.d.ts.map +1 -0
- package/dist/components/rich-text-area/plugins/focus-plugin.d.ts +6 -0
- package/dist/components/rich-text-area/plugins/focus-plugin.d.ts.map +1 -0
- package/dist/components/rich-text-area/plugins/html-paste-plugin.d.ts +19 -0
- package/dist/components/rich-text-area/plugins/html-paste-plugin.d.ts.map +1 -0
- package/dist/components/rich-text-area/plugins/image-drop-plugin.d.ts +12 -0
- package/dist/components/rich-text-area/plugins/image-drop-plugin.d.ts.map +1 -0
- package/dist/components/rich-text-area/plugins/index.d.ts +11 -0
- package/dist/components/rich-text-area/plugins/index.d.ts.map +1 -0
- package/dist/components/rich-text-area/plugins/markdown-plain-paste-plugin.d.ts +2 -0
- package/dist/components/rich-text-area/plugins/markdown-plain-paste-plugin.d.ts.map +1 -0
- package/dist/components/rich-text-area/plugins/value-plugin.d.ts +7 -0
- package/dist/components/rich-text-area/plugins/value-plugin.d.ts.map +1 -0
- package/dist/components/rich-text-area/rich-text-area.d.ts +20 -0
- package/dist/components/rich-text-area/rich-text-area.d.ts.map +1 -0
- package/dist/components/rich-text-area/rich-text-area.stories.d.ts +7 -0
- package/dist/components/rich-text-area/rich-text-area.stories.d.ts.map +1 -0
- package/dist/components/rich-text-area/styled.d.ts +3 -0
- package/dist/components/rich-text-area/styled.d.ts.map +1 -0
- package/dist/components/rich-text-area/transformers.d.ts +16 -0
- package/dist/components/rich-text-area/transformers.d.ts.map +1 -0
- package/dist/components/rich-text-area/types.d.ts +8 -0
- package/dist/components/rich-text-area/types.d.ts.map +1 -0
- package/dist/components/rich-text-area/utils/index.d.ts +6 -0
- package/dist/components/rich-text-area/utils/index.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/alignment-select.d.ts +5 -0
- package/dist/components/rich-text-field/components/alignment-select.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/attachment-button.d.ts +3 -0
- package/dist/components/rich-text-field/components/attachment-button.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/bold-button.d.ts +3 -0
- package/dist/components/rich-text-field/components/bold-button.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/clean-format-button.d.ts +3 -0
- package/dist/components/rich-text-field/components/clean-format-button.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/formatting-toolbar-plugin.d.ts +11 -0
- package/dist/components/rich-text-field/components/formatting-toolbar-plugin.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/image-button.d.ts +3 -0
- package/dist/components/rich-text-field/components/image-button.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/index.d.ts +14 -0
- package/dist/components/rich-text-field/components/index.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/italic-button.d.ts +3 -0
- package/dist/components/rich-text-field/components/italic-button.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/link-button.d.ts +3 -0
- package/dist/components/rich-text-field/components/link-button.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/size-select.d.ts +5 -0
- package/dist/components/rich-text-field/components/size-select.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/text-color-button.d.ts +3 -0
- package/dist/components/rich-text-field/components/text-color-button.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/toolbar-button.d.ts +6 -0
- package/dist/components/rich-text-field/components/toolbar-button.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/toolbar-select.d.ts +5 -0
- package/dist/components/rich-text-field/components/toolbar-select.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/typography-select.d.ts +5 -0
- package/dist/components/rich-text-field/components/typography-select.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/underline-button.d.ts +3 -0
- package/dist/components/rich-text-field/components/underline-button.d.ts.map +1 -0
- package/dist/components/rich-text-field/constants.d.ts +57 -0
- package/dist/components/rich-text-field/constants.d.ts.map +1 -0
- package/dist/components/rich-text-field/context.d.ts +26 -0
- package/dist/components/rich-text-field/context.d.ts.map +1 -0
- package/dist/components/rich-text-field/index.d.ts +3 -0
- package/dist/components/rich-text-field/index.d.ts.map +1 -0
- package/dist/components/rich-text-field/rich-text-field.d.ts +17 -0
- package/dist/components/rich-text-field/rich-text-field.d.ts.map +1 -0
- package/dist/components/rich-text-field/rich-text-field.stories.d.ts +10 -0
- package/dist/components/rich-text-field/rich-text-field.stories.d.ts.map +1 -0
- package/dist/components/rich-text-field/utils.d.ts +1759 -0
- package/dist/components/rich-text-field/utils.d.ts.map +1 -0
- package/dist/components/spinner/index.d.ts +2 -0
- package/dist/components/spinner/index.d.ts.map +1 -0
- package/dist/components/spinner/spinner.d.ts +9 -0
- package/dist/components/spinner/spinner.d.ts.map +1 -0
- package/dist/components/spinner/spinner.stories.d.ts +8 -0
- package/dist/components/spinner/spinner.stories.d.ts.map +1 -0
- package/dist/contexts/chat-context/chat-context.d.ts +20 -0
- package/dist/contexts/chat-context/chat-context.d.ts.map +1 -0
- package/dist/contexts/chat-context/index.d.ts +2 -0
- package/dist/contexts/chat-context/index.d.ts.map +1 -0
- package/dist/contexts/chat-context/utils.d.ts +3 -0
- package/dist/contexts/chat-context/utils.d.ts.map +1 -0
- package/dist/contexts/chat-conversation-context/chat-conversation-context.d.ts +20 -0
- package/dist/contexts/chat-conversation-context/chat-conversation-context.d.ts.map +1 -0
- package/dist/contexts/chat-conversation-context/index.d.ts +2 -0
- package/dist/contexts/chat-conversation-context/index.d.ts.map +1 -0
- package/dist/contexts/index.d.ts +3 -0
- package/dist/contexts/index.d.ts.map +1 -0
- package/dist/docs/agent.stories.d.ts +41 -0
- package/dist/docs/agent.stories.d.ts.map +1 -0
- package/dist/docs/chat-panel.d.ts +33 -0
- package/dist/docs/chat-panel.d.ts.map +1 -0
- package/dist/docs/chatbot-panel.d.ts +20 -0
- package/dist/docs/chatbot-panel.d.ts.map +1 -0
- package/dist/docs/chatbot.stories.d.ts +11 -0
- package/dist/docs/chatbot.stories.d.ts.map +1 -0
- package/dist/domain/actions/constants.d.ts +2 -0
- package/dist/domain/actions/constants.d.ts.map +1 -0
- package/dist/domain/actions/hooks/index.d.ts +3 -0
- package/dist/domain/actions/hooks/index.d.ts.map +1 -0
- package/dist/domain/actions/index.d.ts +5 -0
- package/dist/domain/actions/index.d.ts.map +1 -0
- package/dist/domain/actions/types.d.ts +7 -0
- package/dist/domain/actions/types.d.ts.map +1 -0
- package/dist/domain/actions/utils/index.d.ts +11 -0
- package/dist/domain/actions/utils/index.d.ts.map +1 -0
- package/dist/domain/index.d.ts +2 -0
- package/dist/domain/index.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/use-chat-prompt-placeholder.d.ts +6 -0
- package/dist/hooks/use-chat-prompt-placeholder.d.ts.map +1 -0
- package/dist/hooks/use-chat-stream-message.d.ts +42 -0
- package/dist/hooks/use-chat-stream-message.d.ts.map +1 -0
- package/dist/hooks/use-current-chat-id.d.ts +2 -0
- package/dist/hooks/use-current-chat-id.d.ts.map +1 -0
- package/dist/hooks/use-is-current-chat-new.d.ts +2 -0
- package/dist/hooks/use-is-current-chat-new.d.ts.map +1 -0
- package/dist/hooks/use-loaded-chat-ids.d.ts +9 -0
- package/dist/hooks/use-loaded-chat-ids.d.ts.map +1 -0
- package/dist/hooks/use-on-chat-changed.d.ts +9 -0
- package/dist/hooks/use-on-chat-changed.d.ts.map +1 -0
- package/dist/index.css +2 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.es.js +4404 -0
- package/dist/index.es.js.map +1 -0
- package/dist/layouts/chat-card-list-layout/chat-card-list-layout.d.ts +95 -0
- package/dist/layouts/chat-card-list-layout/chat-card-list-layout.d.ts.map +1 -0
- package/dist/layouts/chat-card-list-layout/chat-card-list-layout.stories.d.ts +24 -0
- package/dist/layouts/chat-card-list-layout/chat-card-list-layout.stories.d.ts.map +1 -0
- package/dist/layouts/chat-card-list-layout/index.d.ts +3 -0
- package/dist/layouts/chat-card-list-layout/index.d.ts.map +1 -0
- package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.d.ts +84 -0
- package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.d.ts.map +1 -0
- package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.sizing.d.ts +45 -0
- package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.sizing.d.ts.map +1 -0
- package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.stories.d.ts +37 -0
- package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.stories.d.ts.map +1 -0
- package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.variants.d.ts +81 -0
- package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.variants.d.ts.map +1 -0
- package/dist/layouts/chat-card-three-column-layout/index.d.ts +5 -0
- package/dist/layouts/chat-card-three-column-layout/index.d.ts.map +1 -0
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.d.ts +31 -0
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.d.ts.map +1 -0
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.sizing.d.ts +12 -0
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.sizing.d.ts.map +1 -0
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.stories.d.ts +19 -0
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.stories.d.ts.map +1 -0
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.variants.d.ts +35 -0
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.variants.d.ts.map +1 -0
- package/dist/layouts/chat-card-two-column-layout/index.d.ts +4 -0
- package/dist/layouts/chat-card-two-column-layout/index.d.ts.map +1 -0
- package/dist/layouts/index.d.ts +4 -0
- package/dist/layouts/index.d.ts.map +1 -0
- package/dist/types.d.ts +22 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/use-streaming-markdown.d.ts +18 -0
- package/dist/utils/use-streaming-markdown.d.ts.map +1 -0
- package/package.json +155 -0
- package/src/__tests__/setup.ts +5 -0
- package/src/components/canvas-shell/canvas-shell.json +126 -0
- package/src/components/canvas-shell/canvas-shell.stories.tsx +194 -0
- package/src/components/canvas-shell/canvas-shell.test.tsx +205 -0
- package/src/components/canvas-shell/canvas-shell.tsx +250 -0
- package/src/components/canvas-shell/index.ts +19 -0
- package/src/components/card-item-picker/__tests__/card-item-picker.spec.tsx +279 -0
- package/src/components/card-item-picker/card-item-picker-context.tsx +44 -0
- package/src/components/card-item-picker/card-item-picker-list.tsx +95 -0
- package/src/components/card-item-picker/card-item-picker-row-parts.tsx +96 -0
- package/src/components/card-item-picker/card-item-picker-row.tsx +109 -0
- package/src/components/card-item-picker/card-item-picker.json +147 -0
- package/src/components/card-item-picker/card-item-picker.stories.tsx +158 -0
- package/src/components/card-item-picker/index.ts +24 -0
- package/src/components/chat-card/__tests__/chat-card.spec.tsx +118 -0
- package/src/components/chat-card/chat-card.json +162 -0
- package/src/components/chat-card/chat-card.stories.tsx +349 -0
- package/src/components/chat-card/chat-card.tsx +106 -0
- package/src/components/chat-card/components/chat-card-body.tsx +115 -0
- package/src/components/chat-card/components/chat-card-footer.tsx +95 -0
- package/src/components/chat-card/components/chat-card-form.tsx +120 -0
- package/src/components/chat-card/components/chat-card-header.tsx +240 -0
- package/src/components/chat-card/components/index.ts +4 -0
- package/src/components/chat-card/context.tsx +34 -0
- package/src/components/chat-card/contexts.tsx +42 -0
- package/src/components/chat-card/hooks.ts +51 -0
- package/src/components/chat-card/index.ts +5 -0
- package/src/components/chat-card/types.ts +23 -0
- package/src/components/chat-card-container/chat-card-container.json +84 -0
- package/src/components/chat-card-container/chat-card-container.stories.tsx +149 -0
- package/src/components/chat-card-container/chat-card-container.tsx +75 -0
- package/src/components/chat-card-container/index.ts +2 -0
- package/src/components/chat-container/chat-container.json +93 -0
- package/src/components/chat-container/chat-container.stories.tsx +179 -0
- package/src/components/chat-container/chat-container.tsx +231 -0
- package/src/components/chat-container/index.ts +2 -0
- package/src/components/chat-input/chat-input.json +106 -0
- package/src/components/chat-input/chat-input.stories.tsx +291 -0
- package/src/components/chat-input/chat-input.tsx +220 -0
- package/src/components/chat-input/index.ts +2 -0
- package/src/components/chat-input/plugins/auto-focus-plugin.tsx +43 -0
- package/src/components/chat-input/plugins/controlled-value-plugin.tsx +47 -0
- package/src/components/chat-input/plugins/disabled-plugin.tsx +18 -0
- package/src/components/chat-input/plugins/focus-plugin.tsx +44 -0
- package/src/components/chat-input/plugins/has-value-plugin.tsx +51 -0
- package/src/components/chat-input/plugins/hooks.ts +7 -0
- package/src/components/chat-input/plugins/index.ts +7 -0
- package/src/components/chat-input/plugins/markdown-plain-paste-plugin.tsx +63 -0
- package/src/components/chat-input/plugins/utils.ts +48 -0
- package/src/components/chat-input/plugins/value-plugin.tsx +35 -0
- package/src/components/chat-input/transformers.ts +4 -0
- package/src/components/chat-list/chat-list-item.tsx +33 -0
- package/src/components/chat-list/chat-list-items.tsx +144 -0
- package/src/components/chat-list/chat-list.json +117 -0
- package/src/components/chat-list/chat-list.stories.tsx +332 -0
- package/src/components/chat-list/chat-list.tsx +278 -0
- package/src/components/chat-list/index.ts +18 -0
- package/src/components/chat-message/chat-message.json +105 -0
- package/src/components/chat-message/chat-message.stories.tsx +95 -0
- package/src/components/chat-message/chat-message.tsx +66 -0
- package/src/components/chat-message/index.ts +1 -0
- package/src/components/chat-message-attachment-card/chat-message-attachment-card-icon.tsx +74 -0
- package/src/components/chat-message-attachment-card/chat-message-attachment-card.json +110 -0
- package/src/components/chat-message-attachment-card/chat-message-attachment-card.stories.tsx +131 -0
- package/src/components/chat-message-attachment-card/chat-message-attachment-card.tsx +142 -0
- package/src/components/chat-message-attachment-card/index.ts +12 -0
- package/src/components/chat-message-attachment-card/utils.ts +41 -0
- package/src/components/chat-message-history/chat-message-history.json +99 -0
- package/src/components/chat-message-history/chat-message-history.stories.tsx +136 -0
- package/src/components/chat-message-history/chat-message-history.tsx +277 -0
- package/src/components/chat-message-history/index.ts +13 -0
- package/src/components/chat-message-response/chat-message-response.json +68 -0
- package/src/components/chat-message-response/chat-message-response.stories.tsx +63 -0
- package/src/components/chat-message-response/chat-message-response.tsx +24 -0
- package/src/components/chat-message-response/index.ts +1 -0
- package/src/components/chat-message-toolbar/chat-message-toolbar.json +100 -0
- package/src/components/chat-message-toolbar/chat-message-toolbar.stories.tsx +62 -0
- package/src/components/chat-message-toolbar/chat-message-toolbar.tsx +97 -0
- package/src/components/chat-message-toolbar/index.ts +6 -0
- package/src/components/chat-messages/chat-messages.json +95 -0
- package/src/components/chat-messages/chat-messages.stories.tsx +284 -0
- package/src/components/chat-messages/chat-messages.tsx +264 -0
- package/src/components/chat-messages/index.ts +10 -0
- package/src/components/chat-notification-card/chat-notification-card.json +135 -0
- package/src/components/chat-notification-card/chat-notification-card.stories.tsx +290 -0
- package/src/components/chat-notification-card/chat-notification-card.tsx +684 -0
- package/src/components/chat-notification-card/index.ts +3 -0
- package/src/components/chat-notification-card/types.ts +1 -0
- package/src/components/chat-notification-card/utils.ts +34 -0
- package/src/components/chat-notification-popup/chat-notification-popup.json +97 -0
- package/src/components/chat-notification-popup/chat-notification-popup.stories.tsx +80 -0
- package/src/components/chat-notification-popup/chat-notification-popup.tsx +36 -0
- package/src/components/chat-notification-popup/index.ts +1 -0
- package/src/components/chat-prompt-box/chat-prompt-box-context.tsx +62 -0
- package/src/components/chat-prompt-box/chat-prompt-box-focus-plugin.tsx +22 -0
- package/src/components/chat-prompt-box/chat-prompt-box.json +106 -0
- package/src/components/chat-prompt-box/chat-prompt-box.stories.tsx +117 -0
- package/src/components/chat-prompt-box/chat-prompt-box.tsx +296 -0
- package/src/components/chat-prompt-box/index.ts +16 -0
- package/src/components/chat-reply/chat-reply.json +79 -0
- package/src/components/chat-reply/chat-reply.stories.tsx +72 -0
- package/src/components/chat-reply/chat-reply.tsx +103 -0
- package/src/components/chat-reply/index.ts +1 -0
- package/src/components/chat-suggestion/chat-suggestion.json +108 -0
- package/src/components/chat-suggestion/chat-suggestion.stories.tsx +147 -0
- package/src/components/chat-suggestion/chat-suggestion.tsx +184 -0
- package/src/components/chat-suggestion/index.ts +8 -0
- package/src/components/chat-thinking-process/chat-thinking-process.json +110 -0
- package/src/components/chat-thinking-process/chat-thinking-process.stories.tsx +202 -0
- package/src/components/chat-thinking-process/chat-thinking-process.tsx +268 -0
- package/src/components/chat-thinking-process/index.ts +9 -0
- package/src/components/chat-thread/__tests__/chat-thread.spec.tsx +385 -0
- package/src/components/chat-thread/chat-thread.json +120 -0
- package/src/components/chat-thread/chat-thread.stories.tsx +218 -0
- package/src/components/chat-thread/chat-thread.tsx +549 -0
- package/src/components/chat-thread/index.ts +18 -0
- package/src/components/deprecated-empty-state.ts +39 -0
- package/src/components/index.ts +26 -0
- package/src/components/markdown-viewer/hooks.ts +59 -0
- package/src/components/markdown-viewer/index.ts +2 -0
- package/src/components/markdown-viewer/markdown-viewer.json +84 -0
- package/src/components/markdown-viewer/markdown-viewer.stories.tsx +110 -0
- package/src/components/markdown-viewer/markdown-viewer.tsx +95 -0
- package/src/components/markdown-viewer/types.ts +10 -0
- package/src/components/markdown-viewer/utils.ts +5 -0
- package/src/components/new-chat-trigger/index.ts +1 -0
- package/src/components/new-chat-trigger/new-chat-trigger.tsx +29 -0
- package/src/components/rich-text-area/constants/index.ts +10 -0
- package/src/components/rich-text-area/hooks.ts +24 -0
- package/src/components/rich-text-area/html-config.ts +195 -0
- package/src/components/rich-text-area/index.ts +6 -0
- package/src/components/rich-text-area/nodes/div-block-node.tsx +145 -0
- package/src/components/rich-text-area/nodes/image-node.tsx +100 -0
- package/src/components/rich-text-area/plugins/blur-plugin.tsx +36 -0
- package/src/components/rich-text-area/plugins/controlled-plugin.tsx +23 -0
- package/src/components/rich-text-area/plugins/controlled-value-plugin.tsx +101 -0
- package/src/components/rich-text-area/plugins/disabled-plugin.tsx +17 -0
- package/src/components/rich-text-area/plugins/file-attachment-plugin.tsx +57 -0
- package/src/components/rich-text-area/plugins/focus-plugin.tsx +44 -0
- package/src/components/rich-text-area/plugins/html-paste-plugin.tsx +104 -0
- package/src/components/rich-text-area/plugins/image-drop-plugin.tsx +56 -0
- package/src/components/rich-text-area/plugins/index.ts +10 -0
- package/src/components/rich-text-area/plugins/markdown-plain-paste-plugin.tsx +63 -0
- package/src/components/rich-text-area/plugins/value-plugin.tsx +46 -0
- package/src/components/rich-text-area/rich-text-area.json +102 -0
- package/src/components/rich-text-area/rich-text-area.stories.tsx +140 -0
- package/src/components/rich-text-area/rich-text-area.tsx +156 -0
- package/src/components/rich-text-area/styled.tsx +20 -0
- package/src/components/rich-text-area/transformers.ts +175 -0
- package/src/components/rich-text-area/types.ts +8 -0
- package/src/components/rich-text-area/utils/index.ts +77 -0
- package/src/components/rich-text-field/components/alignment-select.tsx +103 -0
- package/src/components/rich-text-field/components/attachment-button.tsx +25 -0
- package/src/components/rich-text-field/components/bold-button.tsx +21 -0
- package/src/components/rich-text-field/components/clean-format-button.tsx +44 -0
- package/src/components/rich-text-field/components/formatting-toolbar-plugin.tsx +69 -0
- package/src/components/rich-text-field/components/image-button.tsx +11 -0
- package/src/components/rich-text-field/components/index.ts +14 -0
- package/src/components/rich-text-field/components/italic-button.tsx +21 -0
- package/src/components/rich-text-field/components/link-button.tsx +11 -0
- package/src/components/rich-text-field/components/size-select.tsx +27 -0
- package/src/components/rich-text-field/components/text-color-button.tsx +41 -0
- package/src/components/rich-text-field/components/toolbar-button.tsx +27 -0
- package/src/components/rich-text-field/components/toolbar-select.tsx +19 -0
- package/src/components/rich-text-field/components/typography-select.tsx +27 -0
- package/src/components/rich-text-field/components/underline-button.tsx +21 -0
- package/src/components/rich-text-field/constants.ts +33 -0
- package/src/components/rich-text-field/context.tsx +251 -0
- package/src/components/rich-text-field/index.tsx +6 -0
- package/src/components/rich-text-field/rich-text-field.json +118 -0
- package/src/components/rich-text-field/rich-text-field.stories.tsx +218 -0
- package/src/components/rich-text-field/rich-text-field.tsx +93 -0
- package/src/components/rich-text-field/utils.ts +532 -0
- package/src/components/spinner/index.ts +1 -0
- package/src/components/spinner/spinner.json +73 -0
- package/src/components/spinner/spinner.stories.tsx +41 -0
- package/src/components/spinner/spinner.tsx +32 -0
- package/src/contexts/chat-context/chat-context.tsx +97 -0
- package/src/contexts/chat-context/index.ts +1 -0
- package/src/contexts/chat-context/utils.ts +7 -0
- package/src/contexts/chat-conversation-context/chat-conversation-context.tsx +608 -0
- package/src/contexts/chat-conversation-context/index.ts +1 -0
- package/src/contexts/index.ts +2 -0
- package/src/docs/agent.stories.tsx +567 -0
- package/src/docs/chat-panel.tsx +174 -0
- package/src/docs/chatbot-panel.tsx +381 -0
- package/src/docs/chatbot.mdx +144 -0
- package/src/docs/chatbot.stories.tsx +63 -0
- package/src/domain/actions/constants.ts +1 -0
- package/src/domain/actions/hooks/index.ts +22 -0
- package/src/domain/actions/index.ts +4 -0
- package/src/domain/actions/types.ts +6 -0
- package/src/domain/actions/utils/index.ts +112 -0
- package/src/domain/index.ts +1 -0
- package/src/hooks/index.tsx +10 -0
- package/src/hooks/use-chat-prompt-placeholder.ts +7 -0
- package/src/hooks/use-chat-stream-message.ts +189 -0
- package/src/hooks/use-current-chat-id.ts +6 -0
- package/src/hooks/use-is-current-chat-new.ts +6 -0
- package/src/hooks/use-loaded-chat-ids.ts +32 -0
- package/src/hooks/use-on-chat-changed.ts +33 -0
- package/src/index.css +1 -0
- package/src/index.ts +6 -0
- package/src/layouts/chat-card-list-layout/__tests__/chat-card-list-layout.spec.tsx +204 -0
- package/src/layouts/chat-card-list-layout/chat-card-list-layout.json +116 -0
- package/src/layouts/chat-card-list-layout/chat-card-list-layout.stories.tsx +190 -0
- package/src/layouts/chat-card-list-layout/chat-card-list-layout.tsx +250 -0
- package/src/layouts/chat-card-list-layout/index.ts +11 -0
- package/src/layouts/chat-card-three-column-layout/__tests__/chat-card-three-column-layout.sizing.test.ts +73 -0
- package/src/layouts/chat-card-three-column-layout/__tests__/chat-card-three-column-layout.spec.tsx +282 -0
- package/src/layouts/chat-card-three-column-layout/chat-card-three-column-layout.json +131 -0
- package/src/layouts/chat-card-three-column-layout/chat-card-three-column-layout.sizing.ts +78 -0
- package/src/layouts/chat-card-three-column-layout/chat-card-three-column-layout.stories.tsx +273 -0
- package/src/layouts/chat-card-three-column-layout/chat-card-three-column-layout.tsx +291 -0
- package/src/layouts/chat-card-three-column-layout/chat-card-three-column-layout.variants.ts +135 -0
- package/src/layouts/chat-card-three-column-layout/index.ts +24 -0
- package/src/layouts/chat-card-two-column-layout/__tests__/chat-card-two-column-layout.spec.tsx +109 -0
- package/src/layouts/chat-card-two-column-layout/chat-card-two-column-layout.json +97 -0
- package/src/layouts/chat-card-two-column-layout/chat-card-two-column-layout.sizing.ts +21 -0
- package/src/layouts/chat-card-two-column-layout/chat-card-two-column-layout.stories.tsx +138 -0
- package/src/layouts/chat-card-two-column-layout/chat-card-two-column-layout.tsx +132 -0
- package/src/layouts/chat-card-two-column-layout/chat-card-two-column-layout.variants.ts +65 -0
- package/src/layouts/chat-card-two-column-layout/index.ts +17 -0
- package/src/layouts/index.ts +3 -0
- package/src/types.ts +29 -0
- package/src/utils/use-streaming-markdown.ts +113 -0
- package/tailwind.css +7 -0
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
2
|
+
import {
|
|
3
|
+
createContext,
|
|
4
|
+
memo,
|
|
5
|
+
useContext,
|
|
6
|
+
useLayoutEffect,
|
|
7
|
+
useMemo,
|
|
8
|
+
type CSSProperties,
|
|
9
|
+
type ReactNode,
|
|
10
|
+
type ComponentProps,
|
|
11
|
+
} from 'react';
|
|
12
|
+
|
|
13
|
+
import { useChatConversationContext } from '@/contexts';
|
|
14
|
+
import { ChevronDownIcon } from '@swisper.ai/icons';
|
|
15
|
+
import { IconButton, Tooltip } from '@swisper.ai/ui';
|
|
16
|
+
import { cn } from '@swisper.ai/web-core';
|
|
17
|
+
|
|
18
|
+
interface ChatMessagesContextValue {
|
|
19
|
+
messageCount: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const ChatMessagesContext = createContext<ChatMessagesContextValue | null>(null);
|
|
23
|
+
|
|
24
|
+
const ChatMessagesListRowContext = createContext(false);
|
|
25
|
+
|
|
26
|
+
function useChatMessagesContext() {
|
|
27
|
+
const context = useContext(ChatMessagesContext);
|
|
28
|
+
|
|
29
|
+
if (!context) {
|
|
30
|
+
throw new Error('"ChatMessagesList" must be used within a ChatMessages');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return context;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface ChatMessagesProps {
|
|
37
|
+
children: ReactNode;
|
|
38
|
+
className?: string;
|
|
39
|
+
messageCount?: number;
|
|
40
|
+
gap?: number;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function ChatMessages({
|
|
44
|
+
children,
|
|
45
|
+
className,
|
|
46
|
+
messageCount = 0,
|
|
47
|
+
gap = 16,
|
|
48
|
+
}: ChatMessagesProps) {
|
|
49
|
+
const { setMessageCount } = useChatConversationContext();
|
|
50
|
+
const contextValue = useMemo<ChatMessagesContextValue>(() => ({ messageCount }), [messageCount]);
|
|
51
|
+
|
|
52
|
+
useLayoutEffect(() => {
|
|
53
|
+
setMessageCount(messageCount);
|
|
54
|
+
}, [messageCount, setMessageCount]);
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<ChatMessagesContext.Provider value={contextValue}>
|
|
58
|
+
<div
|
|
59
|
+
data-testid="chat-messages"
|
|
60
|
+
className={cn('relative flex min-h-0 flex-1 flex-col', className)}
|
|
61
|
+
style={{ '--chat-messages-gap': `${gap}px` } as CSSProperties}
|
|
62
|
+
>
|
|
63
|
+
{children}
|
|
64
|
+
</div>
|
|
65
|
+
</ChatMessagesContext.Provider>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface ChatMessagesListProps {
|
|
70
|
+
children: (index: number) => ReactNode;
|
|
71
|
+
className?: string;
|
|
72
|
+
bottomTriggerClassName?: string;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function ChatMessagesList({
|
|
76
|
+
children,
|
|
77
|
+
className,
|
|
78
|
+
bottomTriggerClassName,
|
|
79
|
+
}: ChatMessagesListProps) {
|
|
80
|
+
const { viewportRef, bottomTriggerRef, scrollToLatest } = useChatConversationContext();
|
|
81
|
+
const { messageCount } = useChatMessagesContext();
|
|
82
|
+
|
|
83
|
+
const rows = useMemo(() => {
|
|
84
|
+
return Array.from({ length: messageCount }, (_, index) => index);
|
|
85
|
+
}, [messageCount]);
|
|
86
|
+
|
|
87
|
+
const lastIndex = messageCount - 1;
|
|
88
|
+
|
|
89
|
+
useLayoutEffect(() => {
|
|
90
|
+
scrollToLatest();
|
|
91
|
+
}, [messageCount, scrollToLatest]);
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<ScrollAreaPrimitive.Root
|
|
95
|
+
className={cn(
|
|
96
|
+
'min-h-0 flex-1',
|
|
97
|
+
'relative group/scroll-area',
|
|
98
|
+
'overflow-y-hidden',
|
|
99
|
+
'transform-gpu',
|
|
100
|
+
)}
|
|
101
|
+
>
|
|
102
|
+
<ScrollAreaPrimitive.Viewport
|
|
103
|
+
ref={viewportRef}
|
|
104
|
+
className={cn('@container-[size]', 'will-change-scroll h-full w-full')}
|
|
105
|
+
style={{ scrollbarGutter: 'stable both-edges' }}
|
|
106
|
+
>
|
|
107
|
+
<ul
|
|
108
|
+
data-testid="chat-messages-list"
|
|
109
|
+
role="log"
|
|
110
|
+
aria-label="Message list"
|
|
111
|
+
aria-atomic="false"
|
|
112
|
+
className={cn('m-0 flex flex-col gap-(--chat-messages-gap) p-0', className)}
|
|
113
|
+
>
|
|
114
|
+
{rows.map((index) => (
|
|
115
|
+
<ChatMessagesListRow key={index} index={index} isLast={index === lastIndex}>
|
|
116
|
+
{children}
|
|
117
|
+
</ChatMessagesListRow>
|
|
118
|
+
))}
|
|
119
|
+
|
|
120
|
+
<li
|
|
121
|
+
ref={bottomTriggerRef}
|
|
122
|
+
className={cn('h-px -mt-(--chat-messages-gap)', bottomTriggerClassName)}
|
|
123
|
+
aria-hidden="true"
|
|
124
|
+
/>
|
|
125
|
+
</ul>
|
|
126
|
+
</ScrollAreaPrimitive.Viewport>
|
|
127
|
+
|
|
128
|
+
<ChatMessagesScrollBar orientation="vertical" />
|
|
129
|
+
</ScrollAreaPrimitive.Root>
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
interface ChatMessagesListRowProps {
|
|
134
|
+
children: (index: number) => ReactNode;
|
|
135
|
+
index: number;
|
|
136
|
+
isLast: boolean;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const ChatMessagesListRow = memo(function ChatMessagesListRow({
|
|
140
|
+
children,
|
|
141
|
+
index,
|
|
142
|
+
isLast,
|
|
143
|
+
}: ChatMessagesListRowProps) {
|
|
144
|
+
return (
|
|
145
|
+
<li>
|
|
146
|
+
<ChatMessagesListRowContext.Provider value={isLast}>
|
|
147
|
+
{children(index)}
|
|
148
|
+
</ChatMessagesListRowContext.Provider>
|
|
149
|
+
</li>
|
|
150
|
+
);
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
export interface ChatMessageListGroupProps extends ComponentProps<'div'> {}
|
|
154
|
+
|
|
155
|
+
export function ChatMessageListGroup({ children, className, ...rest }: ChatMessageListGroupProps) {
|
|
156
|
+
const isLast = useContext(ChatMessagesListRowContext);
|
|
157
|
+
const { lastItemRef } = useChatConversationContext();
|
|
158
|
+
|
|
159
|
+
return (
|
|
160
|
+
<div
|
|
161
|
+
ref={isLast ? lastItemRef : undefined}
|
|
162
|
+
data-is-last={isLast}
|
|
163
|
+
className={cn(
|
|
164
|
+
'flex flex-col gap-(--chat-messages-gap)',
|
|
165
|
+
'data-[is-last=true]:min-h-[calc(100cqh-var(--chat-messages-gap))]',
|
|
166
|
+
className,
|
|
167
|
+
)}
|
|
168
|
+
{...rest}
|
|
169
|
+
>
|
|
170
|
+
{children}
|
|
171
|
+
</div>
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export interface ChatMessagesScrollButtonProps {
|
|
176
|
+
className?: string;
|
|
177
|
+
tooltip?: string;
|
|
178
|
+
children?: ReactNode;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
interface ChatMessagesScrollBarProps extends ComponentProps<
|
|
182
|
+
typeof ScrollAreaPrimitive.ScrollAreaScrollbar
|
|
183
|
+
> {
|
|
184
|
+
className?: string;
|
|
185
|
+
orientation?: 'vertical' | 'horizontal';
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function ChatMessagesScrollBar({
|
|
189
|
+
className,
|
|
190
|
+
orientation = 'vertical',
|
|
191
|
+
...rest
|
|
192
|
+
}: ChatMessagesScrollBarProps) {
|
|
193
|
+
return (
|
|
194
|
+
<ScrollAreaPrimitive.ScrollAreaScrollbar
|
|
195
|
+
data-slot="scroll-area-scrollbar"
|
|
196
|
+
orientation={orientation}
|
|
197
|
+
className={cn(
|
|
198
|
+
'opacity-0 group-hover/scroll-area:opacity-100',
|
|
199
|
+
'rounded-[8px]',
|
|
200
|
+
'bg-scrollbar-track hover:bg-scrollbar-track-hover',
|
|
201
|
+
'transition-opacity duration-200 ease-in-out',
|
|
202
|
+
'flextouch-none select-none transition-colors',
|
|
203
|
+
orientation === 'vertical' &&
|
|
204
|
+
'h-full w-scrollbar border-l border-l-transparent px-4 py-[12px]',
|
|
205
|
+
orientation === 'horizontal' &&
|
|
206
|
+
'h-scrollbar w-full border-t border-t-transparent px-[12px] py-4',
|
|
207
|
+
className,
|
|
208
|
+
)}
|
|
209
|
+
{...rest}
|
|
210
|
+
>
|
|
211
|
+
<ScrollAreaPrimitive.ScrollAreaThumb
|
|
212
|
+
data-slot="scroll-area-thumb"
|
|
213
|
+
className={cn(
|
|
214
|
+
'relative flex-1 rounded-full',
|
|
215
|
+
'bg-scrollbar-thumb hover:bg-scrollbar-thumb-hover',
|
|
216
|
+
orientation === 'vertical' && 'w-scrollbar-thumb!',
|
|
217
|
+
orientation === 'horizontal' && 'h-scrollbar-thumb!',
|
|
218
|
+
)}
|
|
219
|
+
/>
|
|
220
|
+
</ScrollAreaPrimitive.ScrollAreaScrollbar>
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export const ChatMessagesScrollButton = memo(function ChatMessagesScrollButton({
|
|
225
|
+
className,
|
|
226
|
+
tooltip,
|
|
227
|
+
children,
|
|
228
|
+
}: ChatMessagesScrollButtonProps) {
|
|
229
|
+
const { isAtBottom, scrollBottom } = useChatConversationContext();
|
|
230
|
+
|
|
231
|
+
return (
|
|
232
|
+
<div
|
|
233
|
+
data-testid="chat-message-history-scroll-button"
|
|
234
|
+
data-hidden={isAtBottom}
|
|
235
|
+
aria-hidden={isAtBottom ? true : undefined}
|
|
236
|
+
className={cn(
|
|
237
|
+
'absolute',
|
|
238
|
+
'px-[12px]',
|
|
239
|
+
'bottom-0',
|
|
240
|
+
'right-0 -translate-x-[12px]',
|
|
241
|
+
'md:right-auto md:left-1/2 md:-translate-x-1/2',
|
|
242
|
+
'-translate-y-[12px]',
|
|
243
|
+
'flex items-center justify-center',
|
|
244
|
+
'transition-opacity duration-200 ease-in-out',
|
|
245
|
+
'data-[hidden=true]:pointer-events-none',
|
|
246
|
+
'data-[hidden=true]:opacity-0 data-[hidden=false]:opacity-100',
|
|
247
|
+
className,
|
|
248
|
+
)}
|
|
249
|
+
>
|
|
250
|
+
<Tooltip tooltip={tooltip} side={'top'}>
|
|
251
|
+
<IconButton
|
|
252
|
+
className="bg-paper-elevation-2"
|
|
253
|
+
color="primary"
|
|
254
|
+
size="md"
|
|
255
|
+
onClick={() => scrollBottom()}
|
|
256
|
+
tabIndex={-1}
|
|
257
|
+
aria-label={tooltip}
|
|
258
|
+
>
|
|
259
|
+
{children || <ChevronDownIcon />}
|
|
260
|
+
</IconButton>
|
|
261
|
+
</Tooltip>
|
|
262
|
+
</div>
|
|
263
|
+
);
|
|
264
|
+
});
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../../../int-eslint-config/schemas/component.schema.json",
|
|
3
|
+
"component": "chat-notification-card",
|
|
4
|
+
"purpose": "Compact, expandable notification item with an icon, an uppercase title, a priority chip, a timestamp and read, snooze, delete or close actions.",
|
|
5
|
+
"useWhen": [
|
|
6
|
+
"Listing notifications such as system updates or overdue tasks in a notification panel or popup",
|
|
7
|
+
"Showing one notification on its own over the chat, with snooze and close instead of read and delete",
|
|
8
|
+
"A notification has a longer description or a follow-up action ('View task') revealed on expand"
|
|
9
|
+
],
|
|
10
|
+
"avoidWhen": [
|
|
11
|
+
"A structured result the assistant returns in the conversation — use web-chat-ui/chat-card instead",
|
|
12
|
+
"A persistent status message on a page or section — use ui/banner instead",
|
|
13
|
+
"A plain list of items without notification actions — use ui/list instead"
|
|
14
|
+
],
|
|
15
|
+
"uxPrinciples": [
|
|
16
|
+
"Scannable first: the collapsed card shows the title, priority and a two-line description; detail and actions wait for expand.",
|
|
17
|
+
"Priority is shown only when it matters: low priority shows no chip, so medium and high stand out."
|
|
18
|
+
],
|
|
19
|
+
"accessibility": {
|
|
20
|
+
"required": [
|
|
21
|
+
"The root renders role=alert, so a screen reader announces each card as it mounts; mounting a whole list at once announces every card",
|
|
22
|
+
"The built-in expand button has no aria-label and ChatNotificationCardContent passes no props to it — it is announced only by its aria-expanded state",
|
|
23
|
+
"ChatNotificationCardReadActionButton keeps the label 'Mark notifications as read' in both states; pass aria-label yourself when it should read 'Mark as unread' after isRead is true",
|
|
24
|
+
"Card onClick is mouse-only (the root is a div with no key handler); put a real button in ChatNotificationCardContentActions for the same action"
|
|
25
|
+
],
|
|
26
|
+
"keyboard": [
|
|
27
|
+
"Tab reaches the action buttons and the expand button; Enter and Space activate them",
|
|
28
|
+
"The expand button stays focusable while invisible (opacity 0 until the card is hovered or expanded)"
|
|
29
|
+
],
|
|
30
|
+
"aria": [
|
|
31
|
+
"Root: role=alert with aria-expanded and data-expanded",
|
|
32
|
+
"Read, snooze, delete and close buttons carry built-in aria-labels ('Mark notifications as read', 'Snooze notification', 'Delete notification', 'Close notification'); the snoozed state renders a text button instead",
|
|
33
|
+
"Expand button: aria-expanded",
|
|
34
|
+
"ChatNotificationCardActions, ChatNotificationCardButtons and ChatNotificationCardContentActions render role=group"
|
|
35
|
+
],
|
|
36
|
+
"focus": ["The card root is not a tab stop; each button is"]
|
|
37
|
+
},
|
|
38
|
+
"behaviour": {
|
|
39
|
+
"states": [
|
|
40
|
+
"collapsed (description clamped to two lines, content actions hidden)",
|
|
41
|
+
"expanded",
|
|
42
|
+
"hover (overlay and expand button appear)",
|
|
43
|
+
"snoozed",
|
|
44
|
+
"read / unread"
|
|
45
|
+
],
|
|
46
|
+
"rules": [
|
|
47
|
+
"Expanded state is uncontrolled through defaultExpanded (collapsed by default) or controlled through expanded plus onExpandedChange; only the expand button changes it",
|
|
48
|
+
"ChatNotificationCardContent renders the expand button itself, at its bottom-right corner",
|
|
49
|
+
"onClick fires on a click anywhere on the card except inside ChatNotificationCardButtons and on the expand button, which stop propagation — use it to open the notification's target",
|
|
50
|
+
"ChatNotificationCardHeaderStatus maps priority to the chip: high is an outlined error chip, medium (the default) an outlined warning chip, and low renders nothing",
|
|
51
|
+
"ChatNotificationCardReadActionButton calls onRead with the toggled value; isRead swaps the icon",
|
|
52
|
+
"ChatNotificationCardSnoozeButton with snoozeUntilDate in the future renders a text button showing the time left (formatDate, 'in 2 minutes' by default); hovering swaps the text for cancelLabel and clicking calls onCancel. Otherwise it is an icon button that calls onClick. The snoozed check runs on render, so re-render when the time passes",
|
|
53
|
+
"getSnoozeUntilDate(minutes) returns a Date that many minutes from now; formatSnoozeDate(date) formats the remaining days, hours and minutes",
|
|
54
|
+
"ChatNotificationCardHeaderTitleLabel is semibold, uppercase and truncated to one line",
|
|
55
|
+
"ChatNotificationCardContentActions shows only while the card is expanded",
|
|
56
|
+
"variant is declared but the root does not apply it, so floating and default currently render the same",
|
|
57
|
+
"ChatNotificationCardIcon, ChatNotificationCardDescription and ChatNotificationCardTimeStamp are aliases of ChatNotificationCardHeaderIcon, ChatNotificationCardContentDescription and ChatNotificationCardTimestamp; use the full names"
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
"composition": {
|
|
61
|
+
"allowedParents": ["web-chat-ui/ChatNotificationPopupContent"],
|
|
62
|
+
"allowedChildren": [
|
|
63
|
+
"web-chat-ui/ChatNotificationCardHead",
|
|
64
|
+
"web-chat-ui/ChatNotificationCardHeader",
|
|
65
|
+
"web-chat-ui/ChatNotificationCardHeaderIcon",
|
|
66
|
+
"web-chat-ui/ChatNotificationCardHeaderTitle",
|
|
67
|
+
"web-chat-ui/ChatNotificationCardHeaderTitleLabel",
|
|
68
|
+
"web-chat-ui/ChatNotificationCardHeaderStatus",
|
|
69
|
+
"web-chat-ui/ChatNotificationCardActions",
|
|
70
|
+
"web-chat-ui/ChatNotificationCardTimestamp",
|
|
71
|
+
"web-chat-ui/ChatNotificationCardButtons",
|
|
72
|
+
"web-chat-ui/ChatNotificationCardReadActionButton",
|
|
73
|
+
"web-chat-ui/ChatNotificationCardSnoozeButton",
|
|
74
|
+
"web-chat-ui/ChatNotificationCardDeleteButton",
|
|
75
|
+
"web-chat-ui/ChatNotificationCardCloseButton",
|
|
76
|
+
"web-chat-ui/ChatNotificationCardContent",
|
|
77
|
+
"web-chat-ui/ChatNotificationCardContentTitle",
|
|
78
|
+
"web-chat-ui/ChatNotificationCardContentDescription",
|
|
79
|
+
"web-chat-ui/ChatNotificationCardContentActions",
|
|
80
|
+
"ui/button"
|
|
81
|
+
],
|
|
82
|
+
"avoidCombinations": [
|
|
83
|
+
"Action buttons outside ChatNotificationCardButtons — their clicks would also fire the card's onClick",
|
|
84
|
+
"A second ChatNotificationCardExpandButton — ChatNotificationCardContent already renders one",
|
|
85
|
+
"Primary buttons in ChatNotificationCardContentActions — the stories use secondary size sm, so the card stays quiet in a list"
|
|
86
|
+
],
|
|
87
|
+
"contexts": ["notification popup", "notification panel", "notification list"]
|
|
88
|
+
},
|
|
89
|
+
"content": {
|
|
90
|
+
"labelRules": [
|
|
91
|
+
"Title label: the notification type or a short subject; it is uppercased and truncated, so keep it to a few words ('Overdue task')",
|
|
92
|
+
"Status chip: the priority word ('Medium', 'High')",
|
|
93
|
+
"Timestamp: relative time ('1 min. ago')"
|
|
94
|
+
],
|
|
95
|
+
"helperTextRules": [
|
|
96
|
+
"Description: lead with what happened in the first line; only two lines show until the card is expanded"
|
|
97
|
+
],
|
|
98
|
+
"errorRules": []
|
|
99
|
+
},
|
|
100
|
+
"aiDecisionRules": [
|
|
101
|
+
{
|
|
102
|
+
"condition": "A notification in a list or panel",
|
|
103
|
+
"decision": "Use read, snooze and delete buttons in ChatNotificationCardButtons with a timestamp",
|
|
104
|
+
"reason": "That is the list-item pattern in the Default, Snoozed and Read stories"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"condition": "A single notification shown over the chat",
|
|
108
|
+
"decision": "Use snooze and ChatNotificationCardCloseButton, and put the follow-up action in ChatNotificationCardContentActions",
|
|
109
|
+
"reason": "A standalone notification is dismissed, not deleted, and its action shows once expanded"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"condition": "Priority is low",
|
|
113
|
+
"decision": "Pass priority='low' to ChatNotificationCardHeaderStatus or leave the status out; don't leave priority unset",
|
|
114
|
+
"reason": "Low renders no chip; the default priority is medium, so leaving priority unset shows a warning chip"
|
|
115
|
+
}
|
|
116
|
+
],
|
|
117
|
+
"relatedComponents": [
|
|
118
|
+
"web-chat-ui/chat-notification-popup",
|
|
119
|
+
"web-chat-ui/chat-card",
|
|
120
|
+
"ui/banner",
|
|
121
|
+
"ui/chip",
|
|
122
|
+
"ui/icon-button"
|
|
123
|
+
],
|
|
124
|
+
"tokenReferences": {
|
|
125
|
+
"source": "packages/design-system/src/tailwind.css",
|
|
126
|
+
"categories": [
|
|
127
|
+
"paper-elevation-2",
|
|
128
|
+
"secondary-states-hover",
|
|
129
|
+
"layout-feedback-info-*",
|
|
130
|
+
"chip-outlined-warning-text",
|
|
131
|
+
"text-text-primary, text-text-secondary"
|
|
132
|
+
],
|
|
133
|
+
"rule": "Use the tokens the parts already apply; override with token utilities through className only."
|
|
134
|
+
}
|
|
135
|
+
}
|