@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
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2025-2026 Fintama AG
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
# @swisper.ai/web-chat-ui
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@swisper.ai/web-chat-ui)
|
|
4
|
+
[](https://unpkg.com/@swisper.ai/web-chat-ui/LICENSE)
|
|
5
|
+
|
|
6
|
+
React components for the Swisper chat: messages, composer and cards. It has no API or model client: your app fetches, streams and stores the conversation, and passes it to the components as props. Components are styled with Tailwind v4 utilities against the `@swisper.ai/design-system` theme and ship no per-component CSS, so your app either generates those utilities or loads the prebuilt stylesheet.
|
|
7
|
+
|
|
8
|
+
## Boundary
|
|
9
|
+
|
|
10
|
+
Code belongs here if it is part of the chat surface: the conversation scroller, messages and what renders inside them (Markdown answers, thinking steps, suggestions, attachments), the composer and its editors, chat cards and their layouts, notifications shown over the chat, and the hooks that hold chat state. Components that make sense outside a chat belong in `@swisper.ai/ui`. Previewing a file belongs in `@swisper.ai/web-file-preview`, and maps in `@swisper.ai/web-map`, so a chat that never shows either doesn't download their engines.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
npm install @swisper.ai/web-chat-ui @swisper.ai/ui
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
| Peer | Range | Why |
|
|
19
|
+
| --------------- | ---------- | ---------------------------------------------- |
|
|
20
|
+
| `react` | `>=18.0.0` | Components and hooks |
|
|
21
|
+
| `react-dom` | `>=18.0.0` | Rendering |
|
|
22
|
+
| `@llm-ui/react` | `^0.13.3` | Declared peer; no current component imports it |
|
|
23
|
+
|
|
24
|
+
`@swisper.ai/ui` is a dependency, so its peers (`@mui/material`, `@mui/system`, `@mui/icons-material`, `@emotion/react`, `@emotion/styled`) apply too; install it directly as well, because your app imports its `TooltipProvider`. Lexical (the editors), Streamdown with KaTeX (Markdown and math) and the Lottie player are regular dependencies, not bundled; `MarkdownViewer` imports `katex/dist/katex.min.css` itself.
|
|
25
|
+
|
|
26
|
+
## Setup
|
|
27
|
+
|
|
28
|
+
1. Load the styles (see [Styles](#styles)).
|
|
29
|
+
2. Mount `TooltipProvider` from `@swisper.ai/ui` once above the chat. The thread's scroll-to-latest button, toolbar actions and card actions show tooltips, and a tooltip throws without a provider.
|
|
30
|
+
3. Give the chat a parent with a definite height: `ChatContainer` and `ChatThread` fill their parent.
|
|
31
|
+
4. Render the conversation. Your app owns `turns` and the draft, and appends to `answer` as it streams:
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
import { TooltipProvider } from '@swisper.ai/ui';
|
|
35
|
+
import {
|
|
36
|
+
ChatContainer,
|
|
37
|
+
ChatContainerPrompt,
|
|
38
|
+
ChatMessage,
|
|
39
|
+
ChatMessageContent,
|
|
40
|
+
ChatMessageResponse,
|
|
41
|
+
ChatPromptBox,
|
|
42
|
+
ChatPromptBoxContent,
|
|
43
|
+
ChatPromptBoxInput,
|
|
44
|
+
ChatThread,
|
|
45
|
+
ChatThreadAnswer,
|
|
46
|
+
ChatThreadGroup,
|
|
47
|
+
ChatThreadProvider,
|
|
48
|
+
ChatThreadQuestion,
|
|
49
|
+
} from '@swisper.ai/web-chat-ui';
|
|
50
|
+
import { useState } from 'react';
|
|
51
|
+
|
|
52
|
+
interface Turn {
|
|
53
|
+
id: string;
|
|
54
|
+
question: string;
|
|
55
|
+
answer: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function Chat({
|
|
59
|
+
turns,
|
|
60
|
+
isStreaming,
|
|
61
|
+
onSend,
|
|
62
|
+
}: {
|
|
63
|
+
turns: Turn[];
|
|
64
|
+
isStreaming: boolean;
|
|
65
|
+
onSend: (prompt: string) => void;
|
|
66
|
+
}) {
|
|
67
|
+
const [draft, setDraft] = useState('');
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<TooltipProvider>
|
|
71
|
+
<ChatContainer className="h-[600px]">
|
|
72
|
+
<ChatThreadProvider groupIds={turns.map((turn) => turn.id)} isStreaming={isStreaming}>
|
|
73
|
+
<ChatThread scrollButtonTooltip="Scroll to the latest">
|
|
74
|
+
{turns.map((turn) => (
|
|
75
|
+
<ChatThreadGroup key={turn.id} groupId={turn.id}>
|
|
76
|
+
<ChatThreadQuestion messageId={`${turn.id}-question`}>
|
|
77
|
+
<ChatMessage isQuestion>
|
|
78
|
+
<ChatMessageContent>{turn.question}</ChatMessageContent>
|
|
79
|
+
</ChatMessage>
|
|
80
|
+
</ChatThreadQuestion>
|
|
81
|
+
<ChatThreadAnswer messageId={`${turn.id}-answer`}>
|
|
82
|
+
<ChatMessage>
|
|
83
|
+
<ChatMessageContent>
|
|
84
|
+
<ChatMessageResponse message={turn.answer} isStreaming={isStreaming} />
|
|
85
|
+
</ChatMessageContent>
|
|
86
|
+
</ChatMessage>
|
|
87
|
+
</ChatThreadAnswer>
|
|
88
|
+
</ChatThreadGroup>
|
|
89
|
+
))}
|
|
90
|
+
</ChatThread>
|
|
91
|
+
</ChatThreadProvider>
|
|
92
|
+
|
|
93
|
+
<ChatContainerPrompt>
|
|
94
|
+
<ChatPromptBox>
|
|
95
|
+
<ChatPromptBoxContent>
|
|
96
|
+
<ChatPromptBoxInput
|
|
97
|
+
value={draft}
|
|
98
|
+
onChange={setDraft}
|
|
99
|
+
placeholder="How can I help?"
|
|
100
|
+
onKeyDown={(event) => {
|
|
101
|
+
if (event.key === 'Enter' && !event.shiftKey && draft.trim()) {
|
|
102
|
+
event.preventDefault();
|
|
103
|
+
onSend(draft);
|
|
104
|
+
setDraft('');
|
|
105
|
+
}
|
|
106
|
+
}}
|
|
107
|
+
/>
|
|
108
|
+
</ChatPromptBoxContent>
|
|
109
|
+
</ChatPromptBox>
|
|
110
|
+
</ChatContainerPrompt>
|
|
111
|
+
</ChatContainer>
|
|
112
|
+
</TooltipProvider>
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
`groupIds` must list every rendered `ChatThreadGroup` in order: groups present when the thread first has content are history, and any later group is a new turn that scrolls to the top while its answer streams in.
|
|
118
|
+
|
|
119
|
+
## Styles
|
|
120
|
+
|
|
121
|
+
There are two ways to style the components. Pick **one**.
|
|
122
|
+
|
|
123
|
+
| Your app | Use | What you get |
|
|
124
|
+
| ----------------------------------- | -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
125
|
+
| Builds its own CSS with Tailwind v4 | `@swisper.ai/web-chat-ui/tailwind.css` | Your Tailwind build generates only the classes the components use, with your theme and your layer order. |
|
|
126
|
+
| Has no Tailwind | `@swisper.ai/web-chat-ui/index.css` | A prebuilt stylesheet: Tailwind preflight, the design-system theme, and every utility the `@swisper.ai` packages use (about 300 KB). |
|
|
127
|
+
|
|
128
|
+
Don't combine them. The prebuilt file brings its own preflight, theme and utilities, so loading it next to your own Tailwind output ships everything twice, and whichever file loads last wins wherever the two conflict.
|
|
129
|
+
|
|
130
|
+
### Option A: your app runs Tailwind v4 (recommended)
|
|
131
|
+
|
|
132
|
+
Install `@swisper.ai/design-system` too, and add both to your Tailwind entry CSS, theme first:
|
|
133
|
+
|
|
134
|
+
```css
|
|
135
|
+
@import '@swisper.ai/design-system/src/tailwind.css'; /* tailwindcss + theme: colors, radii, fonts */
|
|
136
|
+
@import '@swisper.ai/web-chat-ui/tailwind.css';
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
`@swisper.ai/design-system/src/tailwind.css` already imports `tailwindcss`. Don't import it a second time.
|
|
140
|
+
|
|
141
|
+
`@swisper.ai/web-chat-ui/tailwind.css` holds only a Tailwind source directive, not styles:
|
|
142
|
+
|
|
143
|
+
```css
|
|
144
|
+
@source "./dist";
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
It makes Tailwind scan the built components for class names. Tailwind skips `node_modules` by default, so without this line the components render unstyled. The path resolves relative to the package, so the import works wherever your CSS file is.
|
|
148
|
+
|
|
149
|
+
### Option B: prebuilt stylesheet
|
|
150
|
+
|
|
151
|
+
Import it once, at your app's entry:
|
|
152
|
+
|
|
153
|
+
```ts
|
|
154
|
+
import '@swisper.ai/web-chat-ui/index.css';
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Nothing is tree-shaken: you get the classes of every `@swisper.ai` package, whether you render them or not. Use Option A if your app already has Tailwind.
|
|
158
|
+
|
|
159
|
+
## API
|
|
160
|
+
|
|
161
|
+
Everything is exported from the package root. Each row names a component family: the root and its parts, which share its prefix. Props, composition rules and live examples are on each component's page in the [Echo DS Storybook](https://fintama.github.io/fintama/).
|
|
162
|
+
|
|
163
|
+
### Chat surface
|
|
164
|
+
|
|
165
|
+
| Export | Why it exists |
|
|
166
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
167
|
+
| `ChatContainer`, `ChatContainerPrompt`, `ChatContainerWelcome` | Root of a chat. Measures itself and publishes the chat window size, reading-column width and composer height as CSS variables, so cards and layouts size against the chat without prop drilling. |
|
|
168
|
+
| `ChatThreadProvider`, `ChatThread`, `ChatThreadGroup`, `ChatThreadQuestion`, `ChatThreadAnswer`, `ChatThreadErrorState`, `useChatThread`, `useChatThreadScrollable` | The one scroller of a conversation. Opens at the latest message and anchors a new question at the top while its answer streams (`scrollMode="anchor"`), or follows output at the bottom for agents and logs (`"follow"`). |
|
|
169
|
+
| `ChatMessages`, `ChatMessagesList`, `ChatMessagesScrollButton`, `ChatMessageListGroup`, `ChatConversationProvider`, `useChatConversationContext` | The earlier conversation scroller, driven by a render function per question/answer group. Kept for existing screens; new screens use `ChatThread`. |
|
|
170
|
+
| `ChatMessageHistory` and its parts, `useChatMessageHistoryContext` | A scroller that always sticks to the newest message, for simple log-style lists and existing screens. |
|
|
171
|
+
| `CanvasShell` and its parts, `canvasShellContentPadding` | The side panel beside the chat: a fixed header (title, options, full-screen, close), a content region that scrolls or clips, and an optional footer. |
|
|
172
|
+
| `ChatList` and its parts, `useChatListContext` | The sidebar list of past conversations: virtualised, loads more pages on scroll, with skeleton, empty and error states driven by your fetch state. |
|
|
173
|
+
| `NewChatTrigger` | A button (or `asChild` element) that starts a new chat in the nearest `ChatProvider`. |
|
|
174
|
+
|
|
175
|
+
### Messages
|
|
176
|
+
|
|
177
|
+
| Export | Why it exists |
|
|
178
|
+
| ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
179
|
+
| `ChatMessage`, `ChatMessageContent`, `ChatMessageActions` | One question (an end-aligned bubble, `isQuestion`) or one answer (full width), with a row of actions that fades in on hover. |
|
|
180
|
+
| `ChatMessageResponse` | An assistant answer: Markdown through `MarkdownViewer`, already configured for a message. |
|
|
181
|
+
| `MarkdownViewer` | Renders model Markdown (GitHub-flavoured, sanitised inline HTML) through Streamdown, repairs half-received syntax while it streams, and renders `<swi-*>` tags with your components. |
|
|
182
|
+
| `ChatThinkingProcess` and its parts | A collapsible timeline of the model's reasoning or tool steps above its answer, with a live preview while it thinks. |
|
|
183
|
+
| `ChatMessageToolbar` and its parts | The row under a message: timestamp plus small icon actions (copy, edit, feedback), each with an optional tooltip. |
|
|
184
|
+
| `ChatMessageAttachmentCard` and its parts, `getAttachmentIcon` | A compact chip for a file attached to a prompt or message: file-type icon or image thumbnail, truncated name, remove button. |
|
|
185
|
+
| `ChatSuggestions`, `ChatSuggestion` and its parts, `useChatSuggestionContext` | Numbered follow-up questions or quick replies above the composer; picking one sends it. |
|
|
186
|
+
| `ChatReplies`, `ChatReply`, `ChatReplyLabel`, `ChatReplyValue` | Label/value rows summarising a drafted reply (subject, recipients) before it is sent. |
|
|
187
|
+
| `Spinner`, `SOURCE_ANIMATION` | A Lottie loading animation in four sizes, for waits whose final layout is unknown. `SOURCE_ANIMATION` is the URL it loads. |
|
|
188
|
+
|
|
189
|
+
### Composer and editors
|
|
190
|
+
|
|
191
|
+
| Export | Why it exists |
|
|
192
|
+
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
193
|
+
| `ChatPromptBox` and its parts | The styled composer: input plus left and right action slots that sit inline on one line and move under the text once it wraps. Clicking anywhere in it focuses it. |
|
|
194
|
+
| `ChatInput`, `ChatInputTextarea`, `useChatInputContext` | The unstyled Lexical editor behind it, for a composer with your own look. The value is a Markdown string; focused, empty and error states are data attributes. |
|
|
195
|
+
| `RichTextArea`, `useRichTextAreaEditor`, `useRichTextAreaSelectedText`, `scrollRichTextAreaToBottom`, `$replaceEditorHTMLContent`, `$replaceEditorSelectionHTMLContent`, `$setSelectionToEnd` | A toolbar-less rich-text editor whose value is Markdown or HTML (lists, headings, code, links, images, tables), and helpers to drive it. |
|
|
196
|
+
| `ImageDropPlugin`, `HtmlPastePlugin`, `INSERT_IMAGE_COMMAND`, `INSERT_HTML_COMMAND`, `PASTE_HTML_COMMAND` and their event names | Lexical plugins and commands to pass to `RichTextArea` as children: image drop, HTML paste and insertion. |
|
|
197
|
+
| `RichTextField`, `FormattingToolbarPlugin`, `ToolbarButton`, `BoldButton`, `ItalicButton`, `UnderlineButton`, `LinkButton`, `ImageButton`, `AttachmentButton`, `TextColorButton`, `CleanFormatButton`, `TypographySelect`, `SizeSelect`, `AlignmentSelect` | A fixed-height rich-text editor with a formatting toolbar, and the controls to build a toolbar of your own. |
|
|
198
|
+
|
|
199
|
+
### Cards and layouts
|
|
200
|
+
|
|
201
|
+
| Export | Why it exists |
|
|
202
|
+
| ---------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
203
|
+
| `ChatCard` and its parts, `EditableChatCardContextProvider`, `useEditableChatCardContext`, `useEditChatCard` | A collapsible card for a structured result in an answer (a booking, a draft, a set of options), with header, body, footer and collapsed-preview slots. |
|
|
204
|
+
| `ChatCardContainer` | Sizes a card against the width `ChatContainer` publishes, so cards line up with the message text or take the whole chat window. |
|
|
205
|
+
| `ChatCardListLayout` and its parts, `useChatCardListLayoutContext` | Shows the first few cards of a list and mounts the rest only behind a "show more" button. |
|
|
206
|
+
| `ChatCardTwoColumnLayout` and its parts, `chatCardTwoColumnLayout*Variants` | A card body with an aside beside a main pane, stacked when the card is narrow. |
|
|
207
|
+
| `ChatCardThreeColumnLayout` and its parts, `chatCardThreeColumnLayout*Variants` | A card body shaped like a collection, a canvas and a selected item (places on a map), which switches panes on its own measured width. |
|
|
208
|
+
| `CardItemPickerList`, `CardItemPickerRow` and its parts, `useCardItemPickerListContext`, `useCardItemPickerRowContext` | A single-select listbox of cards for a card's collection pane, whose hover and selection can mirror another view such as map pins. |
|
|
209
|
+
|
|
210
|
+
### Notifications
|
|
211
|
+
|
|
212
|
+
| Export | Why it exists |
|
|
213
|
+
| --------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
|
|
214
|
+
| `ChatNotificationCard` and its parts, `useChatNotificationCardContext` | An expandable notification with icon, title, priority, timestamp and read, snooze, delete or close actions. |
|
|
215
|
+
| `formatSnoozeDate`, `getSnoozeUntilDate` | The date logic behind the snooze action. |
|
|
216
|
+
| `ChatNotificationPopup`, `ChatNotificationPopupTrigger`, `ChatNotificationPopupContent` | A popover that shows notifications over the chat without leaving the conversation. |
|
|
217
|
+
|
|
218
|
+
### Chat state, streaming and actions
|
|
219
|
+
|
|
220
|
+
| Export | Why it exists |
|
|
221
|
+
| ------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
|
|
222
|
+
| `ChatProvider`, `useChatContext` | Holds the current chat id (yours, or a generated id for a new chat), which chats are loaded, and the composer placeholder. |
|
|
223
|
+
| `useCurrentChatId`, `useIsCurrentChatNew`, `useOnChatChanged`, `useChatLoadedIds`, `useChatPromptPlaceholder` | Read and react to `ChatProvider` state without taking the whole context. |
|
|
224
|
+
| `useChatStreamMessage` | Reads a server-sent-events stream chunk by chunk, with an idle timeout, abort handling and a token parser you can replace. |
|
|
225
|
+
| `CHAT_ACTION_PROTOCOL`, `createChatActionLink`, `extractChatActionFromLink`, `isChatActionURL`, `useChatActions` | Builds and parses `swisper://action/<name>` links, so an answer can carry buttons that trigger app actions. |
|
|
226
|
+
| `ChatId`, `ChatAction`, `ChatPromptPayload`, `Markdown`, `SwiTagName`, `ChatMessageCardComponent` and related types | The shared types the components and hooks take. |
|
|
227
|
+
| `EmptyState` and its parts | Deprecated re-exports kept so existing imports compile; import them from `@swisper.ai/ui`. |
|
|
228
|
+
|
|
229
|
+
## Troubleshooting
|
|
230
|
+
|
|
231
|
+
| Symptom | Cause | Fix |
|
|
232
|
+
| ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
|
|
233
|
+
| "Invalid hook call", or a context is missing | The app resolves two copies of React | Add `resolve: { dedupe: ['react', 'react-dom'] }` to the Vite config |
|
|
234
|
+
| Components render without layout or colors | Tailwind never scans the package, because it skips `node_modules` by default | Import the package's `tailwind.css` in your Tailwind entry, or load its prebuilt `index.css` |
|
|
235
|
+
| Layout is right, but colors or radii are wrong or missing | The design-system theme isn't loaded, so theme utilities such as `bg-paper-elevation-1` are empty | Import `@swisper.ai/design-system/src/tailwind.css` before the package's `tailwind.css` |
|
|
236
|
+
| Your own base styles (fonts, headings, resets) get overridden | The prebuilt `index.css` is loaded next to your own Tailwind build, and its preflight wins | Use one of the two: drop `index.css` and import `tailwind.css` |
|
|
237
|
+
| Spacing looks wrong after upgrading (huge gaps, tiny icons) | A number in a spacing class is pixels: `gap-8` is 8px, not Tailwind's default 32px | Write the pixel value you want |
|
|
238
|
+
| Styles are missing or doubled, or the MUI theme doesn't apply | The app resolves two copies of `@emotion/react` or `@mui/material` | Add them to `resolve.dedupe` in the Vite config, next to `react` and `react-dom` |
|
|
239
|
+
| `ERR_UNSUPPORTED_DIR_IMPORT` when a test imports the package | `dist/` uses extensionless imports that only a bundler resolves, and Vitest externalizes it | Set `server.deps.inline: [/@swisper\.ai\//]` in the Vitest config |
|
|
240
|
+
| `Tooltip` must be used within `TooltipProvider` | The thread's scroll button, a toolbar action or a card action rendered a tooltip with no provider above it | Wrap the chat in `TooltipProvider` from `@swisper.ai/ui` |
|
|
241
|
+
| The thread or the composer has zero height, or the page scrolls instead | `ChatContainer` and `ChatThread` fill their parent, and the parent has no definite height | Give the parent (or `ChatContainer`'s `className`) a height |
|
|
242
|
+
| A new answer doesn't scroll into view, or an old message jumps to the top | `groupIds` doesn't match the rendered `ChatThreadGroup`s, so a group is treated as history or as a new turn by mistake | Pass every rendered `groupId` in order; change `conversationId` when switching conversations |
|
|
243
|
+
| Markdown answers (code blocks, tables) are partly unstyled with Option A | `MarkdownViewer` renders through Streamdown, whose own class names live in `streamdown/dist`, which `tailwind.css` doesn't scan | Add an `@source` for `streamdown/dist/*.js` where your package manager installed it, or use the prebuilt `index.css`, which includes them |
|
|
244
|
+
| A `<swi-*>` tag in an answer shows as plain text | The tag has no entry in `MarkdownViewer`'s `customComponents`, so the sanitiser strips it and keeps its text | Map the tag name to a component in `customComponents` |
|
|
245
|
+
| The `Spinner` is blank under a strict CSP or offline | Its animation loads from `lottie.host` at runtime | Allow `https://lottie.host` in `connect-src`, or use another loading indicator |
|
|
246
|
+
| Bundler error importing `katex/dist/katex.min.css` | `MarkdownViewer` imports KaTeX's stylesheet, and the bundler doesn't handle CSS imports from dependencies | Enable CSS imports for `node_modules` (Vite does by default) |
|
|
247
|
+
| `Failed to resolve import "@swisper.ai/web-chat-ui/hooks"` | The `./hooks` subpath ships type declarations but no JavaScript | Import the hooks from `@swisper.ai/web-chat-ui` |
|
|
248
|
+
|
|
249
|
+
## License
|
|
250
|
+
|
|
251
|
+
[Apache-2.0](https://unpkg.com/@swisper.ai/web-chat-ui/LICENSE)
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
import { IconButtonProps, TypographyProps } from '@swisper.ai/ui';
|
|
3
|
+
export type CanvasShellProps = ComponentProps<'section'>;
|
|
4
|
+
/**
|
|
5
|
+
* Three-row grid: header and footer size to their content, the content row takes the rest.
|
|
6
|
+
* `minmax(0,1fr)` keeps a long list from growing the middle row past the shell's height.
|
|
7
|
+
*/
|
|
8
|
+
export declare function CanvasShell({ className, ...props }: CanvasShellProps): import('react').JSX.Element;
|
|
9
|
+
export interface CanvasShellHeaderProps extends ComponentProps<'header'> {
|
|
10
|
+
hasBorder?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function CanvasShellHeader({ className, hasBorder, ...props }: CanvasShellHeaderProps): import('react').JSX.Element;
|
|
13
|
+
export type CanvasShellTitleProps = Omit<TypographyProps, 'variant'>;
|
|
14
|
+
export declare function CanvasShellTitle({ className, ...props }: CanvasShellTitleProps): import('react').JSX.Element;
|
|
15
|
+
export type CanvasShellCloseTriggerProps = IconButtonProps;
|
|
16
|
+
/**
|
|
17
|
+
* Icon-only close button; the host decides what closing means through `onClick`.
|
|
18
|
+
*/
|
|
19
|
+
export declare function CanvasShellCloseTrigger({ className, children, ...props }: CanvasShellCloseTriggerProps): import('react').JSX.Element;
|
|
20
|
+
export interface CanvasShellFullScreenTriggerProps extends Omit<IconButtonProps, 'aria-label' | 'aria-pressed'> {
|
|
21
|
+
/** Whether the canvas currently fills the viewport; drives `aria-pressed` and the label. */
|
|
22
|
+
isFullScreen: boolean;
|
|
23
|
+
/** Accessible names for each state; English by default. */
|
|
24
|
+
labels?: {
|
|
25
|
+
enter?: string;
|
|
26
|
+
exit?: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Toggle between the canvas width and the full viewport; the host owns the state and passes
|
|
31
|
+
* `isFullScreen` and `onClick`. Desktop only: on mobile the canvas already spans the screen.
|
|
32
|
+
*/
|
|
33
|
+
export declare function CanvasShellFullScreenTrigger({ className, children, isFullScreen, labels, ...props }: CanvasShellFullScreenTriggerProps): import('react').JSX.Element;
|
|
34
|
+
export interface CanvasShellOptionsButtonProps extends Omit<IconButtonProps, 'children'> {
|
|
35
|
+
/** Menu contents, typically a `DropdownMenuList` of `DropdownMenuListItem`s. */
|
|
36
|
+
children: ReactNode;
|
|
37
|
+
/** Classes for the dropdown panel. */
|
|
38
|
+
menuClassName?: string;
|
|
39
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* "More options" button that opens a dropdown of canvas actions passed as children.
|
|
43
|
+
*/
|
|
44
|
+
export declare function CanvasShellOptionsButton({ className, children, menuClassName, onOpenChange, ...props }: CanvasShellOptionsButtonProps): import('react').JSX.Element;
|
|
45
|
+
export interface CanvasShellContentProps extends ComponentProps<'div'> {
|
|
46
|
+
/**
|
|
47
|
+
* Apply the shell's horizontal padding (`canvasShellContentPadding`).
|
|
48
|
+
* Set false for edge-to-edge children that pad themselves.
|
|
49
|
+
*/
|
|
50
|
+
hasPadding?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Scroll children that overflow the region, on either axis, with always-visible scrollbars.
|
|
53
|
+
* When false, the region clips overflow: for children that scroll themselves.
|
|
54
|
+
*/
|
|
55
|
+
hasScroll?: boolean;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Horizontal padding of the content region; reuse it to align custom scroll areas with the shell.
|
|
59
|
+
*/
|
|
60
|
+
export declare const canvasShellContentPadding = "px-[12px] md:px-[16px]";
|
|
61
|
+
export declare function CanvasShellContent({ className, hasPadding, hasScroll, children, ...props }: CanvasShellContentProps): import('react').JSX.Element;
|
|
62
|
+
export type CanvasShellFooterProps = ComponentProps<'footer'>;
|
|
63
|
+
export declare function CanvasShellFooter({ className, ...props }: CanvasShellFooterProps): import('react').JSX.Element;
|
|
64
|
+
//# sourceMappingURL=canvas-shell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canvas-shell.d.ts","sourceRoot":"","sources":["../../../src/components/canvas-shell/canvas-shell.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGtE,OAAO,EAOL,KAAK,eAAe,EACpB,KAAK,eAAe,EACrB,MAAM,gBAAgB,CAAC;AAIxB,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC;AAEzD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,+BAYpE;AAED,MAAM,WAAW,sBAAuB,SAAQ,cAAc,CAAC,QAAQ,CAAC;IACtE,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,SAAgB,EAChB,GAAG,KAAK,EACT,EAAE,sBAAsB,+BAexB;AAED,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;AAErE,wBAAgB,gBAAgB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,qBAAqB,+BAU9E;AAED,MAAM,MAAM,4BAA4B,GAAG,eAAe,CAAC;AAE3D;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,4BAA4B,+BAc9B;AAED,MAAM,WAAW,iCAAkC,SAAQ,IAAI,CAC7D,eAAe,EACf,YAAY,GAAG,cAAc,CAC9B;IACC,4FAA4F;IAC5F,YAAY,EAAE,OAAO,CAAC;IACtB,2DAA2D;IAC3D,MAAM,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5C;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,EAC3C,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,GAAG,KAAK,EACT,EAAE,iCAAiC,+BAiBnC;AAED,MAAM,WAAW,6BAA8B,SAAQ,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC;IACtF,gFAAgF;IAChF,QAAQ,EAAE,SAAS,CAAC;IACpB,sCAAsC;IACtC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,SAAS,EACT,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,GAAG,KAAK,EACT,EAAE,6BAA6B,+BA2B/B;AAED,MAAM,WAAW,uBAAwB,SAAQ,cAAc,CAAC,KAAK,CAAC;IACpE;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,eAAO,MAAM,yBAAyB,2BAA2B,CAAC;AAElE,wBAAgB,kBAAkB,CAAC,EACjC,SAAS,EACT,UAAiB,EACjB,SAAgB,EAChB,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,uBAAuB,+BAsBzB;AAED,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;AAE9D,wBAAgB,iBAAiB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,sBAAsB,+BAchF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
interface CanvasShellStoryArgs {
|
|
3
|
+
title: string;
|
|
4
|
+
itemCount: number;
|
|
5
|
+
hasScroll: boolean;
|
|
6
|
+
hasWideContent: boolean;
|
|
7
|
+
hasFooter: boolean;
|
|
8
|
+
hasOptions: boolean;
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
onOption: (option: string) => void;
|
|
11
|
+
}
|
|
12
|
+
declare function CanvasShellStory({ title, itemCount, hasScroll, hasWideContent, hasFooter, hasOptions, onClose, onOption, }: CanvasShellStoryArgs): import('react').JSX.Element;
|
|
13
|
+
declare const meta: Meta<typeof CanvasShellStory>;
|
|
14
|
+
export default meta;
|
|
15
|
+
type Story = StoryObj<typeof CanvasShellStory>;
|
|
16
|
+
export declare const Default: Story;
|
|
17
|
+
/** A title longer than the header: it truncates instead of pushing the close button out. */
|
|
18
|
+
export declare const LongTitle: Story;
|
|
19
|
+
/** No footer: the content region extends to the bottom of the shell. */
|
|
20
|
+
export declare const WithoutFooter: Story;
|
|
21
|
+
/** Content wider and taller than the shell: it scrolls on both axes instead of growing the shell. */
|
|
22
|
+
export declare const WideContent: Story;
|
|
23
|
+
/** Options button in the header: opens a dropdown of canvas actions. */
|
|
24
|
+
export declare const WithOptions: Story;
|
|
25
|
+
export declare const Playground: Story;
|
|
26
|
+
//# sourceMappingURL=canvas-shell.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canvas-shell.stories.d.ts","sourceRoot":"","sources":["../../../src/components/canvas-shell/canvas-shell.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AA0B5D,UAAU,oBAAoB;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;AAED,iBAAS,gBAAgB,CAAC,EACxB,KAAK,EACL,SAAS,EACT,SAAS,EACT,cAAc,EACd,SAAS,EACT,UAAU,EACV,OAAO,EACP,QAAQ,GACT,EAAE,oBAAoB,+BAkDtB;AAED,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,gBAAgB,CA4DvC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE/C,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC;AAEjC,4FAA4F;AAC5F,eAAO,MAAM,SAAS,EAAE,KAIvB,CAAC;AAEF,wEAAwE;AACxE,eAAO,MAAM,aAAa,EAAE,KAI3B,CAAC;AAEF,qGAAqG;AACrG,eAAO,MAAM,WAAW,EAAE,KAIzB,CAAC;AAEF,wEAAwE;AACxE,eAAO,MAAM,WAAW,EAAE,KAIzB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,KAAU,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { CanvasShell, CanvasShellCloseTrigger, CanvasShellContent, CanvasShellFooter, CanvasShellFullScreenTrigger, CanvasShellHeader, CanvasShellOptionsButton, CanvasShellTitle, canvasShellContentPadding, type CanvasShellCloseTriggerProps, type CanvasShellContentProps, type CanvasShellFooterProps, type CanvasShellFullScreenTriggerProps, type CanvasShellHeaderProps, type CanvasShellOptionsButtonProps, type CanvasShellProps, type CanvasShellTitleProps, } from './canvas-shell';
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/canvas-shell/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,uBAAuB,EACvB,kBAAkB,EAClB,iBAAiB,EACjB,4BAA4B,EAC5B,iBAAiB,EACjB,wBAAwB,EACxB,gBAAgB,EAChB,yBAAyB,EACzB,KAAK,4BAA4B,EACjC,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,iCAAiC,EACtC,KAAK,sBAAsB,EAC3B,KAAK,6BAA6B,EAClC,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,GAC3B,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type CardItemPickerValue = string | number;
|
|
2
|
+
export type CardItemPickerOrientation = 'vertical' | 'horizontal';
|
|
3
|
+
export interface CardItemPickerListContextValue {
|
|
4
|
+
value: CardItemPickerValue | null;
|
|
5
|
+
hoveredValue: CardItemPickerValue | null;
|
|
6
|
+
orientation: CardItemPickerOrientation;
|
|
7
|
+
select: (value: CardItemPickerValue) => void;
|
|
8
|
+
hover: (value: CardItemPickerValue | null) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const CardItemPickerListContext: import('react').Context<CardItemPickerListContextValue | null>;
|
|
11
|
+
export declare function useCardItemPickerListContext(): CardItemPickerListContextValue;
|
|
12
|
+
export interface CardItemPickerRowContextValue {
|
|
13
|
+
isSelected: boolean;
|
|
14
|
+
titleId: string;
|
|
15
|
+
descriptionId: string;
|
|
16
|
+
registerTitle: () => () => void;
|
|
17
|
+
registerDescription: () => () => void;
|
|
18
|
+
}
|
|
19
|
+
export declare const CardItemPickerRowContext: import('react').Context<CardItemPickerRowContextValue | null>;
|
|
20
|
+
export declare function useCardItemPickerRowContext(): CardItemPickerRowContextValue;
|
|
21
|
+
//# sourceMappingURL=card-item-picker-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card-item-picker-context.d.ts","sourceRoot":"","sources":["../../../src/components/card-item-picker/card-item-picker-context.tsx"],"names":[],"mappings":"AAEA,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,MAAM,CAAC;AAClD,MAAM,MAAM,yBAAyB,GAAG,UAAU,GAAG,YAAY,CAAC;AAElE,MAAM,WAAW,8BAA8B;IAC7C,KAAK,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAClC,YAAY,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACzC,WAAW,EAAE,yBAAyB,CAAC;IACvC,MAAM,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC7C,KAAK,EAAE,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI,KAAK,IAAI,CAAC;CACpD;AAED,eAAO,MAAM,yBAAyB,gEAA6D,CAAC;AAEpG,wBAAgB,4BAA4B,mCAQ3C;AAED,MAAM,WAAW,6BAA6B;IAC5C,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,MAAM,IAAI,CAAC;IAChC,mBAAmB,EAAE,MAAM,MAAM,IAAI,CAAC;CACvC;AAED,eAAO,MAAM,wBAAwB,+DAA4D,CAAC;AAElG,wBAAgB,2BAA2B,kCAQ1C"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import { CardItemPickerOrientation, CardItemPickerValue } from './card-item-picker-context';
|
|
3
|
+
export interface CardItemPickerListProps<V extends CardItemPickerValue = CardItemPickerValue> extends Omit<ComponentPropsWithoutRef<'ul'>, 'role' | 'onKeyDown' | 'aria-orientation'> {
|
|
4
|
+
/** The selected card, or `null` when nothing is selected. */
|
|
5
|
+
value: V | null;
|
|
6
|
+
/** The card under the pointer, mirrored as `data-hovered` (e.g. when a map pin is hovered). */
|
|
7
|
+
hoveredValue?: V | null;
|
|
8
|
+
/** A card was picked by click, Enter or Space. Toggling is up to the caller. */
|
|
9
|
+
onValueChange: (value: V) => void;
|
|
10
|
+
/** The pointer entered a card (`value`) or left it (`null`). */
|
|
11
|
+
onHoverChange?: (value: V | null) => void;
|
|
12
|
+
orientation?: CardItemPickerOrientation;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A single-select list of cards, built on the ARIA listbox pattern: the list is
|
|
16
|
+
* one tab stop that moves focus into the last focused card, else the selected
|
|
17
|
+
* one, else the first. Arrow keys (plus Home/End, PageUp/PageDown) move between
|
|
18
|
+
* cards and Enter/Space picks one. Name it with `aria-label` or `aria-labelledby`.
|
|
19
|
+
*
|
|
20
|
+
* Cards are listbox options, so they must not contain their own links or
|
|
21
|
+
* buttons — put those in a details view instead.
|
|
22
|
+
*/
|
|
23
|
+
export declare function CardItemPickerList<V extends CardItemPickerValue>({ value, hoveredValue, onValueChange, onHoverChange, orientation, className, children, ...props }: CardItemPickerListProps<V>): import('react').JSX.Element;
|
|
24
|
+
//# sourceMappingURL=card-item-picker-list.d.ts.map
|