@baishuyun/ai-design 1.0.0
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/.storybook/main.ts +29 -0
- package/.storybook/preview.ts +16 -0
- package/.turbo/turbo-build.log +14 -0
- package/CHANGELOG.md +12 -0
- package/components.json +22 -0
- package/debug-storybook.log +88 -0
- package/dist/ai-design.js +20482 -0
- package/dist/ai-design.js.map +1 -0
- package/dist/ai-design.umd.cjs +260 -0
- package/dist/ai-design.umd.cjs.map +1 -0
- package/dist/src/components/abs-fullscreen-gradient-bg.d.ts +10 -0
- package/dist/src/components/abs-fullscreen-gradient-bg.d.ts.map +1 -0
- package/dist/src/components/agent-scroll-selector.d.ts +11 -0
- package/dist/src/components/agent-scroll-selector.d.ts.map +1 -0
- package/dist/src/components/agent-select.d.ts +16 -0
- package/dist/src/components/agent-select.d.ts.map +1 -0
- package/dist/src/components/attachment-part-group.d.ts +16 -0
- package/dist/src/components/attachment-part-group.d.ts.map +1 -0
- package/dist/src/components/attachment-part.d.ts +19 -0
- package/dist/src/components/attachment-part.d.ts.map +1 -0
- package/dist/src/components/attachments-previewer.d.ts +18 -0
- package/dist/src/components/attachments-previewer.d.ts.map +1 -0
- package/dist/src/components/base-button.d.ts +8 -0
- package/dist/src/components/base-button.d.ts.map +1 -0
- package/dist/src/components/border-animation.d.ts +23 -0
- package/dist/src/components/border-animation.d.ts.map +1 -0
- package/dist/src/components/border-color-animation.d.ts +11 -0
- package/dist/src/components/border-color-animation.d.ts.map +1 -0
- package/dist/src/components/bot-avatar-name.d.ts +6 -0
- package/dist/src/components/bot-avatar-name.d.ts.map +1 -0
- package/dist/src/components/bot-icon.d.ts +5 -0
- package/dist/src/components/bot-icon.d.ts.map +1 -0
- package/dist/src/components/bs-entry-select.d.ts +18 -0
- package/dist/src/components/bs-entry-select.d.ts.map +1 -0
- package/dist/src/components/bs-icons.d.ts +75 -0
- package/dist/src/components/bs-icons.d.ts.map +1 -0
- package/dist/src/components/card-field.d.ts +11 -0
- package/dist/src/components/card-field.d.ts.map +1 -0
- package/dist/src/components/card.d.ts +11 -0
- package/dist/src/components/card.d.ts.map +1 -0
- package/dist/src/components/chat-area-header.d.ts +13 -0
- package/dist/src/components/chat-area-header.d.ts.map +1 -0
- package/dist/src/components/circle-checker.d.ts +10 -0
- package/dist/src/components/circle-checker.d.ts.map +1 -0
- package/dist/src/components/collapsible-txt-msg.d.ts +11 -0
- package/dist/src/components/collapsible-txt-msg.d.ts.map +1 -0
- package/dist/src/components/confirm-dialog.d.ts +26 -0
- package/dist/src/components/confirm-dialog.d.ts.map +1 -0
- package/dist/src/components/fake-bot-msg.d.ts +8 -0
- package/dist/src/components/fake-bot-msg.d.ts.map +1 -0
- package/dist/src/components/fields-design-info-table.d.ts +7 -0
- package/dist/src/components/fields-design-info-table.d.ts.map +1 -0
- package/dist/src/components/fields-generating-indicator.d.ts +6 -0
- package/dist/src/components/fields-generating-indicator.d.ts.map +1 -0
- package/dist/src/components/fields-portal.d.ts +8 -0
- package/dist/src/components/fields-portal.d.ts.map +1 -0
- package/dist/src/components/fields-previewer.d.ts +19 -0
- package/dist/src/components/fields-previewer.d.ts.map +1 -0
- package/dist/src/components/font-icon.d.ts +6 -0
- package/dist/src/components/font-icon.d.ts.map +1 -0
- package/dist/src/components/form-info-editor.d.ts +31 -0
- package/dist/src/components/form-info-editor.d.ts.map +1 -0
- package/dist/src/components/formula-tag.d.ts +8 -0
- package/dist/src/components/formula-tag.d.ts.map +1 -0
- package/dist/src/components/generate-animation.d.ts +5 -0
- package/dist/src/components/generate-animation.d.ts.map +1 -0
- package/dist/src/components/icon-btn.d.ts +9 -0
- package/dist/src/components/icon-btn.d.ts.map +1 -0
- package/dist/src/components/img-part.d.ts +10 -0
- package/dist/src/components/img-part.d.ts.map +1 -0
- package/dist/src/components/legacy-slot.d.ts +11 -0
- package/dist/src/components/legacy-slot.d.ts.map +1 -0
- package/dist/src/components/line-checker.d.ts +19 -0
- package/dist/src/components/line-checker.d.ts.map +1 -0
- package/dist/src/components/linear-gradient-border-btn.d.ts +10 -0
- package/dist/src/components/linear-gradient-border-btn.d.ts.map +1 -0
- package/dist/src/components/linear-gradient-color-bg-animation.d.ts +8 -0
- package/dist/src/components/linear-gradient-color-bg-animation.d.ts.map +1 -0
- package/dist/src/components/memoized-markdown.d.ts +5 -0
- package/dist/src/components/memoized-markdown.d.ts.map +1 -0
- package/dist/src/components/message-content.d.ts +6 -0
- package/dist/src/components/message-content.d.ts.map +1 -0
- package/dist/src/components/number-part.d.ts +9 -0
- package/dist/src/components/number-part.d.ts.map +1 -0
- package/dist/src/components/office-container.d.ts +12 -0
- package/dist/src/components/office-container.d.ts.map +1 -0
- package/dist/src/components/option-item.d.ts +9 -0
- package/dist/src/components/option-item.d.ts.map +1 -0
- package/dist/src/components/previewer-header.d.ts +21 -0
- package/dist/src/components/previewer-header.d.ts.map +1 -0
- package/dist/src/components/primary-confirm-btn.d.ts +10 -0
- package/dist/src/components/primary-confirm-btn.d.ts.map +1 -0
- package/dist/src/components/primary-entry-btn.d.ts +9 -0
- package/dist/src/components/primary-entry-btn.d.ts.map +1 -0
- package/dist/src/components/scroll-to-bottom-btn.d.ts +6 -0
- package/dist/src/components/scroll-to-bottom-btn.d.ts.map +1 -0
- package/dist/src/components/split-line.d.ts +5 -0
- package/dist/src/components/split-line.d.ts.map +1 -0
- package/dist/src/components/square-checker.d.ts +15 -0
- package/dist/src/components/square-checker.d.ts.map +1 -0
- package/dist/src/components/tab-radio-group.d.ts +20 -0
- package/dist/src/components/tab-radio-group.d.ts.map +1 -0
- package/dist/src/components/tooltip.d.ts +6 -0
- package/dist/src/components/tooltip.d.ts.map +1 -0
- package/dist/src/components/ui/button.d.ts +12 -0
- package/dist/src/components/ui/button.d.ts.map +1 -0
- package/dist/src/components/ui/dialog.d.ts +24 -0
- package/dist/src/components/ui/dialog.d.ts.map +1 -0
- package/dist/src/components/ui/icons.d.ts +176 -0
- package/dist/src/components/ui/icons.d.ts.map +1 -0
- package/dist/src/components/ui/popover.d.ts +10 -0
- package/dist/src/components/ui/popover.d.ts.map +1 -0
- package/dist/src/components/ui/spinner.d.ts +3 -0
- package/dist/src/components/ui/spinner.d.ts.map +1 -0
- package/dist/src/components/ui/tooltip.d.ts +13 -0
- package/dist/src/components/ui/tooltip.d.ts.map +1 -0
- package/dist/src/components/user-txt-msg-bubble.d.ts +6 -0
- package/dist/src/components/user-txt-msg-bubble.d.ts.map +1 -0
- package/dist/src/components/warning-msg.d.ts +6 -0
- package/dist/src/components/warning-msg.d.ts.map +1 -0
- package/dist/src/const/ui.d.ts +7 -0
- package/dist/src/const/ui.d.ts.map +1 -0
- package/dist/src/hooks/use-resizable-width.d.ts +24 -0
- package/dist/src/hooks/use-resizable-width.d.ts.map +1 -0
- package/dist/src/hooks/use-shadow.d.ts +25 -0
- package/dist/src/hooks/use-shadow.d.ts.map +1 -0
- package/dist/src/index.d.ts +66 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/lib/utils.d.ts +4 -0
- package/dist/src/lib/utils.d.ts.map +1 -0
- package/dist/src/stories/AbsFullscreenGradientBg.stories.d.ts +17 -0
- package/dist/src/stories/AbsFullscreenGradientBg.stories.d.ts.map +1 -0
- package/dist/src/stories/AgentScrollSelector.stories.d.ts +11 -0
- package/dist/src/stories/AgentScrollSelector.stories.d.ts.map +1 -0
- package/dist/src/stories/AgentSelect.stories.d.ts +14 -0
- package/dist/src/stories/AgentSelect.stories.d.ts.map +1 -0
- package/dist/src/stories/AttachmentPart.stories.d.ts +23 -0
- package/dist/src/stories/AttachmentPart.stories.d.ts.map +1 -0
- package/dist/src/stories/AttachmentPartGroup.stories.d.ts +21 -0
- package/dist/src/stories/AttachmentPartGroup.stories.d.ts.map +1 -0
- package/dist/src/stories/AttachmentsPreviewer.stories.d.ts +20 -0
- package/dist/src/stories/AttachmentsPreviewer.stories.d.ts.map +1 -0
- package/dist/src/stories/BaseButton.stories.d.ts +18 -0
- package/dist/src/stories/BaseButton.stories.d.ts.map +1 -0
- package/dist/src/stories/BorderAnimation.stories.d.ts +21 -0
- package/dist/src/stories/BorderAnimation.stories.d.ts.map +1 -0
- package/dist/src/stories/BorderColorAnimation.stories.d.ts +26 -0
- package/dist/src/stories/BorderColorAnimation.stories.d.ts.map +1 -0
- package/dist/src/stories/BotAvatarAndName.stories.d.ts +18 -0
- package/dist/src/stories/BotAvatarAndName.stories.d.ts.map +1 -0
- package/dist/src/stories/BotIcon.stories.d.ts +17 -0
- package/dist/src/stories/BotIcon.stories.d.ts.map +1 -0
- package/dist/src/stories/BsEntrySelect.stories.d.ts +13 -0
- package/dist/src/stories/BsEntrySelect.stories.d.ts.map +1 -0
- package/dist/src/stories/BsTooltip.stories.d.ts +7 -0
- package/dist/src/stories/BsTooltip.stories.d.ts.map +1 -0
- package/dist/src/stories/Card.stories.d.ts +14 -0
- package/dist/src/stories/Card.stories.d.ts.map +1 -0
- package/dist/src/stories/CardField.stories.d.ts +13 -0
- package/dist/src/stories/CardField.stories.d.ts.map +1 -0
- package/dist/src/stories/ChatAreaHeader.stories.d.ts +14 -0
- package/dist/src/stories/ChatAreaHeader.stories.d.ts.map +1 -0
- package/dist/src/stories/CircleChecker.stories.d.ts +21 -0
- package/dist/src/stories/CircleChecker.stories.d.ts.map +1 -0
- package/dist/src/stories/CollapsibleTextMsg.stories.d.ts +16 -0
- package/dist/src/stories/CollapsibleTextMsg.stories.d.ts.map +1 -0
- package/dist/src/stories/ConfirmDialog.stories.d.ts +61 -0
- package/dist/src/stories/ConfirmDialog.stories.d.ts.map +1 -0
- package/dist/src/stories/FakeBotMsg.stories.d.ts +21 -0
- package/dist/src/stories/FakeBotMsg.stories.d.ts.map +1 -0
- package/dist/src/stories/FormInfoEditor.stories.d.ts +15 -0
- package/dist/src/stories/FormInfoEditor.stories.d.ts.map +1 -0
- package/dist/src/stories/FormulaTag.stories.d.ts +37 -0
- package/dist/src/stories/FormulaTag.stories.d.ts.map +1 -0
- package/dist/src/stories/GenerateAnimation.stories.d.ts +17 -0
- package/dist/src/stories/GenerateAnimation.stories.d.ts.map +1 -0
- package/dist/src/stories/IconBtn.stories.d.ts +15 -0
- package/dist/src/stories/IconBtn.stories.d.ts.map +1 -0
- package/dist/src/stories/IconLib.d.ts +12 -0
- package/dist/src/stories/IconLib.d.ts.map +1 -0
- package/dist/src/stories/Icons.stories.d.ts +24 -0
- package/dist/src/stories/Icons.stories.d.ts.map +1 -0
- package/dist/src/stories/ImgMsgPart.stories.d.ts +20 -0
- package/dist/src/stories/ImgMsgPart.stories.d.ts.map +1 -0
- package/dist/src/stories/LegacySlot.stories.d.ts +16 -0
- package/dist/src/stories/LegacySlot.stories.d.ts.map +1 -0
- package/dist/src/stories/LineChecker.stories.d.ts +23 -0
- package/dist/src/stories/LineChecker.stories.d.ts.map +1 -0
- package/dist/src/stories/LinearGradientBorderBtn.stories.d.ts +22 -0
- package/dist/src/stories/LinearGradientBorderBtn.stories.d.ts.map +1 -0
- package/dist/src/stories/LinearGradientColorBgAnimation.stories.d.ts +23 -0
- package/dist/src/stories/LinearGradientColorBgAnimation.stories.d.ts.map +1 -0
- package/dist/src/stories/MemoizedMarkdown.stories.d.ts +23 -0
- package/dist/src/stories/MemoizedMarkdown.stories.d.ts.map +1 -0
- package/dist/src/stories/MessageContent.stories.d.ts +16 -0
- package/dist/src/stories/MessageContent.stories.d.ts.map +1 -0
- package/dist/src/stories/NumbersMsgPart.stories.d.ts +19 -0
- package/dist/src/stories/NumbersMsgPart.stories.d.ts.map +1 -0
- package/dist/src/stories/OfficeContainer.stories.d.ts +8 -0
- package/dist/src/stories/OfficeContainer.stories.d.ts.map +1 -0
- package/dist/src/stories/OptionItem.stories.d.ts +20 -0
- package/dist/src/stories/OptionItem.stories.d.ts.map +1 -0
- package/dist/src/stories/PreviewerHeader.stories.d.ts +12 -0
- package/dist/src/stories/PreviewerHeader.stories.d.ts.map +1 -0
- package/dist/src/stories/PrimaryConfirmBtn.stories.d.ts +19 -0
- package/dist/src/stories/PrimaryConfirmBtn.stories.d.ts.map +1 -0
- package/dist/src/stories/PrimaryEntryBtn.stories.d.ts +26 -0
- package/dist/src/stories/PrimaryEntryBtn.stories.d.ts.map +1 -0
- package/dist/src/stories/ScrollToBottom.stories.d.ts +15 -0
- package/dist/src/stories/ScrollToBottom.stories.d.ts.map +1 -0
- package/dist/src/stories/SplitLine.stories.d.ts +9 -0
- package/dist/src/stories/SplitLine.stories.d.ts.map +1 -0
- package/dist/src/stories/SquareChecker.stories.d.ts +26 -0
- package/dist/src/stories/SquareChecker.stories.d.ts.map +1 -0
- package/dist/src/stories/TabRadioGroup.stories.d.ts +18 -0
- package/dist/src/stories/TabRadioGroup.stories.d.ts.map +1 -0
- package/dist/src/stories/UserTextMsgBubble.stories.d.ts +14 -0
- package/dist/src/stories/UserTextMsgBubble.stories.d.ts.map +1 -0
- package/dist/src/stories/WarningMessage.stories.d.ts +16 -0
- package/dist/src/stories/WarningMessage.stories.d.ts.map +1 -0
- package/dist/src/stories/fields-design-info-table.stories.d.ts +14 -0
- package/dist/src/stories/fields-design-info-table.stories.d.ts.map +1 -0
- package/dist/src/stories/fields-generating.stories.d.ts +20 -0
- package/dist/src/stories/fields-generating.stories.d.ts.map +1 -0
- package/dist/src/stories/fields-previewer.stories.d.ts +19 -0
- package/dist/src/stories/fields-previewer.stories.d.ts.map +1 -0
- package/dist/src/types.d.ts +8 -0
- package/dist/src/types.d.ts.map +1 -0
- package/package.json +80 -0
- package/src/components/abs-fullscreen-gradient-bg.tsx +35 -0
- package/src/components/agent-scroll-selector.tsx +181 -0
- package/src/components/agent-select.tsx +149 -0
- package/src/components/attachment-part-group.tsx +35 -0
- package/src/components/attachment-part.tsx +179 -0
- package/src/components/attachments-previewer.tsx +324 -0
- package/src/components/base-button.tsx +49 -0
- package/src/components/border-animation.tsx +107 -0
- package/src/components/border-color-animation.tsx +66 -0
- package/src/components/bot-avatar-name.tsx +36 -0
- package/src/components/bot-icon.tsx +23 -0
- package/src/components/bs-entry-select.tsx +724 -0
- package/src/components/bs-icons.tsx +1201 -0
- package/src/components/card-field.tsx +23 -0
- package/src/components/card.tsx +36 -0
- package/src/components/chat-area-header.tsx +65 -0
- package/src/components/circle-checker.tsx +66 -0
- package/src/components/collapsible-txt-msg.tsx +63 -0
- package/src/components/confirm-dialog.tsx +139 -0
- package/src/components/fake-bot-msg.tsx +49 -0
- package/src/components/fields-design-info-table.tsx +160 -0
- package/src/components/fields-generating-indicator.tsx +95 -0
- package/src/components/fields-portal.tsx +18 -0
- package/src/components/fields-previewer.tsx +216 -0
- package/src/components/font-icon.tsx +17 -0
- package/src/components/form-info-editor.tsx +253 -0
- package/src/components/formula-tag.tsx +32 -0
- package/src/components/generate-animation.tsx +56 -0
- package/src/components/icon-btn.tsx +43 -0
- package/src/components/img-part.tsx +27 -0
- package/src/components/legacy-slot.tsx +103 -0
- package/src/components/line-checker.tsx +160 -0
- package/src/components/linear-gradient-border-btn.tsx +48 -0
- package/src/components/linear-gradient-color-bg-animation.tsx +103 -0
- package/src/components/memoized-markdown.tsx +32 -0
- package/src/components/message-content.tsx +21 -0
- package/src/components/number-part.tsx +46 -0
- package/src/components/office-container.tsx +83 -0
- package/src/components/option-item.tsx +28 -0
- package/src/components/previewer-header.tsx +270 -0
- package/src/components/primary-confirm-btn.tsx +58 -0
- package/src/components/primary-entry-btn.tsx +48 -0
- package/src/components/scroll-to-bottom-btn.tsx +28 -0
- package/src/components/split-line.tsx +9 -0
- package/src/components/square-checker.tsx +87 -0
- package/src/components/tab-radio-group.tsx +83 -0
- package/src/components/tooltip.tsx +53 -0
- package/src/components/ui/button.tsx +51 -0
- package/src/components/ui/dialog.tsx +104 -0
- package/src/components/ui/icons.tsx +1267 -0
- package/src/components/ui/popover.tsx +50 -0
- package/src/components/ui/spinner.tsx +17 -0
- package/src/components/ui/tooltip.tsx +53 -0
- package/src/components/user-txt-msg-bubble.tsx +19 -0
- package/src/components/warning-msg.tsx +27 -0
- package/src/const/ui.ts +52 -0
- package/src/hooks/use-resizable-width.ts +92 -0
- package/src/hooks/use-shadow.ts +127 -0
- package/src/index.ts +76 -0
- package/src/lib/utils.ts +52 -0
- package/src/stories/AbsFullscreenGradientBg.stories.tsx +36 -0
- package/src/stories/AgentScrollSelector.stories.tsx +95 -0
- package/src/stories/AgentSelect.stories.tsx +134 -0
- package/src/stories/AttachmentPart.stories.tsx +122 -0
- package/src/stories/AttachmentPartGroup.stories.tsx +152 -0
- package/src/stories/AttachmentsPreviewer.stories.tsx +306 -0
- package/src/stories/BaseButton.stories.tsx +33 -0
- package/src/stories/BorderAnimation.stories.tsx +116 -0
- package/src/stories/BorderColorAnimation.stories.tsx +63 -0
- package/src/stories/BotAvatarAndName.stories.ts +24 -0
- package/src/stories/BotIcon.stories.ts +22 -0
- package/src/stories/BsEntrySelect.stories.tsx +261 -0
- package/src/stories/BsTooltip.stories.tsx +32 -0
- package/src/stories/Card.stories.tsx +28 -0
- package/src/stories/CardField.stories.tsx +87 -0
- package/src/stories/ChatAreaHeader.stories.ts +26 -0
- package/src/stories/CircleChecker.stories.tsx +89 -0
- package/src/stories/CollapsibleTextMsg.stories.ts +44 -0
- package/src/stories/ConfirmDialog.stories.tsx +123 -0
- package/src/stories/FakeBotMsg.stories.tsx +36 -0
- package/src/stories/FormInfoEditor.stories.tsx +173 -0
- package/src/stories/FormulaTag.stories.tsx +68 -0
- package/src/stories/GenerateAnimation.stories.ts +20 -0
- package/src/stories/IconBtn.stories.tsx +32 -0
- package/src/stories/IconLib.tsx +45 -0
- package/src/stories/Icons.stories.ts +22 -0
- package/src/stories/ImgMsgPart.stories.tsx +42 -0
- package/src/stories/LegacySlot.stories.tsx +56 -0
- package/src/stories/LineChecker.stories.tsx +134 -0
- package/src/stories/LinearGradientBorderBtn.stories.tsx +86 -0
- package/src/stories/LinearGradientColorBgAnimation.stories.tsx +60 -0
- package/src/stories/MemoizedMarkdown.stories.tsx +102 -0
- package/src/stories/MessageContent.stories.tsx +36 -0
- package/src/stories/NumbersMsgPart.stories.tsx +42 -0
- package/src/stories/OfficeContainer.stories.tsx +82 -0
- package/src/stories/OptionItem.stories.tsx +77 -0
- package/src/stories/PreviewerHeader.stories.tsx +91 -0
- package/src/stories/PrimaryConfirmBtn.stories.tsx +60 -0
- package/src/stories/PrimaryEntryBtn.stories.tsx +74 -0
- package/src/stories/ScrollToBottom.stories.tsx +24 -0
- package/src/stories/SplitLine.stories.tsx +40 -0
- package/src/stories/SquareChecker.stories.tsx +96 -0
- package/src/stories/TabRadioGroup.stories.tsx +84 -0
- package/src/stories/UserTextMsgBubble.stories.ts +24 -0
- package/src/stories/WarningMessage.stories.tsx +23 -0
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +1 -0
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/demo.css +539 -0
- package/src/stories/assets/demo_index.html +7988 -0
- package/src/stories/assets/discord.svg +1 -0
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +1 -0
- package/src/stories/assets/iconfont.css +1377 -0
- package/src/stories/assets/iconfont.eot +0 -0
- package/src/stories/assets/iconfont.json +2382 -0
- package/src/stories/assets/iconfont.svg +697 -0
- package/src/stories/assets/iconfont.ttf +0 -0
- package/src/stories/assets/iconfont.woff +0 -0
- package/src/stories/assets/iconfont.woff2 +0 -0
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +1 -0
- package/src/stories/assets/youtube.svg +1 -0
- package/src/stories/fields-design-info-table.stories.tsx +203 -0
- package/src/stories/fields-generating.stories.tsx +41 -0
- package/src/stories/fields-previewer.stories.tsx +77 -0
- package/src/style.css +223 -0
- package/src/types.ts +8 -0
- package/tsconfig.json +12 -0
- package/vite.config.ts +42 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useShadow } from '../hooks/use-shadow';
|
|
2
|
+
import { createPortal } from 'react-dom';
|
|
3
|
+
import { FieldsPreviewer, FieldsPreviewerProps } from './fields-previewer';
|
|
4
|
+
import { ReactPortal } from 'react';
|
|
5
|
+
|
|
6
|
+
export interface FieldsPortalProps extends FieldsPreviewerProps {
|
|
7
|
+
portalEl: HTMLElement;
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const FieldsPortal = ({ portalEl, children, ...rest }: FieldsPortalProps): ReactPortal => {
|
|
12
|
+
const { shadowContainer: shadowEntry } = useShadow({
|
|
13
|
+
rootEl: portalEl,
|
|
14
|
+
id: 'chat-sdk-fields-portal',
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
return createPortal(<FieldsPreviewer {...rest}>{children}</FieldsPreviewer>, shadowEntry!);
|
|
18
|
+
};
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import { forwardRef, useState } from 'react';
|
|
3
|
+
import { AbsFullscreenGradientBg } from './abs-fullscreen-gradient-bg';
|
|
4
|
+
import { BorderColorAnimation } from './border-color-animation';
|
|
5
|
+
import { FieldsGeneratingIndicator } from './fields-generating-indicator';
|
|
6
|
+
import { PreviewerHeader, PreviewerHeaderProps } from './previewer-header';
|
|
7
|
+
import { useShadow } from '../hooks/use-shadow';
|
|
8
|
+
import { TooltipProvider } from './ui/tooltip';
|
|
9
|
+
|
|
10
|
+
export interface FieldsPreviewerProps extends PreviewerHeaderProps {
|
|
11
|
+
fullscreen?: boolean;
|
|
12
|
+
|
|
13
|
+
rightSpaceWidth?: number;
|
|
14
|
+
rightSpaceRef?: (right: HTMLDivElement) => void;
|
|
15
|
+
rightElement?: React.ReactNode;
|
|
16
|
+
|
|
17
|
+
// generating fields
|
|
18
|
+
streaming?: boolean;
|
|
19
|
+
streamingText?: string;
|
|
20
|
+
|
|
21
|
+
empty?: boolean;
|
|
22
|
+
|
|
23
|
+
zIndex?: number;
|
|
24
|
+
|
|
25
|
+
padding?: number;
|
|
26
|
+
|
|
27
|
+
containerStyle?: string;
|
|
28
|
+
|
|
29
|
+
fullContent?: boolean;
|
|
30
|
+
|
|
31
|
+
// children means the content inside the previewer, not the right side components
|
|
32
|
+
children?: React.ReactNode;
|
|
33
|
+
|
|
34
|
+
readonly?: boolean;
|
|
35
|
+
|
|
36
|
+
disableShadowContainer?: boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const PlaceholderDashedBox = () => {
|
|
40
|
+
return (
|
|
41
|
+
<div
|
|
42
|
+
style={{
|
|
43
|
+
borderRadius: 10,
|
|
44
|
+
width: '100%',
|
|
45
|
+
height: '100%',
|
|
46
|
+
border: '1px dashed var(---e0e0e0, #E0E0E0)',
|
|
47
|
+
}}
|
|
48
|
+
/>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const FieldsPreviewer = forwardRef<HTMLDivElement, FieldsPreviewerProps>(
|
|
53
|
+
({
|
|
54
|
+
zIndex = 1,
|
|
55
|
+
children,
|
|
56
|
+
title,
|
|
57
|
+
tips,
|
|
58
|
+
active,
|
|
59
|
+
fullscreen,
|
|
60
|
+
padding = 10,
|
|
61
|
+
className,
|
|
62
|
+
empty,
|
|
63
|
+
rightSpaceWidth,
|
|
64
|
+
rightSpaceRef,
|
|
65
|
+
rightElement,
|
|
66
|
+
streaming,
|
|
67
|
+
streamingText,
|
|
68
|
+
onBackClick,
|
|
69
|
+
dialogContainer,
|
|
70
|
+
disableShadowContainer,
|
|
71
|
+
variant = 'fields-previewer',
|
|
72
|
+
onSave,
|
|
73
|
+
onCancel,
|
|
74
|
+
onClear,
|
|
75
|
+
style,
|
|
76
|
+
confirmContent,
|
|
77
|
+
fullContent,
|
|
78
|
+
confirmTitle,
|
|
79
|
+
containerStyle,
|
|
80
|
+
readonly,
|
|
81
|
+
|
|
82
|
+
closeBtnLabel,
|
|
83
|
+
disableOperation,
|
|
84
|
+
disableConfirm,
|
|
85
|
+
|
|
86
|
+
customOperationElement,
|
|
87
|
+
}: FieldsPreviewerProps, _) => {
|
|
88
|
+
const p = fullscreen ? 0 : padding;
|
|
89
|
+
const pr = fullscreen ? 0 : rightSpaceWidth;
|
|
90
|
+
|
|
91
|
+
// const absWrapperRef = useRef<HTMLDivElement>(null);
|
|
92
|
+
const [absContainer, setAbsContainer] = useState<HTMLDivElement | null>(null);
|
|
93
|
+
|
|
94
|
+
const isFields = variant === 'fields-previewer';
|
|
95
|
+
const isData = variant === 'data-previewer';
|
|
96
|
+
|
|
97
|
+
const contentCls = classNames({
|
|
98
|
+
'm-[20px]': isFields,
|
|
99
|
+
'mx-[12px] mb-[10px]': isData,
|
|
100
|
+
'p-[10px]': isFields,
|
|
101
|
+
'p-0': isData,
|
|
102
|
+
'opacity-60': streaming && isFields,
|
|
103
|
+
'w-[calc(100%-40px)] h-[calc(100%-90px)] relative overflow-x-hidden overflow-y-auto':
|
|
104
|
+
isFields,
|
|
105
|
+
'w-[calc(100%-24px)] h-[calc(100%-62px)] relative overflow-x-hidden overflow-y-auto': isData,
|
|
106
|
+
'rounded-[4px] bg-white': isData,
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
const fullContentStyle = fullContent
|
|
110
|
+
? {
|
|
111
|
+
width: '100%',
|
|
112
|
+
height: '100%',
|
|
113
|
+
padding: 0,
|
|
114
|
+
margin: 0,
|
|
115
|
+
}
|
|
116
|
+
: {};
|
|
117
|
+
|
|
118
|
+
const { shadowContainer } = useShadow({
|
|
119
|
+
id: 'dialog-container',
|
|
120
|
+
rootEl: dialogContainer,
|
|
121
|
+
style: containerStyle,
|
|
122
|
+
wrapperStyle: {
|
|
123
|
+
zIndex: Date.now(),
|
|
124
|
+
position: 'absolute',
|
|
125
|
+
width: '100%',
|
|
126
|
+
height: '100%',
|
|
127
|
+
pointerEvents: 'none',
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
const contentJsx = (
|
|
132
|
+
<>
|
|
133
|
+
<PreviewerHeader
|
|
134
|
+
title={title}
|
|
135
|
+
tips={tips}
|
|
136
|
+
active={active}
|
|
137
|
+
variant={variant}
|
|
138
|
+
className={className}
|
|
139
|
+
onBackClick={onBackClick}
|
|
140
|
+
onSave={streaming ? undefined : onSave}
|
|
141
|
+
onCancel={streaming ? undefined : onCancel}
|
|
142
|
+
style={style}
|
|
143
|
+
dialogContainer={disableShadowContainer ? absContainer! : (shadowContainer || absContainer!)}
|
|
144
|
+
confirmTitle={confirmTitle}
|
|
145
|
+
confirmContent={confirmContent}
|
|
146
|
+
closeBtnLabel={closeBtnLabel}
|
|
147
|
+
disableOperation={disableOperation}
|
|
148
|
+
disableConfirm={disableConfirm}
|
|
149
|
+
onClear={onClear}
|
|
150
|
+
customOperationElement={customOperationElement}
|
|
151
|
+
/>
|
|
152
|
+
<div className={contentCls} style={fullContentStyle}>
|
|
153
|
+
{empty && isFields ? <PlaceholderDashedBox /> : children}
|
|
154
|
+
{readonly && <div className="absolute inset-0 z-50 cursor-not-allowed" />}
|
|
155
|
+
</div>
|
|
156
|
+
{streaming && (
|
|
157
|
+
// abs center
|
|
158
|
+
<div className="absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2">
|
|
159
|
+
<FieldsGeneratingIndicator>{streamingText}</FieldsGeneratingIndicator>
|
|
160
|
+
</div>
|
|
161
|
+
)}
|
|
162
|
+
</>
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
const content = isFields ? (
|
|
166
|
+
<BorderColorAnimation
|
|
167
|
+
width={pr ? `calc(100% - ${pr}px)` : '100%'}
|
|
168
|
+
style={{ overflow: 'hidden' }}
|
|
169
|
+
>
|
|
170
|
+
{contentJsx}
|
|
171
|
+
</BorderColorAnimation>
|
|
172
|
+
) : (
|
|
173
|
+
<div className="h-full" style={{ width: pr ? `calc(100% - ${pr}px)` : '100%' }}>
|
|
174
|
+
{contentJsx}
|
|
175
|
+
</div>
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
const rightArea = (
|
|
179
|
+
<div
|
|
180
|
+
style={{
|
|
181
|
+
width: fullscreen ? 0 : rightSpaceWidth,
|
|
182
|
+
position: 'absolute',
|
|
183
|
+
top: 0,
|
|
184
|
+
right: 0,
|
|
185
|
+
pointerEvents: fullscreen ? 'none' : 'auto',
|
|
186
|
+
}}
|
|
187
|
+
className="h-full"
|
|
188
|
+
ref={(n) => {
|
|
189
|
+
if (n) {
|
|
190
|
+
rightSpaceRef?.(n);
|
|
191
|
+
}
|
|
192
|
+
}}
|
|
193
|
+
>
|
|
194
|
+
{rightElement}
|
|
195
|
+
</div>
|
|
196
|
+
);
|
|
197
|
+
|
|
198
|
+
return (
|
|
199
|
+
<TooltipProvider
|
|
200
|
+
delayDuration={100}
|
|
201
|
+
zIndex={zIndex}
|
|
202
|
+
>
|
|
203
|
+
<AbsFullscreenGradientBg
|
|
204
|
+
zIndex={zIndex}
|
|
205
|
+
padding={isFields ? p : 0}
|
|
206
|
+
disableGradient={fullscreen || !isFields}
|
|
207
|
+
bgColor={isFields ? '#fff' : '#F5F7FA'}
|
|
208
|
+
ref={setAbsContainer}
|
|
209
|
+
>
|
|
210
|
+
{fullscreen ? contentJsx : content}
|
|
211
|
+
{rightArea}
|
|
212
|
+
</AbsFullscreenGradientBg>
|
|
213
|
+
</TooltipProvider>
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const FontIcon = ({
|
|
2
|
+
code,
|
|
3
|
+
className,
|
|
4
|
+
style,
|
|
5
|
+
}: {
|
|
6
|
+
code: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
}) => {
|
|
10
|
+
return (
|
|
11
|
+
<i
|
|
12
|
+
className={`sdk-icon ${className || ''}`}
|
|
13
|
+
style={style}
|
|
14
|
+
dangerouslySetInnerHTML={{ __html: code }}
|
|
15
|
+
/>
|
|
16
|
+
);
|
|
17
|
+
};
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { cn } from '../lib/utils';
|
|
2
|
+
import { FORM_ICON_OPTIONS, transCls } from '../const/ui';
|
|
3
|
+
import { useState, memo, useEffect } from 'react';
|
|
4
|
+
import { ChevronDownIcon } from './ui/icons';
|
|
5
|
+
import { PrimaryConfirmBtn } from './primary-confirm-btn';
|
|
6
|
+
import { EditIcon } from './bs-icons';
|
|
7
|
+
import { FontIcon } from './font-icon';
|
|
8
|
+
import { FormIconOption } from '../types';
|
|
9
|
+
|
|
10
|
+
export type { FormIconOption };
|
|
11
|
+
|
|
12
|
+
// Form icon component with blue background - dynamically shows selected icon
|
|
13
|
+
const FormIcon = ({
|
|
14
|
+
size = 36,
|
|
15
|
+
code,
|
|
16
|
+
style,
|
|
17
|
+
}: {
|
|
18
|
+
size?: number;
|
|
19
|
+
code?: string;
|
|
20
|
+
style?: React.CSSProperties;
|
|
21
|
+
}) => {
|
|
22
|
+
const borderRadius = size * 0.238; // ~8.57px for 36px container
|
|
23
|
+
const fontSize = size * 0.6875; // Icon font size relative to container
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div
|
|
27
|
+
className="relative flex items-center justify-center bg-[#0265ff] flex-shrink-0 text-white"
|
|
28
|
+
style={{
|
|
29
|
+
width: size,
|
|
30
|
+
height: size,
|
|
31
|
+
borderRadius,
|
|
32
|
+
fontSize: fontSize,
|
|
33
|
+
...style,
|
|
34
|
+
}}
|
|
35
|
+
>
|
|
36
|
+
<FontIcon code={code || FORM_ICON_OPTIONS[0].code} style={{ fontSize }} />
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export interface FormInfoEditorProps {
|
|
42
|
+
/** Form name */
|
|
43
|
+
name: string;
|
|
44
|
+
/** Callback when name changes */
|
|
45
|
+
onNameChange?: (name: string) => void;
|
|
46
|
+
/** Currently selected icon option */
|
|
47
|
+
selectedIcon?: FormIconOption;
|
|
48
|
+
/** Available icon options */
|
|
49
|
+
iconOptions?: FormIconOption[];
|
|
50
|
+
/** Callback when icon changes */
|
|
51
|
+
onIconChange?: (icon: FormIconOption) => void;
|
|
52
|
+
/** Callback when confirm button is clicked */
|
|
53
|
+
onConfirm?: (name: string, iconVal: number) => void;
|
|
54
|
+
/** Whether the editor is in expanded mode */
|
|
55
|
+
expanded?: boolean;
|
|
56
|
+
/** Callback when expanded state changes */
|
|
57
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
58
|
+
/** Custom class name */
|
|
59
|
+
className?: string;
|
|
60
|
+
onMount?: () => void;
|
|
61
|
+
readonly?: boolean;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Form Info Editor Component
|
|
66
|
+
* Displays form name and icon with an expandable editor interface
|
|
67
|
+
*/
|
|
68
|
+
export const FormInfoEditor = memo(
|
|
69
|
+
({
|
|
70
|
+
name,
|
|
71
|
+
onNameChange,
|
|
72
|
+
onMount,
|
|
73
|
+
selectedIcon = FORM_ICON_OPTIONS[0],
|
|
74
|
+
iconOptions = [],
|
|
75
|
+
onIconChange,
|
|
76
|
+
readonly,
|
|
77
|
+
onConfirm,
|
|
78
|
+
expanded: controlledExpanded,
|
|
79
|
+
onExpandedChange,
|
|
80
|
+
className,
|
|
81
|
+
}: FormInfoEditorProps) => {
|
|
82
|
+
const [internalExpanded, setInternalExpanded] = useState(false);
|
|
83
|
+
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
|
|
84
|
+
|
|
85
|
+
const expanded = controlledExpanded ?? internalExpanded;
|
|
86
|
+
const setExpanded = (value: boolean) => {
|
|
87
|
+
setInternalExpanded(value);
|
|
88
|
+
onExpandedChange?.(value);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const [nameVal, setNameVal] = useState(name);
|
|
92
|
+
const [iconOpt, setIconOpt] = useState(selectedIcon);
|
|
93
|
+
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
onMount?.();
|
|
96
|
+
}, []);
|
|
97
|
+
|
|
98
|
+
// Default Status (Collapsed)
|
|
99
|
+
if (!expanded || readonly) {
|
|
100
|
+
return (
|
|
101
|
+
<div
|
|
102
|
+
className={cn(
|
|
103
|
+
'bg-white hover:bg-[#fafafa] border border-[#e0e0e0] rounded-[10px] px-[10px] py-0 flex items-center justify-between h-[56px] cursor-pointer',
|
|
104
|
+
transCls,
|
|
105
|
+
className,
|
|
106
|
+
'duration-100'
|
|
107
|
+
)}
|
|
108
|
+
onClick={() => {
|
|
109
|
+
if (readonly) return;
|
|
110
|
+
setExpanded(true);
|
|
111
|
+
}}
|
|
112
|
+
>
|
|
113
|
+
{/* Left side: Form icon and name */}
|
|
114
|
+
<div className="flex items-center gap-[10px] min-w-0 flex-1 mr-[10px]">
|
|
115
|
+
<FormIcon size={36} code={iconOpt?.code} />
|
|
116
|
+
<p className="text-[14px] text-black leading-normal truncate">{nameVal}</p>
|
|
117
|
+
</div>
|
|
118
|
+
|
|
119
|
+
<button
|
|
120
|
+
onClick={() => {
|
|
121
|
+
if (readonly) return;
|
|
122
|
+
setExpanded(true);
|
|
123
|
+
}}
|
|
124
|
+
className={cn(
|
|
125
|
+
'w-[16px] h-[16px] flex items-center justify-center cursor-pointer hover:text-[#0265ff]',
|
|
126
|
+
transCls,
|
|
127
|
+
{
|
|
128
|
+
'pointer-events-none opacity-0': readonly,
|
|
129
|
+
}
|
|
130
|
+
)}
|
|
131
|
+
>
|
|
132
|
+
<EditIcon />
|
|
133
|
+
</button>
|
|
134
|
+
</div>
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Expanded Status (Edit mode)
|
|
139
|
+
return (
|
|
140
|
+
<div
|
|
141
|
+
className={cn(
|
|
142
|
+
'bg-[#fafafa] border border-[#e0e0e0] rounded-[10px] p-[12px] flex flex-col gap-[22px]',
|
|
143
|
+
transCls,
|
|
144
|
+
className,
|
|
145
|
+
'duration-100'
|
|
146
|
+
)}
|
|
147
|
+
>
|
|
148
|
+
{/* Name field */}
|
|
149
|
+
<div className="flex flex-col gap-[10px] w-full">
|
|
150
|
+
<p className="text-[14px] text-[#030303] font-bold leading-normal">名称</p>
|
|
151
|
+
<input
|
|
152
|
+
type="text"
|
|
153
|
+
value={nameVal}
|
|
154
|
+
onChange={(e) => {
|
|
155
|
+
setNameVal(e.target.value);
|
|
156
|
+
}}
|
|
157
|
+
onBlur={() => {
|
|
158
|
+
onNameChange?.(nameVal);
|
|
159
|
+
}}
|
|
160
|
+
className={cn(
|
|
161
|
+
'bg-white border border-[#e0e0e0] rounded-[4px] h-[34px] px-[10px] py-[7px] w-full',
|
|
162
|
+
'text-[14px] text-[#030303] leading-normal outline-none',
|
|
163
|
+
'focus:border-[#0265ff]',
|
|
164
|
+
'hover:border-[#0265ff]',
|
|
165
|
+
transCls
|
|
166
|
+
)}
|
|
167
|
+
/>
|
|
168
|
+
</div>
|
|
169
|
+
|
|
170
|
+
{/* Icon field */}
|
|
171
|
+
<div className="flex flex-col gap-[10px] w-full">
|
|
172
|
+
<p className="text-[14px] text-[#030303] font-bold leading-normal">图标</p>
|
|
173
|
+
<div className="relative" style={{ zIndex: 10 }}>
|
|
174
|
+
<button
|
|
175
|
+
onClick={() => setIsDropdownOpen(!isDropdownOpen)}
|
|
176
|
+
className={cn(
|
|
177
|
+
'bg-white border border-[#e0e0e0] rounded-[4px] h-[34px] px-[10px] py-[7px] w-full',
|
|
178
|
+
'flex items-center justify-between cursor-pointer',
|
|
179
|
+
'hover:border-[#0265ff]',
|
|
180
|
+
transCls
|
|
181
|
+
)}
|
|
182
|
+
>
|
|
183
|
+
{/* Selected icon */}
|
|
184
|
+
<div className="flex items-center">
|
|
185
|
+
<FormIcon size={16} code={iconOpt?.code} />
|
|
186
|
+
</div>
|
|
187
|
+
|
|
188
|
+
{/* Dropdown arrow */}
|
|
189
|
+
<div className={cn('text-[#666]', transCls, isDropdownOpen && 'rotate-180')}>
|
|
190
|
+
<ChevronDownIcon size={16} />
|
|
191
|
+
</div>
|
|
192
|
+
</button>
|
|
193
|
+
|
|
194
|
+
{/* Dropdown menu - Grid layout matching Figma design */}
|
|
195
|
+
{isDropdownOpen && iconOptions.length > 0 && (
|
|
196
|
+
<div
|
|
197
|
+
className={cn(
|
|
198
|
+
'absolute top-full left-0 mt-[4px] bg-white rounded-[10px] shadow-md z-10 p-[12px]',
|
|
199
|
+
transCls
|
|
200
|
+
)}
|
|
201
|
+
>
|
|
202
|
+
<div className="grid grid-cols-6 gap-[8px]">
|
|
203
|
+
{iconOptions.map((option) => (
|
|
204
|
+
<button
|
|
205
|
+
key={option.id}
|
|
206
|
+
onClick={() => {
|
|
207
|
+
onIconChange?.(option);
|
|
208
|
+
setIconOpt(option);
|
|
209
|
+
setIsDropdownOpen(false);
|
|
210
|
+
}}
|
|
211
|
+
className={cn(
|
|
212
|
+
'aspect-square rounded-[9.5px] border flex items-center justify-center cursor-pointer overflow-hidden',
|
|
213
|
+
iconOpt?.id === option.id
|
|
214
|
+
? 'border-[#0265ff] border-2'
|
|
215
|
+
: 'border-[#e0e0e0] hover:bg-[#eff0f6]',
|
|
216
|
+
transCls
|
|
217
|
+
)}
|
|
218
|
+
title={option.label}
|
|
219
|
+
>
|
|
220
|
+
<FormIcon
|
|
221
|
+
code={option.code}
|
|
222
|
+
style={{ background: 'transparent', color: '#0265ff' }}
|
|
223
|
+
/>
|
|
224
|
+
</button>
|
|
225
|
+
))}
|
|
226
|
+
</div>
|
|
227
|
+
</div>
|
|
228
|
+
)}
|
|
229
|
+
</div>
|
|
230
|
+
</div>
|
|
231
|
+
|
|
232
|
+
{/* Confirm button */}
|
|
233
|
+
<PrimaryConfirmBtn
|
|
234
|
+
text="确认"
|
|
235
|
+
onClick={() => {
|
|
236
|
+
onConfirm?.(nameVal, iconOpt?.value || 25);
|
|
237
|
+
setExpanded(false);
|
|
238
|
+
}}
|
|
239
|
+
/>
|
|
240
|
+
</div>
|
|
241
|
+
);
|
|
242
|
+
},
|
|
243
|
+
(p1, p2) => {
|
|
244
|
+
return (
|
|
245
|
+
p1.name === p2.name &&
|
|
246
|
+
p1.selectedIcon?.id === p2.selectedIcon?.id &&
|
|
247
|
+
p1.expanded === p2.expanded &&
|
|
248
|
+
p1.iconOptions === p2.iconOptions
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
);
|
|
252
|
+
|
|
253
|
+
export default FormInfoEditor;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { cn } from '../lib/utils';
|
|
2
|
+
import { type FormulaOp, FORMULA_OP_LABEL } from '@baishuyun/types';
|
|
3
|
+
|
|
4
|
+
/** 统计方式 → 背景色 */
|
|
5
|
+
const FORMULA_OP_COLOR: Record<FormulaOp, string> = {
|
|
6
|
+
sum: '#3767F1',
|
|
7
|
+
max: '#F06648',
|
|
8
|
+
min: '#4ACC8C',
|
|
9
|
+
average: '#4AC0EC',
|
|
10
|
+
count: '#9362CE',
|
|
11
|
+
countDistinct: '#F168B6',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export interface FormulaTagProps {
|
|
15
|
+
/** 统计方式 */
|
|
16
|
+
type: FormulaOp;
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const FormulaTag = ({ type, className }: FormulaTagProps) => {
|
|
21
|
+
return (
|
|
22
|
+
<span
|
|
23
|
+
className={cn(
|
|
24
|
+
'inline-flex items-center justify-center rounded-[100px] px-[6px] text-[14px] leading-[20px] text-white',
|
|
25
|
+
className
|
|
26
|
+
)}
|
|
27
|
+
style={{ backgroundColor: FORMULA_OP_COLOR[type] }}
|
|
28
|
+
>
|
|
29
|
+
{FORMULA_OP_LABEL[type]}
|
|
30
|
+
</span>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import classNames from "classnames";
|
|
2
|
+
|
|
3
|
+
export const GenerateAnimation = (props: { children?: React.ReactNode, className?: string }) => {
|
|
4
|
+
return (
|
|
5
|
+
<div className={classNames("flex items-center gap-[6px]", props.className)}>
|
|
6
|
+
<div className="flex gap-[2px] flex-shrink-0" style={{ marginRight: '6px' }}>
|
|
7
|
+
<div
|
|
8
|
+
className="w-[5px] h-[5px] rounded-full bg-[#999] flex-shrink-0"
|
|
9
|
+
style={{
|
|
10
|
+
animation: 'pulse 1.0s ease-in-out infinite',
|
|
11
|
+
animationDelay: '0s',
|
|
12
|
+
width: '5px',
|
|
13
|
+
height: '5px',
|
|
14
|
+
background: '#999',
|
|
15
|
+
marginRight: '3px',
|
|
16
|
+
}}
|
|
17
|
+
/>
|
|
18
|
+
<div
|
|
19
|
+
className="w-[5px] h-[5px] rounded-full bg-[#999] flex-shrink-0"
|
|
20
|
+
style={{
|
|
21
|
+
animation: 'pulse 1.0s ease-in-out infinite',
|
|
22
|
+
width: '5px',
|
|
23
|
+
height: '5px',
|
|
24
|
+
background: '#999',
|
|
25
|
+
animationDelay: '0.2s',
|
|
26
|
+
marginRight: '3px',
|
|
27
|
+
}}
|
|
28
|
+
/>
|
|
29
|
+
<div
|
|
30
|
+
className="w-[5px] h-[5px] rounded-full bg-[#999] flex-shrink-0"
|
|
31
|
+
style={{
|
|
32
|
+
animation: 'pulse 1.0s ease-in-out infinite',
|
|
33
|
+
width: '5px',
|
|
34
|
+
height: '5px',
|
|
35
|
+
marginRight: '3px',
|
|
36
|
+
background: '#999',
|
|
37
|
+
animationDelay: '0.4s',
|
|
38
|
+
}}
|
|
39
|
+
/>
|
|
40
|
+
</div>
|
|
41
|
+
<span className="text-[14px] text-[#999]">{props.children || '生成中'}</span>
|
|
42
|
+
<style>{`
|
|
43
|
+
@keyframes pulse {
|
|
44
|
+
0%, 60%, 100% {
|
|
45
|
+
opacity: 0.3;
|
|
46
|
+
transform: scale(1);
|
|
47
|
+
}
|
|
48
|
+
30% {
|
|
49
|
+
opacity: 1;
|
|
50
|
+
transform: scale(1.2);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
`}</style>
|
|
54
|
+
</div>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ReactNode, forwardRef } from 'react';
|
|
2
|
+
import { Button, ButtonProps } from './ui/button';
|
|
3
|
+
import { cn } from '../lib/utils';
|
|
4
|
+
import { transCls } from '../const/ui';
|
|
5
|
+
import { BsTooltip } from './tooltip';
|
|
6
|
+
|
|
7
|
+
export interface IconBtnProps extends ButtonProps {
|
|
8
|
+
icon: ReactNode;
|
|
9
|
+
rounded?: boolean;
|
|
10
|
+
tooltip?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const IconBtn = forwardRef<HTMLButtonElement, IconBtnProps>(
|
|
14
|
+
({ icon, className, tooltip, size, rounded, ...rest }, ref) => {
|
|
15
|
+
const btn = (
|
|
16
|
+
<Button
|
|
17
|
+
ref={ref}
|
|
18
|
+
variant="ghost"
|
|
19
|
+
size="icon"
|
|
20
|
+
className={cn(
|
|
21
|
+
'p-2.5',
|
|
22
|
+
{
|
|
23
|
+
'rounded-full w-[26px] h-[26px] aspect-square !text-[#121111]': rounded,
|
|
24
|
+
'rounded-[4px]': !rounded,
|
|
25
|
+
},
|
|
26
|
+
'cursor-pointer',
|
|
27
|
+
'hover:!bg-[#EFF0F6]',
|
|
28
|
+
className,
|
|
29
|
+
transCls
|
|
30
|
+
)}
|
|
31
|
+
{...rest}
|
|
32
|
+
>
|
|
33
|
+
{icon}
|
|
34
|
+
</Button>
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
if (tooltip) {
|
|
38
|
+
return <BsTooltip content={tooltip}>{btn}</BsTooltip>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return btn;
|
|
42
|
+
}
|
|
43
|
+
);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { cn } from '../lib/utils';
|
|
2
|
+
|
|
3
|
+
export interface ImgMsgPartProps {
|
|
4
|
+
url: string;
|
|
5
|
+
alt?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
/** Size in pixels (width & height), defaults to 102 */
|
|
8
|
+
size?: number;
|
|
9
|
+
onClick?: () => void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const ImgMsgPart = ({ url, alt = '', className, size = 102, onClick }: ImgMsgPartProps) => {
|
|
13
|
+
return (
|
|
14
|
+
<div
|
|
15
|
+
className={cn('relative overflow-hidden rounded-[10px] border border-[#e0e0e0] hover:border-[#0265FF]/20 hover:cursor-pointer', onClick && 'cursor-pointer', className)}
|
|
16
|
+
style={{ width: size, height: size }}
|
|
17
|
+
onClick={onClick}
|
|
18
|
+
>
|
|
19
|
+
<img
|
|
20
|
+
src={url}
|
|
21
|
+
alt={alt}
|
|
22
|
+
className="block w-full h-full object-cover rounded-[10px]"
|
|
23
|
+
loading="lazy"
|
|
24
|
+
/>
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
27
|
+
};
|