@swisper.ai/web-chat-ui 0.0.2 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -12
- package/dist/components/canvas-shell/canvas-shell.d.ts +32 -10
- package/dist/components/canvas-shell/canvas-shell.d.ts.map +1 -1
- package/dist/components/canvas-shell/canvas-shell.stories.d.ts +49 -17
- package/dist/components/canvas-shell/canvas-shell.stories.d.ts.map +1 -1
- package/dist/components/chat-card/chat-card.d.ts +1 -0
- package/dist/components/chat-card/chat-card.d.ts.map +1 -1
- package/dist/components/chat-card/chat-card.stories.d.ts +47 -1
- package/dist/components/chat-card/chat-card.stories.d.ts.map +1 -1
- package/dist/components/chat-card/components/chat-card-body.d.ts +8 -0
- package/dist/components/chat-card/components/chat-card-body.d.ts.map +1 -1
- package/dist/components/chat-card/components/chat-card-footer.d.ts +8 -0
- package/dist/components/chat-card/components/chat-card-footer.d.ts.map +1 -1
- package/dist/components/chat-card/components/chat-card-form.d.ts +15 -2
- package/dist/components/chat-card/components/chat-card-form.d.ts.map +1 -1
- package/dist/components/chat-card/components/chat-card-header.d.ts +23 -2
- package/dist/components/chat-card/components/chat-card-header.d.ts.map +1 -1
- package/dist/components/chat-card/contexts.d.ts +2 -0
- package/dist/components/chat-card/contexts.d.ts.map +1 -1
- package/dist/components/chat-card/hooks.d.ts +1 -0
- package/dist/components/chat-card/hooks.d.ts.map +1 -1
- package/dist/components/chat-card/types.d.ts +3 -0
- package/dist/components/chat-card/types.d.ts.map +1 -1
- package/dist/components/chat-card-container/chat-card-container.d.ts +4 -0
- package/dist/components/chat-card-container/chat-card-container.d.ts.map +1 -1
- package/dist/components/chat-card-container/chat-card-container.stories.d.ts +12 -1
- package/dist/components/chat-card-container/chat-card-container.stories.d.ts.map +1 -1
- package/dist/components/chat-container/chat-container.d.ts.map +1 -1
- package/dist/components/chat-container/chat-container.stories.d.ts +36 -11
- package/dist/components/chat-container/chat-container.stories.d.ts.map +1 -1
- package/dist/components/chat-input/chat-input.d.ts +30 -2
- package/dist/components/chat-input/chat-input.d.ts.map +1 -1
- package/dist/components/chat-input/chat-input.stories.d.ts +63 -3
- package/dist/components/chat-input/chat-input.stories.d.ts.map +1 -1
- package/dist/components/chat-input/plugins/controlled-value-plugin.d.ts +4 -1
- package/dist/components/chat-input/plugins/controlled-value-plugin.d.ts.map +1 -1
- package/dist/components/chat-input/plugins/value-plugin.d.ts +4 -1
- package/dist/components/chat-input/plugins/value-plugin.d.ts.map +1 -1
- package/dist/components/chat-list/chat-list-item.d.ts +6 -0
- package/dist/components/chat-list/chat-list-item.d.ts.map +1 -1
- package/dist/components/chat-list/chat-list-items.d.ts +12 -1
- package/dist/components/chat-list/chat-list-items.d.ts.map +1 -1
- package/dist/components/chat-list/chat-list.d.ts +36 -2
- package/dist/components/chat-list/chat-list.d.ts.map +1 -1
- package/dist/components/chat-list/chat-list.stories.d.ts +67 -9
- package/dist/components/chat-list/chat-list.stories.d.ts.map +1 -1
- package/dist/components/chat-message/chat-message.d.ts +12 -1
- package/dist/components/chat-message/chat-message.d.ts.map +1 -1
- package/dist/components/chat-message/chat-message.stories.d.ts +31 -0
- package/dist/components/chat-message/chat-message.stories.d.ts.map +1 -1
- package/dist/components/chat-message/index.d.ts +1 -1
- package/dist/components/chat-message/index.d.ts.map +1 -1
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card-icon.d.ts +3 -0
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card-icon.d.ts.map +1 -1
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card.d.ts +25 -5
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card.d.ts.map +1 -1
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card.stories.d.ts +32 -1
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card.stories.d.ts.map +1 -1
- package/dist/components/chat-message-attachment-card/index.d.ts +2 -2
- package/dist/components/chat-message-attachment-card/index.d.ts.map +1 -1
- package/dist/components/chat-message-attachment-card/utils.d.ts +1 -0
- package/dist/components/chat-message-attachment-card/utils.d.ts.map +1 -1
- package/dist/components/chat-message-response/chat-message-response.stories.d.ts +13 -0
- package/dist/components/chat-message-response/chat-message-response.stories.d.ts.map +1 -1
- package/dist/components/chat-message-toolbar/chat-message-toolbar.d.ts +22 -5
- package/dist/components/chat-message-toolbar/chat-message-toolbar.d.ts.map +1 -1
- package/dist/components/chat-message-toolbar/chat-message-toolbar.stories.d.ts +42 -0
- package/dist/components/chat-message-toolbar/chat-message-toolbar.stories.d.ts.map +1 -1
- package/dist/components/chat-message-toolbar/index.d.ts +1 -1
- package/dist/components/chat-message-toolbar/index.d.ts.map +1 -1
- package/dist/components/chat-messages/chat-messages.d.ts +34 -2
- package/dist/components/chat-messages/chat-messages.d.ts.map +1 -1
- package/dist/components/chat-messages/chat-messages.stories.d.ts +33 -2
- package/dist/components/chat-messages/chat-messages.stories.d.ts.map +1 -1
- package/dist/components/chat-notification-card/chat-notification-card.d.ts +56 -4
- package/dist/components/chat-notification-card/chat-notification-card.d.ts.map +1 -1
- package/dist/components/chat-notification-card/chat-notification-card.stories.d.ts +50 -1
- package/dist/components/chat-notification-card/chat-notification-card.stories.d.ts.map +1 -1
- package/dist/components/chat-notification-popup/chat-notification-popup.d.ts +6 -0
- package/dist/components/chat-notification-popup/chat-notification-popup.d.ts.map +1 -1
- package/dist/components/chat-notification-popup/chat-notification-popup.stories.d.ts +43 -1
- package/dist/components/chat-notification-popup/chat-notification-popup.stories.d.ts.map +1 -1
- package/dist/components/chat-prompt-box/chat-prompt-box.d.ts +37 -17
- package/dist/components/chat-prompt-box/chat-prompt-box.d.ts.map +1 -1
- package/dist/components/chat-prompt-box/chat-prompt-box.stories.d.ts +53 -1
- package/dist/components/chat-prompt-box/chat-prompt-box.stories.d.ts.map +1 -1
- package/dist/components/chat-reply/chat-reply.d.ts +11 -0
- package/dist/components/chat-reply/chat-reply.d.ts.map +1 -1
- package/dist/components/chat-reply/chat-reply.stories.d.ts +23 -0
- package/dist/components/chat-reply/chat-reply.stories.d.ts.map +1 -1
- package/dist/components/chat-reply/index.d.ts +1 -1
- package/dist/components/chat-reply/index.d.ts.map +1 -1
- package/dist/components/chat-suggestion/chat-suggestion.d.ts +36 -10
- package/dist/components/chat-suggestion/chat-suggestion.d.ts.map +1 -1
- package/dist/components/chat-suggestion/chat-suggestion.stories.d.ts +66 -2
- package/dist/components/chat-suggestion/chat-suggestion.stories.d.ts.map +1 -1
- package/dist/components/chat-suggestion/index.d.ts +2 -1
- package/dist/components/chat-suggestion/index.d.ts.map +1 -1
- package/dist/components/chat-thinking-process/chat-thinking-process.d.ts +26 -1
- package/dist/components/chat-thinking-process/chat-thinking-process.d.ts.map +1 -1
- package/dist/components/chat-thinking-process/chat-thinking-process.stories.d.ts +25 -1
- package/dist/components/chat-thinking-process/chat-thinking-process.stories.d.ts.map +1 -1
- package/dist/components/chat-thread/chat-thread.d.ts +17 -2
- package/dist/components/chat-thread/chat-thread.d.ts.map +1 -1
- package/dist/components/chat-thread/chat-thread.stories.d.ts +75 -10
- package/dist/components/chat-thread/chat-thread.stories.d.ts.map +1 -1
- package/dist/components/index.d.ts +1 -3
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/markdown-viewer/markdown-viewer.d.ts +8 -1
- package/dist/components/markdown-viewer/markdown-viewer.d.ts.map +1 -1
- package/dist/components/markdown-viewer/markdown-viewer.stories.d.ts +18 -1
- package/dist/components/markdown-viewer/markdown-viewer.stories.d.ts.map +1 -1
- package/dist/components/rich-text-area/plugins/controlled-value-plugin.d.ts +4 -1
- package/dist/components/rich-text-area/plugins/controlled-value-plugin.d.ts.map +1 -1
- package/dist/components/rich-text-area/plugins/value-plugin.d.ts +4 -1
- package/dist/components/rich-text-area/plugins/value-plugin.d.ts.map +1 -1
- package/dist/components/rich-text-area/rich-text-area.d.ts +17 -0
- package/dist/components/rich-text-area/rich-text-area.d.ts.map +1 -1
- package/dist/components/rich-text-area/rich-text-area.stories.d.ts +52 -0
- package/dist/components/rich-text-area/rich-text-area.stories.d.ts.map +1 -1
- package/dist/components/rich-text-area/styled.d.ts +6 -2
- package/dist/components/rich-text-area/styled.d.ts.map +1 -1
- package/dist/components/rich-text-field/components/formatting-toolbar-plugin.d.ts +9 -2
- package/dist/components/rich-text-field/components/formatting-toolbar-plugin.d.ts.map +1 -1
- package/dist/components/rich-text-field/components/index.d.ts +5 -5
- package/dist/components/rich-text-field/components/index.d.ts.map +1 -1
- package/dist/components/rich-text-field/components/text-color-button.d.ts +12 -1
- package/dist/components/rich-text-field/components/text-color-button.d.ts.map +1 -1
- package/dist/components/rich-text-field/rich-text-field.d.ts +22 -0
- package/dist/components/rich-text-field/rich-text-field.d.ts.map +1 -1
- package/dist/components/rich-text-field/rich-text-field.stories.d.ts +28 -1
- package/dist/components/rich-text-field/rich-text-field.stories.d.ts.map +1 -1
- package/dist/components/topmenu/index.d.ts +2 -0
- package/dist/components/topmenu/index.d.ts.map +1 -0
- package/dist/components/topmenu/topmenu.d.ts +22 -0
- package/dist/components/topmenu/topmenu.d.ts.map +1 -0
- package/dist/components/topmenu/topmenu.stories.d.ts +31 -0
- package/dist/components/topmenu/topmenu.stories.d.ts.map +1 -0
- package/dist/docs/agent.stories.d.ts.map +1 -1
- package/dist/docs/chat-panel.d.ts +7 -5
- package/dist/docs/chat-panel.d.ts.map +1 -1
- package/dist/docs/chatbot-panel.d.ts.map +1 -1
- package/dist/docs/chatbot.stories.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.es.js +1801 -1806
- package/dist/index.es.js.map +1 -1
- package/dist/layouts/chat-card-list-layout/chat-card-list-layout.d.ts +9 -7
- package/dist/layouts/chat-card-list-layout/chat-card-list-layout.d.ts.map +1 -1
- package/dist/layouts/chat-card-list-layout/chat-card-list-layout.stories.d.ts +37 -9
- package/dist/layouts/chat-card-list-layout/chat-card-list-layout.stories.d.ts.map +1 -1
- package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.stories.d.ts +41 -16
- package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.stories.d.ts.map +1 -1
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.d.ts +6 -0
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.d.ts.map +1 -1
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.stories.d.ts +22 -1
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.stories.d.ts.map +1 -1
- package/package.json +16 -10
- package/src/__storybook__/parent-block.tsx +21 -0
- package/src/components/canvas-shell/__stories__/canvas-panel.tsx +25 -0
- package/src/components/canvas-shell/__stories__/document-list.tsx +29 -0
- package/src/components/canvas-shell/__stories__/fixtures.ts +222 -0
- package/src/components/canvas-shell/__stories__/holdings-table.tsx +56 -0
- package/src/components/canvas-shell/__stories__/types.ts +47 -0
- package/src/components/canvas-shell/{canvas-shell.test.tsx → __tests__/canvas-shell.spec.tsx} +1 -1
- package/src/components/canvas-shell/canvas-shell.json +24 -0
- package/src/components/canvas-shell/canvas-shell.stories.tsx +581 -122
- package/src/components/canvas-shell/canvas-shell.tsx +44 -17
- package/src/components/chat-card/__stories__/fixtures.ts +119 -0
- package/src/components/chat-card/__stories__/types.ts +44 -0
- package/src/components/chat-card/chat-card.json +67 -3
- package/src/components/chat-card/chat-card.stories.tsx +872 -148
- package/src/components/chat-card/chat-card.tsx +2 -0
- package/src/components/chat-card/components/chat-card-body.tsx +12 -0
- package/src/components/chat-card/components/chat-card-footer.tsx +11 -0
- package/src/components/chat-card/components/chat-card-form.tsx +21 -2
- package/src/components/chat-card/components/chat-card-header.tsx +39 -2
- package/src/components/chat-card/contexts.tsx +2 -0
- package/src/components/chat-card/hooks.ts +1 -0
- package/src/components/chat-card/types.ts +3 -0
- package/src/components/chat-card-container/__stories__/fixtures.ts +54 -0
- package/src/components/chat-card-container/__stories__/resizable-chat-window.tsx +19 -0
- package/src/components/chat-card-container/__stories__/result-card.tsx +31 -0
- package/src/components/chat-card-container/__stories__/types.ts +16 -0
- package/src/components/chat-card-container/chat-card-container.json +7 -0
- package/src/components/chat-card-container/chat-card-container.stories.tsx +209 -56
- package/src/components/chat-card-container/chat-card-container.tsx +5 -0
- package/src/components/chat-container/__stories__/chat-composer.tsx +67 -0
- package/src/components/chat-container/__stories__/fixtures.ts +27 -0
- package/src/components/chat-container/__stories__/measure.ts +22 -0
- package/src/components/chat-container/__stories__/types.ts +7 -0
- package/src/components/chat-container/__stories__/variable-readout.tsx +64 -0
- package/src/components/chat-container/chat-container.json +9 -1
- package/src/components/chat-container/chat-container.stories.tsx +538 -106
- package/src/components/chat-container/chat-container.tsx +3 -0
- package/src/components/chat-input/__stories__/fixtures.ts +31 -0
- package/src/components/chat-input/__tests__/chat-input.spec.tsx +100 -0
- package/src/components/chat-input/chat-input.json +11 -2
- package/src/components/chat-input/chat-input.stories.tsx +660 -197
- package/src/components/chat-input/chat-input.tsx +39 -5
- package/src/components/chat-input/plugins/controlled-value-plugin.tsx +16 -3
- package/src/components/chat-input/plugins/value-plugin.tsx +19 -4
- package/src/components/chat-list/__stories__/chat-row.tsx +41 -0
- package/src/components/chat-list/__stories__/fixtures.ts +94 -0
- package/src/components/chat-list/__stories__/types.ts +13 -0
- package/src/components/chat-list/chat-list-item.tsx +6 -0
- package/src/components/chat-list/chat-list-items.tsx +16 -0
- package/src/components/chat-list/chat-list.json +24 -2
- package/src/components/chat-list/chat-list.stories.tsx +631 -215
- package/src/components/chat-list/chat-list.tsx +51 -4
- package/src/components/chat-message/__stories__/fixtures.ts +53 -0
- package/src/components/chat-message/__stories__/sent-attachment.tsx +22 -0
- package/src/components/chat-message/__stories__/tool-steps.tsx +37 -0
- package/src/components/chat-message/chat-message.json +10 -1
- package/src/components/chat-message/chat-message.stories.tsx +282 -20
- package/src/components/chat-message/chat-message.tsx +16 -1
- package/src/components/chat-message/index.ts +8 -1
- package/src/components/chat-message-attachment-card/__stories__/fixtures.ts +30 -0
- package/src/components/chat-message-attachment-card/__stories__/types.ts +14 -0
- package/src/components/chat-message-attachment-card/chat-message-attachment-card-icon.tsx +4 -0
- package/src/components/chat-message-attachment-card/chat-message-attachment-card.json +20 -0
- package/src/components/chat-message-attachment-card/chat-message-attachment-card.stories.tsx +266 -51
- package/src/components/chat-message-attachment-card/chat-message-attachment-card.tsx +37 -4
- package/src/components/chat-message-attachment-card/index.ts +6 -0
- package/src/components/chat-message-attachment-card/utils.ts +1 -0
- package/src/components/chat-message-response/__stories__/fixtures.ts +50 -0
- package/src/components/chat-message-response/chat-message-response.json +5 -0
- package/src/components/chat-message-response/chat-message-response.stories.tsx +135 -26
- package/src/components/chat-message-toolbar/chat-message-toolbar.json +21 -3
- package/src/components/chat-message-toolbar/chat-message-toolbar.stories.tsx +377 -6
- package/src/components/chat-message-toolbar/chat-message-toolbar.tsx +47 -12
- package/src/components/chat-message-toolbar/index.ts +4 -0
- package/src/components/chat-messages/__stories__/conversation-frame.tsx +25 -0
- package/src/components/chat-messages/__stories__/conversation-group.tsx +22 -0
- package/src/components/chat-messages/__stories__/fixtures.ts +70 -0
- package/src/components/chat-messages/__stories__/types.ts +5 -0
- package/src/components/chat-messages/chat-messages.json +30 -12
- package/src/components/chat-messages/chat-messages.stories.tsx +439 -212
- package/src/components/chat-messages/chat-messages.tsx +46 -3
- package/src/components/chat-notification-card/__stories__/fixtures.ts +38 -0
- package/src/components/chat-notification-card/__stories__/types.ts +13 -0
- package/src/components/chat-notification-card/chat-notification-card.json +52 -2
- package/src/components/chat-notification-card/chat-notification-card.stories.tsx +542 -62
- package/src/components/chat-notification-card/chat-notification-card.tsx +97 -6
- package/src/components/chat-notification-popup/__stories__/fixtures.ts +36 -0
- package/src/components/chat-notification-popup/__stories__/notification-item.tsx +93 -0
- package/src/components/chat-notification-popup/__stories__/types.ts +14 -0
- package/src/components/chat-notification-popup/chat-notification-popup.json +14 -1
- package/src/components/chat-notification-popup/chat-notification-popup.stories.tsx +467 -17
- package/src/components/chat-notification-popup/chat-notification-popup.tsx +18 -3
- package/src/components/chat-prompt-box/__stories__/fixtures.ts +16 -0
- package/src/components/chat-prompt-box/__stories__/types.ts +8 -0
- package/src/components/chat-prompt-box/chat-prompt-box.json +25 -2
- package/src/components/chat-prompt-box/chat-prompt-box.stories.tsx +535 -43
- package/src/components/chat-prompt-box/chat-prompt-box.tsx +73 -19
- package/src/components/chat-reply/chat-reply.json +10 -0
- package/src/components/chat-reply/chat-reply.stories.tsx +264 -21
- package/src/components/chat-reply/chat-reply.tsx +15 -0
- package/src/components/chat-reply/index.ts +10 -1
- package/src/components/chat-suggestion/__stories__/fixtures.ts +16 -0
- package/src/components/chat-suggestion/__tests__/chat-suggestion.spec.tsx +185 -0
- package/src/components/chat-suggestion/chat-suggestion.json +62 -20
- package/src/components/chat-suggestion/chat-suggestion.stories.tsx +542 -58
- package/src/components/chat-suggestion/chat-suggestion.tsx +154 -65
- package/src/components/chat-suggestion/index.ts +9 -0
- package/src/components/chat-thinking-process/__stories__/fixtures.ts +56 -0
- package/src/components/chat-thinking-process/chat-thinking-process.json +28 -3
- package/src/components/chat-thinking-process/chat-thinking-process.stories.tsx +354 -78
- package/src/components/chat-thinking-process/chat-thinking-process.tsx +55 -4
- package/src/components/chat-thread/__stories__/fixtures.ts +171 -0
- package/src/components/chat-thread/__stories__/scroll-position.ts +9 -0
- package/src/components/chat-thread/__stories__/snippets.ts +129 -0
- package/src/components/chat-thread/__stories__/thread-frame.tsx +22 -0
- package/src/components/chat-thread/__stories__/thread-turns.tsx +35 -0
- package/src/components/chat-thread/__stories__/types.ts +12 -0
- package/src/components/chat-thread/__stories__/use-turn-stream.ts +78 -0
- package/src/components/chat-thread/chat-thread.json +23 -3
- package/src/components/chat-thread/chat-thread.stories.tsx +804 -142
- package/src/components/chat-thread/chat-thread.tsx +64 -16
- package/src/components/index.ts +1 -3
- package/src/components/markdown-viewer/__stories__/fixtures.ts +67 -0
- package/src/components/markdown-viewer/markdown-viewer.json +7 -1
- package/src/components/markdown-viewer/markdown-viewer.stories.tsx +219 -50
- package/src/components/markdown-viewer/markdown-viewer.tsx +9 -0
- package/src/components/rich-text-area/__stories__/fixtures.ts +30 -0
- package/src/components/rich-text-area/__tests__/rich-text-area.spec.tsx +114 -0
- package/src/components/rich-text-area/plugins/controlled-value-plugin.tsx +20 -3
- package/src/components/rich-text-area/plugins/value-plugin.tsx +16 -3
- package/src/components/rich-text-area/rich-text-area.json +7 -4
- package/src/components/rich-text-area/rich-text-area.stories.tsx +597 -41
- package/src/components/rich-text-area/rich-text-area.tsx +27 -4
- package/src/components/rich-text-area/styled.tsx +11 -5
- package/src/components/rich-text-field/__stories__/fixtures.ts +29 -0
- package/src/components/rich-text-field/components/formatting-toolbar-plugin.tsx +10 -1
- package/src/components/rich-text-field/components/index.ts +8 -5
- package/src/components/rich-text-field/components/text-color-button.tsx +16 -2
- package/src/components/rich-text-field/rich-text-field.json +3 -1
- package/src/components/rich-text-field/rich-text-field.stories.tsx +452 -61
- package/src/components/rich-text-field/rich-text-field.tsx +23 -0
- package/src/components/topmenu/index.ts +1 -0
- package/src/components/topmenu/topmenu.json +107 -0
- package/src/components/topmenu/topmenu.stories.tsx +334 -0
- package/src/components/topmenu/topmenu.tsx +71 -0
- package/src/docs/agent.stories.tsx +16 -16
- package/src/docs/chat-panel.tsx +37 -32
- package/src/docs/chatbot-panel.tsx +11 -2
- package/src/docs/chatbot.mdx +17 -12
- package/src/docs/chatbot.stories.tsx +7 -8
- package/src/layouts/chat-card-list-layout/__stories__/fixtures.ts +112 -0
- package/src/layouts/chat-card-list-layout/__stories__/result-card.tsx +36 -0
- package/src/layouts/chat-card-list-layout/__stories__/types.ts +31 -0
- package/src/layouts/chat-card-list-layout/chat-card-list-layout.json +14 -1
- package/src/layouts/chat-card-list-layout/chat-card-list-layout.stories.tsx +316 -84
- package/src/layouts/chat-card-list-layout/chat-card-list-layout.tsx +11 -7
- package/src/layouts/chat-card-three-column-layout/__stories__/fixtures.ts +117 -0
- package/src/layouts/chat-card-three-column-layout/__stories__/resizable-chat-window.tsx +18 -0
- package/src/layouts/chat-card-three-column-layout/__stories__/stay-details.tsx +85 -0
- package/src/layouts/chat-card-three-column-layout/__stories__/stay-list.tsx +50 -0
- package/src/layouts/chat-card-three-column-layout/__stories__/stay-map.tsx +44 -0
- package/src/layouts/chat-card-three-column-layout/__stories__/stay-rooms.tsx +61 -0
- package/src/layouts/chat-card-three-column-layout/__stories__/types.ts +35 -0
- package/src/layouts/chat-card-three-column-layout/chat-card-three-column-layout.json +16 -0
- package/src/layouts/chat-card-three-column-layout/chat-card-three-column-layout.stories.tsx +603 -182
- package/src/layouts/chat-card-two-column-layout/__stories__/connection-itinerary.tsx +51 -0
- package/src/layouts/chat-card-two-column-layout/__stories__/fixtures.ts +83 -0
- package/src/layouts/chat-card-two-column-layout/__stories__/route-map.tsx +24 -0
- package/src/layouts/chat-card-two-column-layout/__stories__/types.ts +15 -0
- package/src/layouts/chat-card-two-column-layout/chat-card-two-column-layout.json +13 -1
- package/src/layouts/chat-card-two-column-layout/chat-card-two-column-layout.stories.tsx +368 -67
- package/src/layouts/chat-card-two-column-layout/chat-card-two-column-layout.tsx +11 -2
- package/dist/components/card-item-picker/card-item-picker-context.d.ts +0 -21
- package/dist/components/card-item-picker/card-item-picker-context.d.ts.map +0 -1
- package/dist/components/card-item-picker/card-item-picker-list.d.ts +0 -24
- package/dist/components/card-item-picker/card-item-picker-list.d.ts.map +0 -1
- package/dist/components/card-item-picker/card-item-picker-row-parts.d.ts +0 -28
- package/dist/components/card-item-picker/card-item-picker-row-parts.d.ts.map +0 -1
- package/dist/components/card-item-picker/card-item-picker-row.d.ts +0 -12
- package/dist/components/card-item-picker/card-item-picker-row.d.ts.map +0 -1
- package/dist/components/card-item-picker/card-item-picker.stories.d.ts +0 -19
- package/dist/components/card-item-picker/card-item-picker.stories.d.ts.map +0 -1
- package/dist/components/card-item-picker/index.d.ts +0 -9
- package/dist/components/card-item-picker/index.d.ts.map +0 -1
- package/dist/components/chat-message-history/chat-message-history.d.ts +0 -48
- package/dist/components/chat-message-history/chat-message-history.d.ts.map +0 -1
- package/dist/components/chat-message-history/chat-message-history.stories.d.ts +0 -7
- package/dist/components/chat-message-history/chat-message-history.stories.d.ts.map +0 -1
- package/dist/components/chat-message-history/index.d.ts +0 -2
- package/dist/components/chat-message-history/index.d.ts.map +0 -1
- package/dist/components/spinner/index.d.ts +0 -2
- package/dist/components/spinner/index.d.ts.map +0 -1
- package/dist/components/spinner/spinner.d.ts +0 -9
- package/dist/components/spinner/spinner.d.ts.map +0 -1
- package/dist/components/spinner/spinner.stories.d.ts +0 -8
- package/dist/components/spinner/spinner.stories.d.ts.map +0 -1
- package/src/components/card-item-picker/__tests__/card-item-picker.spec.tsx +0 -279
- package/src/components/card-item-picker/card-item-picker-context.tsx +0 -44
- package/src/components/card-item-picker/card-item-picker-list.tsx +0 -95
- package/src/components/card-item-picker/card-item-picker-row-parts.tsx +0 -96
- package/src/components/card-item-picker/card-item-picker-row.tsx +0 -109
- package/src/components/card-item-picker/card-item-picker.json +0 -147
- package/src/components/card-item-picker/card-item-picker.stories.tsx +0 -158
- package/src/components/card-item-picker/index.ts +0 -24
- package/src/components/chat-message-history/chat-message-history.json +0 -99
- package/src/components/chat-message-history/chat-message-history.stories.tsx +0 -136
- package/src/components/chat-message-history/chat-message-history.tsx +0 -277
- package/src/components/chat-message-history/index.ts +0 -13
- package/src/components/spinner/index.ts +0 -1
- package/src/components/spinner/spinner.json +0 -73
- package/src/components/spinner/spinner.stories.tsx +0 -41
- package/src/components/spinner/spinner.tsx +0 -32
|
@@ -35,6 +35,7 @@ interface ChatNotificationCardContextValue {
|
|
|
35
35
|
|
|
36
36
|
const ChatNotificationCardContext = createContext<ChatNotificationCardContextValue>(null!);
|
|
37
37
|
|
|
38
|
+
/** The card's expanded state and its setters. Throws outside a `ChatNotificationCard`. */
|
|
38
39
|
export function useChatNotificationCardContext() {
|
|
39
40
|
const context = useContext(ChatNotificationCardContext);
|
|
40
41
|
|
|
@@ -47,17 +48,30 @@ export function useChatNotificationCardContext() {
|
|
|
47
48
|
|
|
48
49
|
export interface ChatNotificationCardProps {
|
|
49
50
|
children?: ReactNode;
|
|
51
|
+
/** `default` for a card in a list, `floating` (bordered) for a card shown on its own over the chat. */
|
|
50
52
|
variant?: 'default' | 'floating';
|
|
51
53
|
className?: string;
|
|
54
|
+
/** Classes for the hover overlay (`data-slot="chat-notification-card-overlay"`). */
|
|
55
|
+
overlayClassName?: string;
|
|
56
|
+
/** Initial expanded state when uncontrolled. */
|
|
52
57
|
defaultExpanded?: boolean;
|
|
58
|
+
/** Controlled expanded state; pair it with `onExpandedChange`. */
|
|
53
59
|
expanded?: boolean;
|
|
60
|
+
/** Called with the next expanded state when the expand button is toggled. */
|
|
54
61
|
onExpandedChange?: (expanded: boolean) => void;
|
|
62
|
+
/** Called on a click anywhere on the card except its buttons. */
|
|
55
63
|
onClick?: () => void;
|
|
56
64
|
}
|
|
57
65
|
|
|
66
|
+
/**
|
|
67
|
+
* Root of the notification card. Holds the expanded state and exposes it, with the variant, as
|
|
68
|
+
* `data-expanded` and `data-variant`.
|
|
69
|
+
*/
|
|
58
70
|
export function ChatNotificationCard({
|
|
59
71
|
children,
|
|
72
|
+
variant = 'default',
|
|
60
73
|
className,
|
|
74
|
+
overlayClassName,
|
|
61
75
|
defaultExpanded = false,
|
|
62
76
|
expanded,
|
|
63
77
|
onExpandedChange,
|
|
@@ -94,7 +108,9 @@ export function ChatNotificationCard({
|
|
|
94
108
|
<ChatNotificationCardContext.Provider value={contextValue}>
|
|
95
109
|
<div
|
|
96
110
|
role="alert"
|
|
111
|
+
data-slot="chat-notification-card"
|
|
97
112
|
data-testid="chat-notification-card"
|
|
113
|
+
data-variant={variant}
|
|
98
114
|
data-expanded={isExpanded}
|
|
99
115
|
aria-expanded={isExpanded}
|
|
100
116
|
className={cn(
|
|
@@ -112,7 +128,13 @@ export function ChatNotificationCard({
|
|
|
112
128
|
>
|
|
113
129
|
{children}
|
|
114
130
|
|
|
115
|
-
<div
|
|
131
|
+
<div
|
|
132
|
+
data-slot="chat-notification-card-overlay"
|
|
133
|
+
className={cn(
|
|
134
|
+
'absolute inset-0 pointer-events-none bg-secondary-states-hover opacity-0 group-hover/chat-notification-card:opacity-100 transition-opacity duration-200 ease-in-out',
|
|
135
|
+
overlayClassName,
|
|
136
|
+
)}
|
|
137
|
+
/>
|
|
116
138
|
</div>
|
|
117
139
|
</ChatNotificationCardContext.Provider>
|
|
118
140
|
);
|
|
@@ -123,9 +145,11 @@ export interface ChatNotificationCardHeadProps {
|
|
|
123
145
|
className?: string;
|
|
124
146
|
}
|
|
125
147
|
|
|
148
|
+
/** Top row of the card: the header on the left, the actions on the right. */
|
|
126
149
|
export function ChatNotificationCardHead({ children, className }: ChatNotificationCardHeadProps) {
|
|
127
150
|
return (
|
|
128
151
|
<header
|
|
152
|
+
data-slot="chat-notification-card-head"
|
|
129
153
|
data-testid="chat-notification-card-head"
|
|
130
154
|
className={cn(
|
|
131
155
|
'grid grid-cols-[minmax(0,1fr)_auto] items-center gap-8',
|
|
@@ -143,12 +167,14 @@ export interface ChatNotificationCardHeaderProps {
|
|
|
143
167
|
className?: string;
|
|
144
168
|
}
|
|
145
169
|
|
|
170
|
+
/** Left side of the head: the icon and the title. */
|
|
146
171
|
export function ChatNotificationCardHeader({
|
|
147
172
|
children,
|
|
148
173
|
className,
|
|
149
174
|
}: ChatNotificationCardHeaderProps) {
|
|
150
175
|
return (
|
|
151
176
|
<div
|
|
177
|
+
data-slot="chat-notification-card-header"
|
|
152
178
|
data-testid="chat-notification-card-header"
|
|
153
179
|
className={cn(
|
|
154
180
|
'min-w-0 flex items-center gap-8 overflow-hidden',
|
|
@@ -166,12 +192,14 @@ export interface ChatNotificationCardHeaderIconProps {
|
|
|
166
192
|
className?: string;
|
|
167
193
|
}
|
|
168
194
|
|
|
195
|
+
/** Icon that says what kind of notification this is. */
|
|
169
196
|
export function ChatNotificationCardHeaderIcon({
|
|
170
197
|
children,
|
|
171
198
|
className,
|
|
172
199
|
}: ChatNotificationCardHeaderIconProps) {
|
|
173
200
|
return (
|
|
174
201
|
<div
|
|
202
|
+
data-slot="chat-notification-card-header-icon"
|
|
175
203
|
data-testid="chat-notification-card-header-icon"
|
|
176
204
|
className={cn(
|
|
177
205
|
'shrink-0',
|
|
@@ -191,12 +219,14 @@ export interface ChatNotificationCardHeaderTitleProps {
|
|
|
191
219
|
className?: string;
|
|
192
220
|
}
|
|
193
221
|
|
|
222
|
+
/** Holds the title label and the status chip. */
|
|
194
223
|
export function ChatNotificationCardHeaderTitle({
|
|
195
224
|
children,
|
|
196
225
|
className,
|
|
197
226
|
}: ChatNotificationCardHeaderTitleProps) {
|
|
198
227
|
return (
|
|
199
228
|
<div
|
|
229
|
+
data-slot="chat-notification-card-header-title"
|
|
200
230
|
data-testid="chat-notification-card-header-title"
|
|
201
231
|
className={cn('min-w-0 flex flex-1 items-center gap-8 overflow-hidden', className)}
|
|
202
232
|
>
|
|
@@ -210,6 +240,7 @@ export interface ChatNotificationCardHeaderTitleLabelProps {
|
|
|
210
240
|
className?: string;
|
|
211
241
|
}
|
|
212
242
|
|
|
243
|
+
/** Notification type or short subject: semibold, uppercase, truncated to one line. */
|
|
213
244
|
export function ChatNotificationCardHeaderTitleLabel({
|
|
214
245
|
children,
|
|
215
246
|
className,
|
|
@@ -218,6 +249,7 @@ export function ChatNotificationCardHeaderTitleLabel({
|
|
|
218
249
|
<Typography
|
|
219
250
|
variant="body-sm"
|
|
220
251
|
fontWeight="semibold"
|
|
252
|
+
data-slot="chat-notification-card-header-title-label"
|
|
221
253
|
data-testid="chat-notification-card-header-title-label"
|
|
222
254
|
className={cn('min-w-0 truncate', 'text-left text-inherit uppercase', className)}
|
|
223
255
|
asChild
|
|
@@ -242,6 +274,7 @@ export interface ChatNotificationCardHeaderStatusProps extends Omit<
|
|
|
242
274
|
className?: string;
|
|
243
275
|
}
|
|
244
276
|
|
|
277
|
+
/** Priority chip: `high` is an error chip, `medium` a warning chip, `low` renders nothing. */
|
|
245
278
|
export function ChatNotificationCardHeaderStatus({
|
|
246
279
|
children,
|
|
247
280
|
priority = 'medium',
|
|
@@ -256,7 +289,9 @@ export function ChatNotificationCardHeaderStatus({
|
|
|
256
289
|
|
|
257
290
|
return (
|
|
258
291
|
<Chip
|
|
292
|
+
data-slot="chat-notification-card-header-status"
|
|
259
293
|
data-testid="chat-notification-card-header-status"
|
|
294
|
+
data-priority={priority}
|
|
260
295
|
className={cn('text-text-secondary', 'shrink-0', className)}
|
|
261
296
|
size="2xs"
|
|
262
297
|
color={color}
|
|
@@ -273,12 +308,14 @@ export interface ChatNotificationCardActionsProps {
|
|
|
273
308
|
className?: string;
|
|
274
309
|
}
|
|
275
310
|
|
|
311
|
+
/** Right side of the head: the timestamp and the buttons. */
|
|
276
312
|
export function ChatNotificationCardActions({
|
|
277
313
|
children,
|
|
278
314
|
className,
|
|
279
315
|
}: ChatNotificationCardActionsProps) {
|
|
280
316
|
return (
|
|
281
317
|
<div
|
|
318
|
+
data-slot="chat-notification-card-actions"
|
|
282
319
|
data-testid="chat-notification-card-actions"
|
|
283
320
|
role="group"
|
|
284
321
|
className={cn(
|
|
@@ -297,6 +334,7 @@ export interface ChatNotificationCardTimestampProps {
|
|
|
297
334
|
className?: string;
|
|
298
335
|
}
|
|
299
336
|
|
|
337
|
+
/** Relative time the notification arrived. */
|
|
300
338
|
export function ChatNotificationCardTimestamp({
|
|
301
339
|
children,
|
|
302
340
|
className,
|
|
@@ -304,10 +342,12 @@ export function ChatNotificationCardTimestamp({
|
|
|
304
342
|
return (
|
|
305
343
|
<Typography
|
|
306
344
|
variant="caption"
|
|
345
|
+
data-slot="chat-notification-card-timestamp"
|
|
307
346
|
data-testid="chat-notification-card-timestamp"
|
|
308
347
|
className={cn('text-text-secondary', 'inline-flex px-8', 'leading-[32px]', className)}
|
|
348
|
+
asChild
|
|
309
349
|
>
|
|
310
|
-
{children}
|
|
350
|
+
<span>{children}</span>
|
|
311
351
|
</Typography>
|
|
312
352
|
);
|
|
313
353
|
}
|
|
@@ -317,6 +357,7 @@ export interface ChatNotificationCardButtonsProps {
|
|
|
317
357
|
className?: string;
|
|
318
358
|
}
|
|
319
359
|
|
|
360
|
+
/** Group for the action buttons. Stops their clicks from reaching the card's `onClick`. */
|
|
320
361
|
export function ChatNotificationCardButtons({
|
|
321
362
|
children,
|
|
322
363
|
className,
|
|
@@ -331,6 +372,7 @@ export function ChatNotificationCardButtons({
|
|
|
331
372
|
|
|
332
373
|
return (
|
|
333
374
|
<div
|
|
375
|
+
data-slot="chat-notification-card-buttons"
|
|
334
376
|
data-testid="chat-notification-card-buttons"
|
|
335
377
|
role="group"
|
|
336
378
|
className={cn('flex flex-row items-center justify-end', 'gap-8', className)}
|
|
@@ -342,10 +384,10 @@ export function ChatNotificationCardButtons({
|
|
|
342
384
|
);
|
|
343
385
|
}
|
|
344
386
|
|
|
345
|
-
|
|
387
|
+
interface ChatNotificationCardActionButtonProps extends Omit<
|
|
346
388
|
ComponentProps<typeof IconButton>,
|
|
347
389
|
'children' | 'size' | 'variant'
|
|
348
|
-
|
|
390
|
+
> {}
|
|
349
391
|
|
|
350
392
|
export interface ChatNotificationCardReadActionButtonProps extends Omit<
|
|
351
393
|
ChatNotificationCardActionButtonProps,
|
|
@@ -353,10 +395,13 @@ export interface ChatNotificationCardReadActionButtonProps extends Omit<
|
|
|
353
395
|
> {
|
|
354
396
|
children?: ReactNode;
|
|
355
397
|
className?: string;
|
|
398
|
+
/** Whether the notification is read. Swaps the icon and sets `data-read`. */
|
|
356
399
|
isRead?: boolean;
|
|
400
|
+
/** Called with the toggled read state on click. */
|
|
357
401
|
onRead?: (isRead: boolean) => void;
|
|
358
402
|
}
|
|
359
403
|
|
|
404
|
+
/** Icon button that toggles the notification between read and unread. */
|
|
360
405
|
export const ChatNotificationCardReadActionButton = forwardRef<
|
|
361
406
|
HTMLButtonElement,
|
|
362
407
|
ChatNotificationCardReadActionButtonProps
|
|
@@ -371,6 +416,8 @@ export const ChatNotificationCardReadActionButton = forwardRef<
|
|
|
371
416
|
return (
|
|
372
417
|
<IconButton
|
|
373
418
|
ref={ref}
|
|
419
|
+
data-slot="chat-notification-card-read-action-button"
|
|
420
|
+
data-read={isRead}
|
|
374
421
|
aria-label="Mark notifications as read"
|
|
375
422
|
size="sm"
|
|
376
423
|
variant="tertiary"
|
|
@@ -388,18 +435,32 @@ ChatNotificationCardReadActionButton.displayName = 'ChatNotificationCardReadActi
|
|
|
388
435
|
export interface ChatNotificationCardSnoozeButtonProps extends ChatNotificationCardActionButtonProps {
|
|
389
436
|
children?: ReactNode;
|
|
390
437
|
className?: string;
|
|
438
|
+
/** Classes for the time-left label of the snoozed button (`data-slot="chat-notification-card-snooze-button-label"`). */
|
|
439
|
+
labelClassName?: string;
|
|
440
|
+
/** Classes for the cancel label shown on hover (`data-slot="chat-notification-card-snooze-button-cancel-label"`). */
|
|
441
|
+
cancelLabelClassName?: string;
|
|
442
|
+
/** When in the future, the button shows the time left and cancels the snooze on click. */
|
|
391
443
|
snoozeUntilDate?: Date;
|
|
444
|
+
/** Text that replaces the time left while the snoozed button is hovered. */
|
|
392
445
|
cancelLabel?: ReactNode;
|
|
446
|
+
/** Formats the time left. Defaults to `formatSnoozeDate` ('in 2 minutes'). */
|
|
393
447
|
formatDate?: (date: Date) => ReactNode;
|
|
448
|
+
/** Called when the snoozed button is clicked. */
|
|
394
449
|
onCancel?: () => void;
|
|
395
450
|
}
|
|
396
451
|
|
|
452
|
+
/**
|
|
453
|
+
* Snooze control. An icon button that calls `onClick`; while `snoozeUntilDate` is in the future, a
|
|
454
|
+
* text button with the time left that calls `onCancel`. `data-snoozed` says which one is rendered.
|
|
455
|
+
*/
|
|
397
456
|
export const ChatNotificationCardSnoozeButton = forwardRef<
|
|
398
457
|
HTMLButtonElement,
|
|
399
458
|
ChatNotificationCardSnoozeButtonProps
|
|
400
459
|
>(function ChatNotificationCardSnoozeButton(
|
|
401
460
|
{
|
|
402
461
|
className,
|
|
462
|
+
labelClassName,
|
|
463
|
+
cancelLabelClassName,
|
|
403
464
|
snoozeUntilDate,
|
|
404
465
|
cancelLabel = 'Cancel',
|
|
405
466
|
formatDate = formatSnoozeDate,
|
|
@@ -439,6 +500,8 @@ export const ChatNotificationCardSnoozeButton = forwardRef<
|
|
|
439
500
|
return (
|
|
440
501
|
<Button
|
|
441
502
|
ref={ref}
|
|
503
|
+
data-slot="chat-notification-card-snooze-button"
|
|
504
|
+
data-snoozed="true"
|
|
442
505
|
data-hover={isHovered}
|
|
443
506
|
startIcon={isHovered ? <CloseIcon /> : <SnoozeIcon />}
|
|
444
507
|
variant="tertiary"
|
|
@@ -454,19 +517,23 @@ export const ChatNotificationCardSnoozeButton = forwardRef<
|
|
|
454
517
|
{...rest}
|
|
455
518
|
>
|
|
456
519
|
<span
|
|
520
|
+
data-slot="chat-notification-card-snooze-button-label"
|
|
457
521
|
className={cn(
|
|
458
522
|
'group-data-[hover=true]/snooze-button:opacity-0',
|
|
459
523
|
'transition-opacity duration-200 ease-in-out',
|
|
524
|
+
labelClassName,
|
|
460
525
|
)}
|
|
461
526
|
>
|
|
462
527
|
{formatDate(snoozeUntilDate)}
|
|
463
528
|
</span>
|
|
464
529
|
<span
|
|
530
|
+
data-slot="chat-notification-card-snooze-button-cancel-label"
|
|
465
531
|
className={cn(
|
|
466
532
|
'absolute left-0 w-full text-center pl-[16px]',
|
|
467
533
|
'transition-opacity duration-200 ease-in-out',
|
|
468
534
|
'opacity-0',
|
|
469
535
|
'group-data-[hover=true]/snooze-button:opacity-100',
|
|
536
|
+
cancelLabelClassName,
|
|
470
537
|
)}
|
|
471
538
|
>
|
|
472
539
|
{cancelLabel}
|
|
@@ -478,6 +545,8 @@ export const ChatNotificationCardSnoozeButton = forwardRef<
|
|
|
478
545
|
return (
|
|
479
546
|
<IconButton
|
|
480
547
|
ref={ref}
|
|
548
|
+
data-slot="chat-notification-card-snooze-button"
|
|
549
|
+
data-snoozed="false"
|
|
481
550
|
aria-label="Snooze notification"
|
|
482
551
|
size="sm"
|
|
483
552
|
variant="tertiary"
|
|
@@ -492,13 +561,17 @@ export const ChatNotificationCardSnoozeButton = forwardRef<
|
|
|
492
561
|
|
|
493
562
|
ChatNotificationCardSnoozeButton.displayName = 'ChatNotificationCardSnoozeButton';
|
|
494
563
|
|
|
564
|
+
export interface ChatNotificationCardDeleteButtonProps extends ChatNotificationCardActionButtonProps {}
|
|
565
|
+
|
|
566
|
+
/** Icon button that deletes the notification from a list. */
|
|
495
567
|
export const ChatNotificationCardDeleteButton = forwardRef<
|
|
496
568
|
HTMLButtonElement,
|
|
497
|
-
|
|
569
|
+
ChatNotificationCardDeleteButtonProps
|
|
498
570
|
>(function ChatNotificationCardDeleteButton({ className, ...rest }, ref) {
|
|
499
571
|
return (
|
|
500
572
|
<IconButton
|
|
501
573
|
ref={ref}
|
|
574
|
+
data-slot="chat-notification-card-delete-button"
|
|
502
575
|
aria-label="Delete notification"
|
|
503
576
|
size="sm"
|
|
504
577
|
variant="tertiary"
|
|
@@ -512,13 +585,17 @@ export const ChatNotificationCardDeleteButton = forwardRef<
|
|
|
512
585
|
|
|
513
586
|
ChatNotificationCardDeleteButton.displayName = 'ChatNotificationCardDeleteButton';
|
|
514
587
|
|
|
588
|
+
export interface ChatNotificationCardCloseButtonProps extends ChatNotificationCardActionButtonProps {}
|
|
589
|
+
|
|
590
|
+
/** Icon button that dismisses a floating notification. */
|
|
515
591
|
export const ChatNotificationCardCloseButton = forwardRef<
|
|
516
592
|
HTMLButtonElement,
|
|
517
|
-
|
|
593
|
+
ChatNotificationCardCloseButtonProps
|
|
518
594
|
>(function ChatNotificationCardCloseButton({ className, ...rest }, ref) {
|
|
519
595
|
return (
|
|
520
596
|
<IconButton
|
|
521
597
|
ref={ref}
|
|
598
|
+
data-slot="chat-notification-card-close-button"
|
|
522
599
|
aria-label="Close notification"
|
|
523
600
|
size="sm"
|
|
524
601
|
variant="tertiary"
|
|
@@ -537,12 +614,14 @@ export interface ChatNotificationCardContentProps {
|
|
|
537
614
|
className?: string;
|
|
538
615
|
}
|
|
539
616
|
|
|
617
|
+
/** Body of the card. Renders the expand button at its bottom-right corner. */
|
|
540
618
|
export function ChatNotificationCardContent({
|
|
541
619
|
children,
|
|
542
620
|
className,
|
|
543
621
|
}: ChatNotificationCardContentProps) {
|
|
544
622
|
return (
|
|
545
623
|
<div
|
|
624
|
+
data-slot="chat-notification-card-content"
|
|
546
625
|
data-testid="chat-notification-card-content"
|
|
547
626
|
className={cn('flex flex-col items-start text-left gap-4', 'relative pr-[40px]', className)}
|
|
548
627
|
>
|
|
@@ -558,6 +637,7 @@ export interface ChatNotificationCardContentTitleProps {
|
|
|
558
637
|
className?: string;
|
|
559
638
|
}
|
|
560
639
|
|
|
640
|
+
/** Subject line of the notification, above the description. */
|
|
561
641
|
export function ChatNotificationCardContentTitle({
|
|
562
642
|
children,
|
|
563
643
|
className,
|
|
@@ -566,6 +646,7 @@ export function ChatNotificationCardContentTitle({
|
|
|
566
646
|
<Typography
|
|
567
647
|
variant="body-sm"
|
|
568
648
|
fontWeight="semibold"
|
|
649
|
+
data-slot="chat-notification-card-content-title"
|
|
569
650
|
data-testid="chat-notification-card-content-title"
|
|
570
651
|
className={cn('text-text-primary', 'text-left', className)}
|
|
571
652
|
asChild
|
|
@@ -580,6 +661,7 @@ export interface ChatNotificationCardContentDescriptionProps {
|
|
|
580
661
|
className?: string;
|
|
581
662
|
}
|
|
582
663
|
|
|
664
|
+
/** Notification text, clamped to two lines until the card is expanded. */
|
|
583
665
|
export function ChatNotificationCardContentDescription({
|
|
584
666
|
children,
|
|
585
667
|
className,
|
|
@@ -587,6 +669,7 @@ export function ChatNotificationCardContentDescription({
|
|
|
587
669
|
return (
|
|
588
670
|
<Typography
|
|
589
671
|
variant="body-sm"
|
|
672
|
+
data-slot="chat-notification-card-content-description"
|
|
590
673
|
data-testid="chat-notification-card-content-description"
|
|
591
674
|
className={cn(
|
|
592
675
|
'text-text-primary',
|
|
@@ -607,12 +690,14 @@ export interface ChatNotificationCardContentActionsProps {
|
|
|
607
690
|
className?: string;
|
|
608
691
|
}
|
|
609
692
|
|
|
693
|
+
/** Follow-up actions, shown only while the card is expanded. */
|
|
610
694
|
export function ChatNotificationCardContentActions({
|
|
611
695
|
children,
|
|
612
696
|
className,
|
|
613
697
|
}: ChatNotificationCardContentActionsProps) {
|
|
614
698
|
return (
|
|
615
699
|
<div
|
|
700
|
+
data-slot="chat-notification-card-content-actions"
|
|
616
701
|
data-testid="chat-notification-card-content-actions"
|
|
617
702
|
role="group"
|
|
618
703
|
className={cn(
|
|
@@ -636,6 +721,10 @@ export interface ChatNotificationCardExpandButtonProps extends Omit<
|
|
|
636
721
|
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
637
722
|
}
|
|
638
723
|
|
|
724
|
+
/**
|
|
725
|
+
* Chevron button that toggles the expanded state. `ChatNotificationCardContent` already renders
|
|
726
|
+
* one, so a card needs no second.
|
|
727
|
+
*/
|
|
639
728
|
export const ChatNotificationCardExpandButton = forwardRef<
|
|
640
729
|
HTMLButtonElement,
|
|
641
730
|
ChatNotificationCardExpandButtonProps
|
|
@@ -656,6 +745,7 @@ export const ChatNotificationCardExpandButton = forwardRef<
|
|
|
656
745
|
return (
|
|
657
746
|
<IconButton
|
|
658
747
|
ref={ref}
|
|
748
|
+
data-slot="chat-notification-card-expand-button"
|
|
659
749
|
data-testid="chat-notification-card-expand-button"
|
|
660
750
|
size="sm"
|
|
661
751
|
variant="tertiary"
|
|
@@ -679,6 +769,7 @@ export const ChatNotificationCardExpandButton = forwardRef<
|
|
|
679
769
|
|
|
680
770
|
ChatNotificationCardExpandButton.displayName = 'ChatNotificationCardExpandButton';
|
|
681
771
|
|
|
772
|
+
/** Aliases kept for older imports; use the full part names. */
|
|
682
773
|
export const ChatNotificationCardIcon = ChatNotificationCardHeaderIcon;
|
|
683
774
|
export const ChatNotificationCardDescription = ChatNotificationCardContentDescription;
|
|
684
775
|
export const ChatNotificationCardTimeStamp = ChatNotificationCardTimestamp;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { NotificationSignal } from './types';
|
|
2
|
+
|
|
3
|
+
// Mirrors the notification centre list: unread first, one long subject, one row with no follow-up.
|
|
4
|
+
export const NOTIFICATIONS: NotificationSignal[] = [
|
|
5
|
+
{
|
|
6
|
+
id: 'ntf_01',
|
|
7
|
+
category: 'Travel',
|
|
8
|
+
priority: 'High',
|
|
9
|
+
title: 'Flight LX 318 to London is delayed',
|
|
10
|
+
body: 'Departure moved from 14:05 to 15:20. Your connection to Edinburgh still has 55 minutes.',
|
|
11
|
+
createdAt: '2 min. ago',
|
|
12
|
+
isRead: false,
|
|
13
|
+
actions: ['Find an earlier flight', 'Tell the hotel I arrive late'],
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
id: 'ntf_02',
|
|
17
|
+
category: 'Travel',
|
|
18
|
+
priority: 'Medium',
|
|
19
|
+
title: 'Online check-in is open for Hotel Seeblick',
|
|
20
|
+
body: 'Check in before Friday 18:00 to skip the front desk. Your room is ready from 15:00.',
|
|
21
|
+
createdAt: '1 h ago',
|
|
22
|
+
isRead: false,
|
|
23
|
+
actions: ['Check me in'],
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: 'ntf_03',
|
|
27
|
+
category: 'Other',
|
|
28
|
+
priority: 'Low',
|
|
29
|
+
title:
|
|
30
|
+
'Your weekly summary is ready: 12 conversations, 3 open tasks and 2 documents waiting for review',
|
|
31
|
+
body: 'Most of your time went into the Edinburgh trip. The budget draft has not changed since Monday.',
|
|
32
|
+
createdAt: 'Yesterday',
|
|
33
|
+
isRead: true,
|
|
34
|
+
actions: [],
|
|
35
|
+
},
|
|
36
|
+
];
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { HourglassBottomIcon } from '@swisper.ai/icons';
|
|
2
|
+
import { Button } from '@swisper.ai/ui';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
ChatNotificationCard,
|
|
6
|
+
ChatNotificationCardActions,
|
|
7
|
+
ChatNotificationCardButtons,
|
|
8
|
+
ChatNotificationCardContent,
|
|
9
|
+
ChatNotificationCardContentActions,
|
|
10
|
+
ChatNotificationCardContentDescription,
|
|
11
|
+
ChatNotificationCardContentTitle,
|
|
12
|
+
ChatNotificationCardHead,
|
|
13
|
+
ChatNotificationCardHeader,
|
|
14
|
+
ChatNotificationCardHeaderIcon,
|
|
15
|
+
ChatNotificationCardHeaderStatus,
|
|
16
|
+
ChatNotificationCardHeaderTitle,
|
|
17
|
+
ChatNotificationCardHeaderTitleLabel,
|
|
18
|
+
ChatNotificationCardReadActionButton,
|
|
19
|
+
ChatNotificationCardTimestamp,
|
|
20
|
+
} from '../../chat-notification-card';
|
|
21
|
+
|
|
22
|
+
import type { NotificationSignal } from './types';
|
|
23
|
+
|
|
24
|
+
export interface NotificationItemProps {
|
|
25
|
+
notification: NotificationSignal;
|
|
26
|
+
isRead: boolean;
|
|
27
|
+
/** Starts with the full text and the follow-ups showing. */
|
|
28
|
+
isDefaultExpanded?: boolean;
|
|
29
|
+
/** Renders the follow-up buttons under the text. */
|
|
30
|
+
hasActions?: boolean;
|
|
31
|
+
onRead: () => void;
|
|
32
|
+
onAction: (action: string) => void;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** One notification as a `ChatNotificationCard`: clicking it, or acting on it, marks it as read. */
|
|
36
|
+
export function NotificationItem({
|
|
37
|
+
notification,
|
|
38
|
+
isRead,
|
|
39
|
+
isDefaultExpanded = false,
|
|
40
|
+
hasActions = true,
|
|
41
|
+
onRead,
|
|
42
|
+
onAction,
|
|
43
|
+
}: NotificationItemProps) {
|
|
44
|
+
const { category, priority, title, body, createdAt, actions } = notification;
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<ChatNotificationCard className="w-full" defaultExpanded={isDefaultExpanded} onClick={onRead}>
|
|
48
|
+
<ChatNotificationCardHead>
|
|
49
|
+
<ChatNotificationCardHeader>
|
|
50
|
+
<ChatNotificationCardHeaderIcon>
|
|
51
|
+
<HourglassBottomIcon />
|
|
52
|
+
</ChatNotificationCardHeaderIcon>
|
|
53
|
+
<ChatNotificationCardHeaderTitle>
|
|
54
|
+
<ChatNotificationCardHeaderTitleLabel>{category}</ChatNotificationCardHeaderTitleLabel>
|
|
55
|
+
<ChatNotificationCardHeaderStatus>{priority}</ChatNotificationCardHeaderStatus>
|
|
56
|
+
</ChatNotificationCardHeaderTitle>
|
|
57
|
+
</ChatNotificationCardHeader>
|
|
58
|
+
<ChatNotificationCardActions>
|
|
59
|
+
<ChatNotificationCardTimestamp>{createdAt}</ChatNotificationCardTimestamp>
|
|
60
|
+
<ChatNotificationCardButtons>
|
|
61
|
+
<ChatNotificationCardReadActionButton
|
|
62
|
+
aria-label={isRead ? `Read: ${title}` : `Mark as read: ${title}`}
|
|
63
|
+
isRead={isRead}
|
|
64
|
+
onRead={onRead}
|
|
65
|
+
/>
|
|
66
|
+
</ChatNotificationCardButtons>
|
|
67
|
+
</ChatNotificationCardActions>
|
|
68
|
+
</ChatNotificationCardHead>
|
|
69
|
+
<ChatNotificationCardContent>
|
|
70
|
+
<ChatNotificationCardContentTitle>{title}</ChatNotificationCardContentTitle>
|
|
71
|
+
<ChatNotificationCardContentDescription>{body}</ChatNotificationCardContentDescription>
|
|
72
|
+
{hasActions && actions.length > 0 && (
|
|
73
|
+
<ChatNotificationCardContentActions className="flex-wrap">
|
|
74
|
+
{actions.map((action) => (
|
|
75
|
+
<Button
|
|
76
|
+
key={action}
|
|
77
|
+
variant="secondary"
|
|
78
|
+
size="sm"
|
|
79
|
+
onClick={(event) => {
|
|
80
|
+
// The card's own click handler already marks it as read; don't run it twice.
|
|
81
|
+
event.stopPropagation();
|
|
82
|
+
onAction(action);
|
|
83
|
+
}}
|
|
84
|
+
>
|
|
85
|
+
{action}
|
|
86
|
+
</Button>
|
|
87
|
+
))}
|
|
88
|
+
</ChatNotificationCardContentActions>
|
|
89
|
+
)}
|
|
90
|
+
</ChatNotificationCardContent>
|
|
91
|
+
</ChatNotificationCard>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** One row of the notification centre, trimmed to the fields the popup renders. */
|
|
2
|
+
export interface NotificationSignal {
|
|
3
|
+
id: string;
|
|
4
|
+
/** The category label shown in the card header. */
|
|
5
|
+
category: 'Travel' | 'Other';
|
|
6
|
+
priority: 'Low' | 'Medium' | 'High';
|
|
7
|
+
title: string;
|
|
8
|
+
body: string;
|
|
9
|
+
/** Relative time, formatted the way the card shows it. */
|
|
10
|
+
createdAt: string;
|
|
11
|
+
isRead: boolean;
|
|
12
|
+
/** Follow-ups the assistant suggests; choosing one starts a chat with it prefilled. */
|
|
13
|
+
actions: string[];
|
|
14
|
+
}
|
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
"$schema": "../../../../int-eslint-config/schemas/component.schema.json",
|
|
3
3
|
"component": "chat-notification-popup",
|
|
4
4
|
"purpose": "Popover that opens from a trigger to show notifications over the chat, a thin wrapper around ui/popover with a fixed desktop width.",
|
|
5
|
+
"anatomy": [
|
|
6
|
+
"import {",
|
|
7
|
+
" ChatNotificationPopup,",
|
|
8
|
+
" ChatNotificationPopupTrigger,",
|
|
9
|
+
" ChatNotificationPopupContent,",
|
|
10
|
+
"} from '@swisper.ai/web-chat-ui';",
|
|
11
|
+
"",
|
|
12
|
+
"<ChatNotificationPopup>",
|
|
13
|
+
" <ChatNotificationPopupTrigger />",
|
|
14
|
+
" <ChatNotificationPopupContent />",
|
|
15
|
+
"</ChatNotificationPopup>"
|
|
16
|
+
],
|
|
5
17
|
"useWhen": [
|
|
6
18
|
"Showing the user's notifications, or a single notification card, on demand from a button in the chat chrome",
|
|
7
19
|
"The notifications should overlay the chat without taking the user away from the conversation"
|
|
@@ -40,7 +52,8 @@
|
|
|
40
52
|
"ChatNotificationPopup is uncontrolled through defaultOpen or controlled through open plus onOpenChange; onOpenChange fires on trigger click, Escape and outside click",
|
|
41
53
|
"modal=true blocks interaction with the rest of the page and traps focus while open; the default leaves the page interactive",
|
|
42
54
|
"ChatNotificationPopupContent renders in a portal, is 467px wide from md up, aligns to the trigger's start edge 8px away, and has the elevated modal paper background, a divider border and a 12px radius from ui PopoverContent",
|
|
43
|
-
"ChatNotificationPopupTrigger forwards to ui PopoverTrigger; pass asChild to use your own Button or IconButton as the trigger"
|
|
55
|
+
"ChatNotificationPopupTrigger forwards to ui PopoverTrigger; pass asChild to use your own Button or IconButton as the trigger",
|
|
56
|
+
"The trigger and the content carry data-slot=chat-notification-popup-trigger and data-slot=chat-notification-popup-content in place of ui popover's own slot names; the root renders no element"
|
|
44
57
|
]
|
|
45
58
|
},
|
|
46
59
|
"composition": {
|