@swisper.ai/web-chat-ui 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -12
- package/dist/components/canvas-shell/canvas-shell.d.ts +32 -10
- package/dist/components/canvas-shell/canvas-shell.d.ts.map +1 -1
- package/dist/components/canvas-shell/canvas-shell.stories.d.ts +49 -17
- package/dist/components/canvas-shell/canvas-shell.stories.d.ts.map +1 -1
- package/dist/components/chat-card/chat-card.d.ts +1 -0
- package/dist/components/chat-card/chat-card.d.ts.map +1 -1
- package/dist/components/chat-card/chat-card.stories.d.ts +47 -1
- package/dist/components/chat-card/chat-card.stories.d.ts.map +1 -1
- package/dist/components/chat-card/components/chat-card-body.d.ts +8 -0
- package/dist/components/chat-card/components/chat-card-body.d.ts.map +1 -1
- package/dist/components/chat-card/components/chat-card-footer.d.ts +8 -0
- package/dist/components/chat-card/components/chat-card-footer.d.ts.map +1 -1
- package/dist/components/chat-card/components/chat-card-form.d.ts +15 -2
- package/dist/components/chat-card/components/chat-card-form.d.ts.map +1 -1
- package/dist/components/chat-card/components/chat-card-header.d.ts +23 -2
- package/dist/components/chat-card/components/chat-card-header.d.ts.map +1 -1
- package/dist/components/chat-card/contexts.d.ts +2 -0
- package/dist/components/chat-card/contexts.d.ts.map +1 -1
- package/dist/components/chat-card/hooks.d.ts +1 -0
- package/dist/components/chat-card/hooks.d.ts.map +1 -1
- package/dist/components/chat-card/types.d.ts +3 -0
- package/dist/components/chat-card/types.d.ts.map +1 -1
- package/dist/components/chat-card-container/chat-card-container.d.ts +4 -0
- package/dist/components/chat-card-container/chat-card-container.d.ts.map +1 -1
- package/dist/components/chat-card-container/chat-card-container.stories.d.ts +12 -1
- package/dist/components/chat-card-container/chat-card-container.stories.d.ts.map +1 -1
- package/dist/components/chat-container/chat-container.d.ts.map +1 -1
- package/dist/components/chat-container/chat-container.stories.d.ts +36 -11
- package/dist/components/chat-container/chat-container.stories.d.ts.map +1 -1
- package/dist/components/chat-input/chat-input.d.ts +27 -2
- package/dist/components/chat-input/chat-input.d.ts.map +1 -1
- package/dist/components/chat-input/chat-input.stories.d.ts +63 -3
- package/dist/components/chat-input/chat-input.stories.d.ts.map +1 -1
- package/dist/components/chat-list/chat-list-item.d.ts +6 -0
- package/dist/components/chat-list/chat-list-item.d.ts.map +1 -1
- package/dist/components/chat-list/chat-list-items.d.ts +12 -1
- package/dist/components/chat-list/chat-list-items.d.ts.map +1 -1
- package/dist/components/chat-list/chat-list.d.ts +36 -2
- package/dist/components/chat-list/chat-list.d.ts.map +1 -1
- package/dist/components/chat-list/chat-list.stories.d.ts +67 -9
- package/dist/components/chat-list/chat-list.stories.d.ts.map +1 -1
- package/dist/components/chat-message/chat-message.d.ts +12 -1
- package/dist/components/chat-message/chat-message.d.ts.map +1 -1
- package/dist/components/chat-message/chat-message.stories.d.ts +31 -0
- package/dist/components/chat-message/chat-message.stories.d.ts.map +1 -1
- package/dist/components/chat-message/index.d.ts +1 -1
- package/dist/components/chat-message/index.d.ts.map +1 -1
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card-icon.d.ts +3 -0
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card-icon.d.ts.map +1 -1
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card.d.ts +25 -5
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card.d.ts.map +1 -1
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card.stories.d.ts +32 -1
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card.stories.d.ts.map +1 -1
- package/dist/components/chat-message-attachment-card/index.d.ts +2 -2
- package/dist/components/chat-message-attachment-card/index.d.ts.map +1 -1
- package/dist/components/chat-message-attachment-card/utils.d.ts +1 -0
- package/dist/components/chat-message-attachment-card/utils.d.ts.map +1 -1
- package/dist/components/chat-message-response/chat-message-response.stories.d.ts +13 -0
- package/dist/components/chat-message-response/chat-message-response.stories.d.ts.map +1 -1
- package/dist/components/chat-message-toolbar/chat-message-toolbar.d.ts +22 -5
- package/dist/components/chat-message-toolbar/chat-message-toolbar.d.ts.map +1 -1
- package/dist/components/chat-message-toolbar/chat-message-toolbar.stories.d.ts +42 -0
- package/dist/components/chat-message-toolbar/chat-message-toolbar.stories.d.ts.map +1 -1
- package/dist/components/chat-message-toolbar/index.d.ts +1 -1
- package/dist/components/chat-message-toolbar/index.d.ts.map +1 -1
- package/dist/components/chat-messages/chat-messages.d.ts +34 -2
- package/dist/components/chat-messages/chat-messages.d.ts.map +1 -1
- package/dist/components/chat-messages/chat-messages.stories.d.ts +33 -2
- package/dist/components/chat-messages/chat-messages.stories.d.ts.map +1 -1
- package/dist/components/chat-notification-card/chat-notification-card.d.ts +56 -4
- package/dist/components/chat-notification-card/chat-notification-card.d.ts.map +1 -1
- package/dist/components/chat-notification-card/chat-notification-card.stories.d.ts +50 -1
- package/dist/components/chat-notification-card/chat-notification-card.stories.d.ts.map +1 -1
- package/dist/components/chat-notification-popup/chat-notification-popup.d.ts +6 -0
- package/dist/components/chat-notification-popup/chat-notification-popup.d.ts.map +1 -1
- package/dist/components/chat-notification-popup/chat-notification-popup.stories.d.ts +43 -1
- package/dist/components/chat-notification-popup/chat-notification-popup.stories.d.ts.map +1 -1
- package/dist/components/chat-prompt-box/chat-prompt-box.d.ts +37 -17
- package/dist/components/chat-prompt-box/chat-prompt-box.d.ts.map +1 -1
- package/dist/components/chat-prompt-box/chat-prompt-box.stories.d.ts +53 -1
- package/dist/components/chat-prompt-box/chat-prompt-box.stories.d.ts.map +1 -1
- package/dist/components/chat-reply/chat-reply.d.ts +11 -0
- package/dist/components/chat-reply/chat-reply.d.ts.map +1 -1
- package/dist/components/chat-reply/chat-reply.stories.d.ts +23 -0
- package/dist/components/chat-reply/chat-reply.stories.d.ts.map +1 -1
- package/dist/components/chat-reply/index.d.ts +1 -1
- package/dist/components/chat-reply/index.d.ts.map +1 -1
- package/dist/components/chat-suggestion/chat-suggestion.d.ts +36 -10
- package/dist/components/chat-suggestion/chat-suggestion.d.ts.map +1 -1
- package/dist/components/chat-suggestion/chat-suggestion.stories.d.ts +66 -2
- package/dist/components/chat-suggestion/chat-suggestion.stories.d.ts.map +1 -1
- package/dist/components/chat-suggestion/index.d.ts +2 -1
- package/dist/components/chat-suggestion/index.d.ts.map +1 -1
- package/dist/components/chat-thinking-process/chat-thinking-process.d.ts +26 -1
- package/dist/components/chat-thinking-process/chat-thinking-process.d.ts.map +1 -1
- package/dist/components/chat-thinking-process/chat-thinking-process.stories.d.ts +25 -1
- package/dist/components/chat-thinking-process/chat-thinking-process.stories.d.ts.map +1 -1
- package/dist/components/chat-thread/chat-thread.d.ts +17 -2
- package/dist/components/chat-thread/chat-thread.d.ts.map +1 -1
- package/dist/components/chat-thread/chat-thread.stories.d.ts +75 -10
- package/dist/components/chat-thread/chat-thread.stories.d.ts.map +1 -1
- package/dist/components/index.d.ts +1 -3
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/markdown-viewer/markdown-viewer.d.ts +8 -1
- package/dist/components/markdown-viewer/markdown-viewer.d.ts.map +1 -1
- package/dist/components/markdown-viewer/markdown-viewer.stories.d.ts +18 -1
- package/dist/components/markdown-viewer/markdown-viewer.stories.d.ts.map +1 -1
- package/dist/components/rich-text-area/rich-text-area.d.ts +17 -0
- package/dist/components/rich-text-area/rich-text-area.d.ts.map +1 -1
- package/dist/components/rich-text-area/rich-text-area.stories.d.ts +52 -0
- package/dist/components/rich-text-area/rich-text-area.stories.d.ts.map +1 -1
- package/dist/components/rich-text-area/styled.d.ts +6 -2
- package/dist/components/rich-text-area/styled.d.ts.map +1 -1
- package/dist/components/rich-text-field/components/formatting-toolbar-plugin.d.ts +9 -2
- package/dist/components/rich-text-field/components/formatting-toolbar-plugin.d.ts.map +1 -1
- package/dist/components/rich-text-field/components/index.d.ts +5 -5
- package/dist/components/rich-text-field/components/index.d.ts.map +1 -1
- package/dist/components/rich-text-field/components/text-color-button.d.ts +12 -1
- package/dist/components/rich-text-field/components/text-color-button.d.ts.map +1 -1
- package/dist/components/rich-text-field/rich-text-field.d.ts +22 -0
- package/dist/components/rich-text-field/rich-text-field.d.ts.map +1 -1
- package/dist/components/rich-text-field/rich-text-field.stories.d.ts +28 -1
- package/dist/components/rich-text-field/rich-text-field.stories.d.ts.map +1 -1
- package/dist/components/topmenu/index.d.ts +2 -0
- package/dist/components/topmenu/index.d.ts.map +1 -0
- package/dist/components/topmenu/topmenu.d.ts +22 -0
- package/dist/components/topmenu/topmenu.d.ts.map +1 -0
- package/dist/components/topmenu/topmenu.stories.d.ts +31 -0
- package/dist/components/topmenu/topmenu.stories.d.ts.map +1 -0
- package/dist/docs/agent.stories.d.ts.map +1 -1
- package/dist/docs/chat-panel.d.ts +7 -5
- package/dist/docs/chat-panel.d.ts.map +1 -1
- package/dist/docs/chatbot-panel.d.ts.map +1 -1
- package/dist/docs/chatbot.stories.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.es.js +1227 -1260
- package/dist/index.es.js.map +1 -1
- package/dist/layouts/chat-card-list-layout/chat-card-list-layout.d.ts +9 -7
- package/dist/layouts/chat-card-list-layout/chat-card-list-layout.d.ts.map +1 -1
- package/dist/layouts/chat-card-list-layout/chat-card-list-layout.stories.d.ts +37 -9
- package/dist/layouts/chat-card-list-layout/chat-card-list-layout.stories.d.ts.map +1 -1
- package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.stories.d.ts +41 -16
- package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.stories.d.ts.map +1 -1
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.d.ts +6 -0
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.d.ts.map +1 -1
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.stories.d.ts +22 -1
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.stories.d.ts.map +1 -1
- package/package.json +15 -9
- package/src/__storybook__/parent-block.tsx +21 -0
- package/src/components/canvas-shell/__stories__/canvas-panel.tsx +25 -0
- package/src/components/canvas-shell/__stories__/document-list.tsx +29 -0
- package/src/components/canvas-shell/__stories__/fixtures.ts +222 -0
- package/src/components/canvas-shell/__stories__/holdings-table.tsx +56 -0
- package/src/components/canvas-shell/__stories__/types.ts +47 -0
- package/src/components/canvas-shell/{canvas-shell.test.tsx → __tests__/canvas-shell.spec.tsx} +1 -1
- package/src/components/canvas-shell/canvas-shell.json +24 -0
- package/src/components/canvas-shell/canvas-shell.stories.tsx +581 -122
- package/src/components/canvas-shell/canvas-shell.tsx +44 -17
- package/src/components/chat-card/__stories__/fixtures.ts +119 -0
- package/src/components/chat-card/__stories__/types.ts +44 -0
- package/src/components/chat-card/chat-card.json +67 -3
- package/src/components/chat-card/chat-card.stories.tsx +872 -148
- package/src/components/chat-card/chat-card.tsx +2 -0
- package/src/components/chat-card/components/chat-card-body.tsx +12 -0
- package/src/components/chat-card/components/chat-card-footer.tsx +11 -0
- package/src/components/chat-card/components/chat-card-form.tsx +21 -2
- package/src/components/chat-card/components/chat-card-header.tsx +39 -2
- package/src/components/chat-card/contexts.tsx +2 -0
- package/src/components/chat-card/hooks.ts +1 -0
- package/src/components/chat-card/types.ts +3 -0
- package/src/components/chat-card-container/__stories__/fixtures.ts +54 -0
- package/src/components/chat-card-container/__stories__/resizable-chat-window.tsx +19 -0
- package/src/components/chat-card-container/__stories__/result-card.tsx +31 -0
- package/src/components/chat-card-container/__stories__/types.ts +16 -0
- package/src/components/chat-card-container/chat-card-container.json +7 -0
- package/src/components/chat-card-container/chat-card-container.stories.tsx +209 -56
- package/src/components/chat-card-container/chat-card-container.tsx +5 -0
- package/src/components/chat-container/__stories__/chat-composer.tsx +67 -0
- package/src/components/chat-container/__stories__/fixtures.ts +27 -0
- package/src/components/chat-container/__stories__/measure.ts +22 -0
- package/src/components/chat-container/__stories__/types.ts +7 -0
- package/src/components/chat-container/__stories__/variable-readout.tsx +64 -0
- package/src/components/chat-container/chat-container.json +9 -1
- package/src/components/chat-container/chat-container.stories.tsx +538 -106
- package/src/components/chat-container/chat-container.tsx +3 -0
- package/src/components/chat-input/__stories__/fixtures.ts +31 -0
- package/src/components/chat-input/chat-input.json +10 -2
- package/src/components/chat-input/chat-input.stories.tsx +660 -197
- package/src/components/chat-input/chat-input.tsx +32 -2
- package/src/components/chat-list/__stories__/chat-row.tsx +41 -0
- package/src/components/chat-list/__stories__/fixtures.ts +94 -0
- package/src/components/chat-list/__stories__/types.ts +13 -0
- package/src/components/chat-list/chat-list-item.tsx +6 -0
- package/src/components/chat-list/chat-list-items.tsx +16 -0
- package/src/components/chat-list/chat-list.json +24 -2
- package/src/components/chat-list/chat-list.stories.tsx +631 -215
- package/src/components/chat-list/chat-list.tsx +51 -4
- package/src/components/chat-message/__stories__/fixtures.ts +53 -0
- package/src/components/chat-message/__stories__/sent-attachment.tsx +22 -0
- package/src/components/chat-message/__stories__/tool-steps.tsx +37 -0
- package/src/components/chat-message/chat-message.json +10 -1
- package/src/components/chat-message/chat-message.stories.tsx +282 -20
- package/src/components/chat-message/chat-message.tsx +16 -1
- package/src/components/chat-message/index.ts +8 -1
- package/src/components/chat-message-attachment-card/__stories__/fixtures.ts +30 -0
- package/src/components/chat-message-attachment-card/__stories__/types.ts +14 -0
- package/src/components/chat-message-attachment-card/chat-message-attachment-card-icon.tsx +4 -0
- package/src/components/chat-message-attachment-card/chat-message-attachment-card.json +20 -0
- package/src/components/chat-message-attachment-card/chat-message-attachment-card.stories.tsx +266 -51
- package/src/components/chat-message-attachment-card/chat-message-attachment-card.tsx +37 -4
- package/src/components/chat-message-attachment-card/index.ts +6 -0
- package/src/components/chat-message-attachment-card/utils.ts +1 -0
- package/src/components/chat-message-response/__stories__/fixtures.ts +50 -0
- package/src/components/chat-message-response/chat-message-response.json +5 -0
- package/src/components/chat-message-response/chat-message-response.stories.tsx +135 -26
- package/src/components/chat-message-toolbar/chat-message-toolbar.json +21 -3
- package/src/components/chat-message-toolbar/chat-message-toolbar.stories.tsx +377 -6
- package/src/components/chat-message-toolbar/chat-message-toolbar.tsx +47 -12
- package/src/components/chat-message-toolbar/index.ts +4 -0
- package/src/components/chat-messages/__stories__/conversation-frame.tsx +25 -0
- package/src/components/chat-messages/__stories__/conversation-group.tsx +22 -0
- package/src/components/chat-messages/__stories__/fixtures.ts +70 -0
- package/src/components/chat-messages/__stories__/types.ts +5 -0
- package/src/components/chat-messages/chat-messages.json +30 -12
- package/src/components/chat-messages/chat-messages.stories.tsx +439 -212
- package/src/components/chat-messages/chat-messages.tsx +46 -3
- package/src/components/chat-notification-card/__stories__/fixtures.ts +38 -0
- package/src/components/chat-notification-card/__stories__/types.ts +13 -0
- package/src/components/chat-notification-card/chat-notification-card.json +52 -2
- package/src/components/chat-notification-card/chat-notification-card.stories.tsx +542 -62
- package/src/components/chat-notification-card/chat-notification-card.tsx +97 -6
- package/src/components/chat-notification-popup/__stories__/fixtures.ts +36 -0
- package/src/components/chat-notification-popup/__stories__/notification-item.tsx +93 -0
- package/src/components/chat-notification-popup/__stories__/types.ts +14 -0
- package/src/components/chat-notification-popup/chat-notification-popup.json +14 -1
- package/src/components/chat-notification-popup/chat-notification-popup.stories.tsx +467 -17
- package/src/components/chat-notification-popup/chat-notification-popup.tsx +18 -3
- package/src/components/chat-prompt-box/__stories__/fixtures.ts +16 -0
- package/src/components/chat-prompt-box/__stories__/types.ts +8 -0
- package/src/components/chat-prompt-box/chat-prompt-box.json +25 -2
- package/src/components/chat-prompt-box/chat-prompt-box.stories.tsx +535 -43
- package/src/components/chat-prompt-box/chat-prompt-box.tsx +73 -19
- package/src/components/chat-reply/chat-reply.json +10 -0
- package/src/components/chat-reply/chat-reply.stories.tsx +264 -21
- package/src/components/chat-reply/chat-reply.tsx +15 -0
- package/src/components/chat-reply/index.ts +10 -1
- package/src/components/chat-suggestion/__stories__/fixtures.ts +16 -0
- package/src/components/chat-suggestion/__tests__/chat-suggestion.spec.tsx +185 -0
- package/src/components/chat-suggestion/chat-suggestion.json +62 -20
- package/src/components/chat-suggestion/chat-suggestion.stories.tsx +542 -58
- package/src/components/chat-suggestion/chat-suggestion.tsx +154 -65
- package/src/components/chat-suggestion/index.ts +9 -0
- package/src/components/chat-thinking-process/__stories__/fixtures.ts +56 -0
- package/src/components/chat-thinking-process/chat-thinking-process.json +28 -3
- package/src/components/chat-thinking-process/chat-thinking-process.stories.tsx +354 -78
- package/src/components/chat-thinking-process/chat-thinking-process.tsx +55 -4
- package/src/components/chat-thread/__stories__/fixtures.ts +171 -0
- package/src/components/chat-thread/__stories__/scroll-position.ts +9 -0
- package/src/components/chat-thread/__stories__/snippets.ts +129 -0
- package/src/components/chat-thread/__stories__/thread-frame.tsx +22 -0
- package/src/components/chat-thread/__stories__/thread-turns.tsx +35 -0
- package/src/components/chat-thread/__stories__/types.ts +12 -0
- package/src/components/chat-thread/__stories__/use-turn-stream.ts +78 -0
- package/src/components/chat-thread/chat-thread.json +23 -3
- package/src/components/chat-thread/chat-thread.stories.tsx +804 -142
- package/src/components/chat-thread/chat-thread.tsx +64 -16
- package/src/components/index.ts +1 -3
- package/src/components/markdown-viewer/__stories__/fixtures.ts +67 -0
- package/src/components/markdown-viewer/markdown-viewer.json +7 -1
- package/src/components/markdown-viewer/markdown-viewer.stories.tsx +219 -50
- package/src/components/markdown-viewer/markdown-viewer.tsx +9 -0
- package/src/components/rich-text-area/__stories__/fixtures.ts +30 -0
- package/src/components/rich-text-area/rich-text-area.json +6 -4
- package/src/components/rich-text-area/rich-text-area.stories.tsx +597 -41
- package/src/components/rich-text-area/rich-text-area.tsx +22 -1
- package/src/components/rich-text-area/styled.tsx +11 -5
- package/src/components/rich-text-field/__stories__/fixtures.ts +29 -0
- package/src/components/rich-text-field/components/formatting-toolbar-plugin.tsx +10 -1
- package/src/components/rich-text-field/components/index.ts +8 -5
- package/src/components/rich-text-field/components/text-color-button.tsx +16 -2
- package/src/components/rich-text-field/rich-text-field.json +3 -1
- package/src/components/rich-text-field/rich-text-field.stories.tsx +452 -61
- package/src/components/rich-text-field/rich-text-field.tsx +23 -0
- package/src/components/topmenu/index.ts +1 -0
- package/src/components/topmenu/topmenu.json +107 -0
- package/src/components/topmenu/topmenu.stories.tsx +334 -0
- package/src/components/topmenu/topmenu.tsx +71 -0
- package/src/docs/agent.stories.tsx +16 -16
- package/src/docs/chat-panel.tsx +37 -32
- package/src/docs/chatbot-panel.tsx +11 -2
- package/src/docs/chatbot.mdx +17 -12
- package/src/docs/chatbot.stories.tsx +7 -8
- package/src/layouts/chat-card-list-layout/__stories__/fixtures.ts +112 -0
- package/src/layouts/chat-card-list-layout/__stories__/result-card.tsx +36 -0
- package/src/layouts/chat-card-list-layout/__stories__/types.ts +31 -0
- package/src/layouts/chat-card-list-layout/chat-card-list-layout.json +14 -1
- package/src/layouts/chat-card-list-layout/chat-card-list-layout.stories.tsx +316 -84
- package/src/layouts/chat-card-list-layout/chat-card-list-layout.tsx +11 -7
- package/src/layouts/chat-card-three-column-layout/__stories__/fixtures.ts +117 -0
- package/src/layouts/chat-card-three-column-layout/__stories__/resizable-chat-window.tsx +18 -0
- package/src/layouts/chat-card-three-column-layout/__stories__/stay-details.tsx +85 -0
- package/src/layouts/chat-card-three-column-layout/__stories__/stay-list.tsx +50 -0
- package/src/layouts/chat-card-three-column-layout/__stories__/stay-map.tsx +44 -0
- package/src/layouts/chat-card-three-column-layout/__stories__/stay-rooms.tsx +61 -0
- package/src/layouts/chat-card-three-column-layout/__stories__/types.ts +35 -0
- package/src/layouts/chat-card-three-column-layout/chat-card-three-column-layout.json +16 -0
- package/src/layouts/chat-card-three-column-layout/chat-card-three-column-layout.stories.tsx +603 -182
- package/src/layouts/chat-card-two-column-layout/__stories__/connection-itinerary.tsx +51 -0
- package/src/layouts/chat-card-two-column-layout/__stories__/fixtures.ts +83 -0
- package/src/layouts/chat-card-two-column-layout/__stories__/route-map.tsx +24 -0
- package/src/layouts/chat-card-two-column-layout/__stories__/types.ts +15 -0
- package/src/layouts/chat-card-two-column-layout/chat-card-two-column-layout.json +13 -1
- package/src/layouts/chat-card-two-column-layout/chat-card-two-column-layout.stories.tsx +368 -67
- package/src/layouts/chat-card-two-column-layout/chat-card-two-column-layout.tsx +11 -2
- package/dist/components/card-item-picker/card-item-picker-context.d.ts +0 -21
- package/dist/components/card-item-picker/card-item-picker-context.d.ts.map +0 -1
- package/dist/components/card-item-picker/card-item-picker-list.d.ts +0 -24
- package/dist/components/card-item-picker/card-item-picker-list.d.ts.map +0 -1
- package/dist/components/card-item-picker/card-item-picker-row-parts.d.ts +0 -28
- package/dist/components/card-item-picker/card-item-picker-row-parts.d.ts.map +0 -1
- package/dist/components/card-item-picker/card-item-picker-row.d.ts +0 -12
- package/dist/components/card-item-picker/card-item-picker-row.d.ts.map +0 -1
- package/dist/components/card-item-picker/card-item-picker.stories.d.ts +0 -19
- package/dist/components/card-item-picker/card-item-picker.stories.d.ts.map +0 -1
- package/dist/components/card-item-picker/index.d.ts +0 -9
- package/dist/components/card-item-picker/index.d.ts.map +0 -1
- package/dist/components/chat-message-history/chat-message-history.d.ts +0 -48
- package/dist/components/chat-message-history/chat-message-history.d.ts.map +0 -1
- package/dist/components/chat-message-history/chat-message-history.stories.d.ts +0 -7
- package/dist/components/chat-message-history/chat-message-history.stories.d.ts.map +0 -1
- package/dist/components/chat-message-history/index.d.ts +0 -2
- package/dist/components/chat-message-history/index.d.ts.map +0 -1
- package/dist/components/spinner/index.d.ts +0 -2
- package/dist/components/spinner/index.d.ts.map +0 -1
- package/dist/components/spinner/spinner.d.ts +0 -9
- package/dist/components/spinner/spinner.d.ts.map +0 -1
- package/dist/components/spinner/spinner.stories.d.ts +0 -8
- package/dist/components/spinner/spinner.stories.d.ts.map +0 -1
- package/src/components/card-item-picker/__tests__/card-item-picker.spec.tsx +0 -279
- package/src/components/card-item-picker/card-item-picker-context.tsx +0 -44
- package/src/components/card-item-picker/card-item-picker-list.tsx +0 -95
- package/src/components/card-item-picker/card-item-picker-row-parts.tsx +0 -96
- package/src/components/card-item-picker/card-item-picker-row.tsx +0 -109
- package/src/components/card-item-picker/card-item-picker.json +0 -147
- package/src/components/card-item-picker/card-item-picker.stories.tsx +0 -158
- package/src/components/card-item-picker/index.ts +0 -24
- package/src/components/chat-message-history/chat-message-history.json +0 -99
- package/src/components/chat-message-history/chat-message-history.stories.tsx +0 -136
- package/src/components/chat-message-history/chat-message-history.tsx +0 -277
- package/src/components/chat-message-history/index.ts +0 -13
- package/src/components/spinner/index.ts +0 -1
- package/src/components/spinner/spinner.json +0 -73
- package/src/components/spinner/spinner.stories.tsx +0 -41
- package/src/components/spinner/spinner.tsx +0 -32
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
2
|
-
import { createContext, memo, useContext, useMemo, type ReactNode } from 'react';
|
|
3
|
-
import { StickToBottom, useStickToBottom, type ScrollToBottom } from 'use-stick-to-bottom';
|
|
4
|
-
|
|
5
|
-
import { ChevronDownIcon } from '@swisper.ai/icons';
|
|
6
|
-
import { IconButton, Tooltip } from '@swisper.ai/ui';
|
|
7
|
-
import { cn } from '@swisper.ai/web-core';
|
|
8
|
-
|
|
9
|
-
interface ChatMessageHistoryContextValue {
|
|
10
|
-
isCurrentScrollBottom: boolean;
|
|
11
|
-
isLoading: boolean;
|
|
12
|
-
isEmpty: boolean;
|
|
13
|
-
hasError: boolean;
|
|
14
|
-
scrollToLastMessage: ScrollToBottom;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const ChatMessageHistoryContext = createContext<ChatMessageHistoryContextValue>(null!);
|
|
18
|
-
|
|
19
|
-
export function useChatMessageHistoryContext() {
|
|
20
|
-
const context = useContext(ChatMessageHistoryContext);
|
|
21
|
-
|
|
22
|
-
if (!context) {
|
|
23
|
-
throw new Error(
|
|
24
|
-
'"useChatMessageHistoryContext" must be used within a ChatMessageHistoryContextProvider',
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return context;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface ChatMessageHistoryProps {
|
|
32
|
-
children: ReactNode;
|
|
33
|
-
className?: string;
|
|
34
|
-
totalMessages: number;
|
|
35
|
-
isLoading?: boolean;
|
|
36
|
-
hasError?: boolean;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export function ChatMessageHistory({
|
|
40
|
-
children,
|
|
41
|
-
className,
|
|
42
|
-
totalMessages,
|
|
43
|
-
isLoading = false,
|
|
44
|
-
hasError = false,
|
|
45
|
-
}: ChatMessageHistoryProps) {
|
|
46
|
-
const isEmpty = totalMessages === 0;
|
|
47
|
-
|
|
48
|
-
const {
|
|
49
|
-
contentRef,
|
|
50
|
-
scrollRef,
|
|
51
|
-
isAtBottom: isCurrentScrollBottom,
|
|
52
|
-
scrollToBottom: scrollToLastMessage,
|
|
53
|
-
} = useStickToBottom();
|
|
54
|
-
|
|
55
|
-
const contextValue = useMemo<ChatMessageHistoryContextValue>(
|
|
56
|
-
() => ({
|
|
57
|
-
isCurrentScrollBottom,
|
|
58
|
-
isLoading,
|
|
59
|
-
isEmpty,
|
|
60
|
-
hasError,
|
|
61
|
-
scrollToLastMessage,
|
|
62
|
-
}),
|
|
63
|
-
[isCurrentScrollBottom, isLoading, isEmpty, hasError, scrollToLastMessage],
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
<ChatMessageHistoryContext.Provider value={contextValue}>
|
|
68
|
-
<StickToBottom
|
|
69
|
-
data-testid="chat-message-history"
|
|
70
|
-
className={cn('flex', className)}
|
|
71
|
-
initial="instant"
|
|
72
|
-
resize="instant"
|
|
73
|
-
aria-label="Chat message history"
|
|
74
|
-
data-loading={isLoading}
|
|
75
|
-
data-empty={isEmpty}
|
|
76
|
-
data-error={hasError}
|
|
77
|
-
>
|
|
78
|
-
<ScrollAreaPrimitive.Root
|
|
79
|
-
className={cn(
|
|
80
|
-
'flex-1',
|
|
81
|
-
'relative group/scroll-area',
|
|
82
|
-
'overflow-y-hidden',
|
|
83
|
-
'transform-gpu',
|
|
84
|
-
)}
|
|
85
|
-
>
|
|
86
|
-
<ScrollAreaPrimitive.Viewport
|
|
87
|
-
ref={scrollRef}
|
|
88
|
-
className={cn('will-change-scroll')}
|
|
89
|
-
style={{
|
|
90
|
-
height: '100%',
|
|
91
|
-
width: '100%',
|
|
92
|
-
scrollbarGutter: 'stable both-edges',
|
|
93
|
-
}}
|
|
94
|
-
>
|
|
95
|
-
<div ref={contentRef}>{children}</div>
|
|
96
|
-
</ScrollAreaPrimitive.Viewport>
|
|
97
|
-
|
|
98
|
-
<ChatMessageHistoryScrollBar orientation="vertical" />
|
|
99
|
-
</ScrollAreaPrimitive.Root>
|
|
100
|
-
</StickToBottom>
|
|
101
|
-
</ChatMessageHistoryContext.Provider>
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export interface ChatMessageHistoryListProps {
|
|
106
|
-
children: ReactNode;
|
|
107
|
-
className?: string;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export const ChatMessageHistoryList = memo(function ChatMessageHistoryList({
|
|
111
|
-
children,
|
|
112
|
-
className,
|
|
113
|
-
}: ChatMessageHistoryListProps) {
|
|
114
|
-
return (
|
|
115
|
-
<ul
|
|
116
|
-
data-testid="chat-message-history-list"
|
|
117
|
-
role="log"
|
|
118
|
-
aria-label="Message list"
|
|
119
|
-
aria-atomic="false"
|
|
120
|
-
className={cn('flex flex-col p-0 m-0', 'relative gap-16', className)}
|
|
121
|
-
>
|
|
122
|
-
{children}
|
|
123
|
-
</ul>
|
|
124
|
-
);
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
export interface ChatMessageHistoryEmptyStateProps {
|
|
128
|
-
children?: ReactNode;
|
|
129
|
-
className?: string;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export function ChatMessageHistoryEmptyState({
|
|
133
|
-
children,
|
|
134
|
-
className,
|
|
135
|
-
}: ChatMessageHistoryEmptyStateProps) {
|
|
136
|
-
const { hasError, isLoading } = useChatMessageHistoryContext();
|
|
137
|
-
|
|
138
|
-
if (!hasError && !isLoading) {
|
|
139
|
-
return null;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
return (
|
|
143
|
-
<div
|
|
144
|
-
data-testid="chat-message-history-empty-state"
|
|
145
|
-
role="status"
|
|
146
|
-
aria-live="polite"
|
|
147
|
-
aria-label="No messages"
|
|
148
|
-
className={cn('flex-1 flex items-center justify-center', className)}
|
|
149
|
-
>
|
|
150
|
-
{children}
|
|
151
|
-
</div>
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
export interface ChatMessageHistoryErrorStateProps {
|
|
156
|
-
children?: ReactNode;
|
|
157
|
-
error?: Error | string;
|
|
158
|
-
className?: string;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
export function ChatMessageHistoryErrorState({
|
|
162
|
-
children,
|
|
163
|
-
error,
|
|
164
|
-
className,
|
|
165
|
-
}: ChatMessageHistoryErrorStateProps) {
|
|
166
|
-
const { hasError, isLoading } = useChatMessageHistoryContext();
|
|
167
|
-
|
|
168
|
-
if (hasError && !isLoading) {
|
|
169
|
-
return null;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
return (
|
|
173
|
-
<div
|
|
174
|
-
data-testid="chat-message-history-error-state"
|
|
175
|
-
role="alert"
|
|
176
|
-
aria-live="assertive"
|
|
177
|
-
aria-label="Error loading messages"
|
|
178
|
-
className={cn('flex-1 flex items-center justify-center', className)}
|
|
179
|
-
>
|
|
180
|
-
{children || (
|
|
181
|
-
<div className="text-text-error-main">
|
|
182
|
-
{error instanceof Error ? error.message : error || 'An error occurred'}
|
|
183
|
-
</div>
|
|
184
|
-
)}
|
|
185
|
-
</div>
|
|
186
|
-
);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
export interface ChatMessageHistoryScrollButtonProps {
|
|
190
|
-
className?: string;
|
|
191
|
-
tooltip?: string;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
export const ChatMessageHistoryScrollButton = memo(function ChatMessageHistoryScrollButton({
|
|
195
|
-
className,
|
|
196
|
-
tooltip,
|
|
197
|
-
}: ChatMessageHistoryScrollButtonProps) {
|
|
198
|
-
const { isCurrentScrollBottom, scrollToLastMessage } = useChatMessageHistoryContext();
|
|
199
|
-
|
|
200
|
-
return (
|
|
201
|
-
<div
|
|
202
|
-
data-testid="chat-message-history-scroll-button"
|
|
203
|
-
data-hidden={isCurrentScrollBottom}
|
|
204
|
-
aria-hidden={isCurrentScrollBottom ? true : undefined}
|
|
205
|
-
className={cn(
|
|
206
|
-
'absolute',
|
|
207
|
-
'px-[12px]',
|
|
208
|
-
'bottom-0',
|
|
209
|
-
'right-0 -translate-x-[12px]',
|
|
210
|
-
'md:right-auto md:left-1/2 md:-translate-x-1/2',
|
|
211
|
-
'-translate-y-[12px]',
|
|
212
|
-
'flex items-center justify-center',
|
|
213
|
-
'transition-opacity duration-200 ease-in-out',
|
|
214
|
-
'data-[hidden=true]:pointer-events-none',
|
|
215
|
-
'data-[hidden=true]:opacity-0 data-[hidden=false]:opacity-100',
|
|
216
|
-
className,
|
|
217
|
-
)}
|
|
218
|
-
>
|
|
219
|
-
<Tooltip tooltip={tooltip} side={'top'}>
|
|
220
|
-
<IconButton
|
|
221
|
-
className="bg-paper-elevation-2"
|
|
222
|
-
color="primary"
|
|
223
|
-
size="md"
|
|
224
|
-
onClick={() => scrollToLastMessage()}
|
|
225
|
-
tabIndex={-1}
|
|
226
|
-
aria-label={tooltip}
|
|
227
|
-
>
|
|
228
|
-
<ChevronDownIcon />
|
|
229
|
-
</IconButton>
|
|
230
|
-
</Tooltip>
|
|
231
|
-
</div>
|
|
232
|
-
);
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
interface ChatMessageHistoryScrollBarProps extends React.ComponentProps<
|
|
236
|
-
typeof ScrollAreaPrimitive.ScrollAreaScrollbar
|
|
237
|
-
> {
|
|
238
|
-
className?: string;
|
|
239
|
-
orientation?: 'vertical' | 'horizontal';
|
|
240
|
-
children?: ReactNode;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
export function ChatMessageHistoryScrollBar({
|
|
244
|
-
className,
|
|
245
|
-
orientation = 'vertical',
|
|
246
|
-
...rest
|
|
247
|
-
}: ChatMessageHistoryScrollBarProps) {
|
|
248
|
-
return (
|
|
249
|
-
<ScrollAreaPrimitive.ScrollAreaScrollbar
|
|
250
|
-
data-slot="scroll-area-scrollbar"
|
|
251
|
-
orientation={orientation}
|
|
252
|
-
className={cn(
|
|
253
|
-
'opacity-0 group-hover/scroll-area:opacity-100',
|
|
254
|
-
'rounded-[8px]',
|
|
255
|
-
'bg-scrollbar-track hover:bg-scrollbar-track-hover',
|
|
256
|
-
'transition-opacity duration-200 ease-in-out',
|
|
257
|
-
'flextouch-none select-none transition-colors',
|
|
258
|
-
orientation === 'vertical' &&
|
|
259
|
-
'h-full w-scrollbar border-l border-l-transparent px-4 py-[12px]',
|
|
260
|
-
orientation === 'horizontal' &&
|
|
261
|
-
'h-scrollbar w-full border-t border-t-transparent px-[12px] py-4',
|
|
262
|
-
className,
|
|
263
|
-
)}
|
|
264
|
-
{...rest}
|
|
265
|
-
>
|
|
266
|
-
<ScrollAreaPrimitive.ScrollAreaThumb
|
|
267
|
-
data-slot="scroll-area-thumb"
|
|
268
|
-
className={cn(
|
|
269
|
-
'relative flex-1 rounded-full',
|
|
270
|
-
'bg-scrollbar-thumb hover:bg-scrollbar-thumb-hover',
|
|
271
|
-
orientation === 'vertical' && 'w-scrollbar-thumb!',
|
|
272
|
-
orientation === 'horizontal' && 'h-scrollbar-thumb!',
|
|
273
|
-
)}
|
|
274
|
-
/>
|
|
275
|
-
</ScrollAreaPrimitive.ScrollAreaScrollbar>
|
|
276
|
-
);
|
|
277
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export {
|
|
2
|
-
useChatMessageHistoryContext,
|
|
3
|
-
ChatMessageHistory,
|
|
4
|
-
ChatMessageHistoryEmptyState,
|
|
5
|
-
ChatMessageHistoryErrorState,
|
|
6
|
-
ChatMessageHistoryList,
|
|
7
|
-
ChatMessageHistoryScrollButton,
|
|
8
|
-
type ChatMessageHistoryProps,
|
|
9
|
-
type ChatMessageHistoryEmptyStateProps,
|
|
10
|
-
type ChatMessageHistoryErrorStateProps,
|
|
11
|
-
type ChatMessageHistoryListProps,
|
|
12
|
-
type ChatMessageHistoryScrollButtonProps,
|
|
13
|
-
} from './chat-message-history';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './spinner';
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "../../../../int-eslint-config/schemas/component.schema.json",
|
|
3
|
-
"component": "spinner",
|
|
4
|
-
"purpose": "Animated Lottie loading indicator in four fixed sizes, from an inline 16px mark to a 96px full-panel loading state.",
|
|
5
|
-
"useWhen": [
|
|
6
|
-
"Something is loading and its final layout is unknown, so a placeholder shape can't stand in for it",
|
|
7
|
-
"A full panel or canvas is waiting for its first content (size xl)",
|
|
8
|
-
"A short inline wait next to a status text (size sm or md)"
|
|
9
|
-
],
|
|
10
|
-
"avoidWhen": [
|
|
11
|
-
"The layout of the content that is loading is known — use ui/skeleton in its shape",
|
|
12
|
-
"A button's own action is running — use the loading state of ui/button",
|
|
13
|
-
"The assistant is reasoning or calling tools before an answer — use web-chat-ui/chat-thinking-process"
|
|
14
|
-
],
|
|
15
|
-
"uxPrinciples": [
|
|
16
|
-
"A spinner says only 'wait': pair it with text saying what is loading when the wait is more than a moment.",
|
|
17
|
-
"One spinner per region — several spinning at once read as a broken page."
|
|
18
|
-
],
|
|
19
|
-
"accessibility": {
|
|
20
|
-
"required": [
|
|
21
|
-
"The spinner has no role, label or live region and announces nothing; put it inside, or next to, an element with role=status and a visible or visually hidden text ('Loading documents…')",
|
|
22
|
-
"Remove it (and update the status text) when loading ends, so assistive tech hears the change"
|
|
23
|
-
],
|
|
24
|
-
"keyboard": ["Not interactive and never focusable"],
|
|
25
|
-
"aria": ["No ARIA attributes; the status semantics belong to the consumer's wrapper"],
|
|
26
|
-
"focus": ["No focus behaviour; it ignores pointer events"]
|
|
27
|
-
},
|
|
28
|
-
"behaviour": {
|
|
29
|
-
"states": ["playing (looping)", "still (first frame)"],
|
|
30
|
-
"rules": [
|
|
31
|
-
"size sets the box: sm is 16px, md 24px, lg 32px, xl 96px for a full-panel loading state",
|
|
32
|
-
"autoplay=true plays and loops the animation; false shows a still first frame",
|
|
33
|
-
"The animation is fetched at runtime from lottie.host (SOURCE_ANIMATION), so the host app's CSP and network must allow that origin, and the box is empty until it loads",
|
|
34
|
-
"It renders an inline-flex box with pointer-events disabled and takes no className or other props, so place and space it with its wrapper"
|
|
35
|
-
]
|
|
36
|
-
},
|
|
37
|
-
"composition": {
|
|
38
|
-
"allowedParents": [],
|
|
39
|
-
"allowedChildren": [],
|
|
40
|
-
"avoidCombinations": [
|
|
41
|
-
"Spinner and ui/skeleton for the same region at once — pick one loading pattern",
|
|
42
|
-
"Spinner over stale content — remove or replace the content while it reloads"
|
|
43
|
-
],
|
|
44
|
-
"contexts": ["centre of an empty panel or canvas", "inline beside a status line"]
|
|
45
|
-
},
|
|
46
|
-
"content": {
|
|
47
|
-
"labelRules": [
|
|
48
|
-
"The status text next to it names what is loading, in sentence case with an ellipsis ('Loading documents…')"
|
|
49
|
-
],
|
|
50
|
-
"helperTextRules": [],
|
|
51
|
-
"errorRules": [
|
|
52
|
-
"When loading fails, replace the spinner with an error message and a retry action — never leave it spinning"
|
|
53
|
-
]
|
|
54
|
-
},
|
|
55
|
-
"aiDecisionRules": [
|
|
56
|
-
{
|
|
57
|
-
"condition": "The shape of the loading content is known (a list, a card, a paragraph)",
|
|
58
|
-
"decision": "Use ui/skeleton instead of Spinner",
|
|
59
|
-
"reason": "A skeleton keeps the layout stable and shows what is coming"
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
"condition": "A whole panel or canvas has nothing to show yet",
|
|
63
|
-
"decision": "Centre a Spinner with size='xl' in a role=status wrapper with a short text",
|
|
64
|
-
"reason": "xl is the full-panel size; the wrapper gives screen readers the announcement the spinner lacks"
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
"condition": "The user has asked for reduced motion or the wait is paused",
|
|
68
|
-
"decision": "Render it with autoplay={false}",
|
|
69
|
-
"reason": "It then shows a still first frame instead of looping"
|
|
70
|
-
}
|
|
71
|
-
],
|
|
72
|
-
"relatedComponents": ["ui/skeleton", "ui/button", "web-chat-ui/chat-thinking-process"]
|
|
73
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
-
|
|
3
|
-
import { Spinner } from './spinner';
|
|
4
|
-
|
|
5
|
-
const meta: Meta<typeof Spinner> = {
|
|
6
|
-
title: 'Chatbot/Spinner',
|
|
7
|
-
component: Spinner,
|
|
8
|
-
tags: ['autodocs'],
|
|
9
|
-
argTypes: {
|
|
10
|
-
size: {
|
|
11
|
-
control: 'select',
|
|
12
|
-
options: ['sm', 'md', 'lg', 'xl'],
|
|
13
|
-
description:
|
|
14
|
-
'Box size: `sm` 16px, `md` 24px, `lg` 32px, `xl` 96px for a full-panel loading state.',
|
|
15
|
-
table: { defaultValue: { summary: 'md' } },
|
|
16
|
-
},
|
|
17
|
-
autoplay: {
|
|
18
|
-
control: 'boolean',
|
|
19
|
-
description: 'Plays and loops the animation. Turn it off to show a still first frame.',
|
|
20
|
-
table: { defaultValue: { summary: 'true' } },
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
args: {
|
|
24
|
-
size: 'md',
|
|
25
|
-
autoplay: true,
|
|
26
|
-
},
|
|
27
|
-
decorators: [
|
|
28
|
-
(Story) => (
|
|
29
|
-
<div className="max-w-[420px]">
|
|
30
|
-
<Story />
|
|
31
|
-
</div>
|
|
32
|
-
),
|
|
33
|
-
],
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export default meta;
|
|
37
|
-
type Story = StoryObj<typeof Spinner>;
|
|
38
|
-
|
|
39
|
-
export const Default: Story = {};
|
|
40
|
-
|
|
41
|
-
export const Playground: Story = {};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { DotLottieReact } from '@lottiefiles/dotlottie-react';
|
|
2
|
-
|
|
3
|
-
import { cn } from '@swisper.ai/web-core';
|
|
4
|
-
|
|
5
|
-
type Size = 'sm' | 'md' | 'lg' | 'xl';
|
|
6
|
-
|
|
7
|
-
export const SOURCE_ANIMATION =
|
|
8
|
-
'https://lottie.host/444a46a4-65b4-4483-b3a8-675160a79dad/LgQ8IVLAzA.lottie';
|
|
9
|
-
|
|
10
|
-
export interface SpinnerProps {
|
|
11
|
-
size?: Size;
|
|
12
|
-
autoplay?: boolean;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function Spinner({ size = 'md', autoplay = true }: SpinnerProps) {
|
|
16
|
-
return (
|
|
17
|
-
<span
|
|
18
|
-
data-testid="spinner"
|
|
19
|
-
data-size={size}
|
|
20
|
-
className={cn(
|
|
21
|
-
'pointer-events-none',
|
|
22
|
-
'inline-flex items-center justify-center',
|
|
23
|
-
'data-[size=sm]:size-16', // 16px
|
|
24
|
-
'data-[size=md]:size-24', // 24px
|
|
25
|
-
'data-[size=lg]:size-32', // 32px
|
|
26
|
-
'data-[size=xl]:size-[96px]', // 96px
|
|
27
|
-
)}
|
|
28
|
-
>
|
|
29
|
-
<DotLottieReact src={SOURCE_ANIMATION} loop={autoplay} autoplay={autoplay} />
|
|
30
|
-
</span>
|
|
31
|
-
);
|
|
32
|
-
}
|