@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,270 @@
|
|
|
1
|
+
import { useState, useCallback } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { IconBtn } from './icon-btn';
|
|
4
|
+
import { BackIcon, InfoIcon } from './bs-icons';
|
|
5
|
+
import { LinearGradientColorBgAnimation } from './linear-gradient-color-bg-animation';
|
|
6
|
+
import { ConfirmDialog } from './confirm-dialog';
|
|
7
|
+
import { Spinner } from './ui/spinner';
|
|
8
|
+
import { BaseButton } from './base-button';
|
|
9
|
+
import { BrushIcon } from './bs-icons';
|
|
10
|
+
import { cn } from '../lib/utils';
|
|
11
|
+
|
|
12
|
+
export interface PreviewerHeaderProps {
|
|
13
|
+
title: string;
|
|
14
|
+
tips?: string;
|
|
15
|
+
active?: boolean;
|
|
16
|
+
className?: string;
|
|
17
|
+
onBackClick?: () => void;
|
|
18
|
+
onSave?: (isConfirm?: boolean) => void;
|
|
19
|
+
onCancel?: () => void;
|
|
20
|
+
onClear?: () => void;
|
|
21
|
+
style?: React.CSSProperties;
|
|
22
|
+
|
|
23
|
+
confirmTitle?: string;
|
|
24
|
+
confirmContent?: string;
|
|
25
|
+
dialogContainer?: HTMLElement;
|
|
26
|
+
variant?: 'fields-previewer' | 'data-previewer';
|
|
27
|
+
closeBtnLabel?: string;
|
|
28
|
+
|
|
29
|
+
disableConfirm?: boolean;
|
|
30
|
+
|
|
31
|
+
disableOperation?: boolean;
|
|
32
|
+
|
|
33
|
+
customOperationElement?: React.ReactNode;
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const PreviewerHeader = ({
|
|
38
|
+
title,
|
|
39
|
+
tips,
|
|
40
|
+
style,
|
|
41
|
+
confirmContent,
|
|
42
|
+
confirmTitle,
|
|
43
|
+
className,
|
|
44
|
+
active,
|
|
45
|
+
onBackClick,
|
|
46
|
+
onSave,
|
|
47
|
+
closeBtnLabel,
|
|
48
|
+
onCancel,
|
|
49
|
+
onClear,
|
|
50
|
+
variant = 'fields-previewer',
|
|
51
|
+
dialogContainer,
|
|
52
|
+
disableConfirm,
|
|
53
|
+
disableOperation,
|
|
54
|
+
customOperationElement,
|
|
55
|
+
}: PreviewerHeaderProps) => {
|
|
56
|
+
const [showConfirmDialog, setShowConfirmDialog] = useState(false);
|
|
57
|
+
|
|
58
|
+
const [loading, setLoading] = useState(false);
|
|
59
|
+
|
|
60
|
+
const [portalContainer, setPortalContainer] = useState<HTMLElement | null>(null);
|
|
61
|
+
|
|
62
|
+
const setRootRef = useCallback((node: HTMLElement | null) => {
|
|
63
|
+
if (!node) {
|
|
64
|
+
setPortalContainer(null);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const rootNode = node.getRootNode();
|
|
68
|
+
if (rootNode instanceof ShadowRoot) {
|
|
69
|
+
const existing = rootNode.querySelector<HTMLElement>('[data-bs-dialog-portal]');
|
|
70
|
+
if (existing) {
|
|
71
|
+
setPortalContainer(existing);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const container = document.createElement('div');
|
|
75
|
+
container.setAttribute('data-bs-dialog-portal', 'true');
|
|
76
|
+
rootNode.appendChild(container);
|
|
77
|
+
setPortalContainer(container);
|
|
78
|
+
} else {
|
|
79
|
+
setPortalContainer(null);
|
|
80
|
+
}
|
|
81
|
+
}, []);
|
|
82
|
+
|
|
83
|
+
const btnResetStyle = classNames(
|
|
84
|
+
'w-[94px] h-[34px] flex items-center justify-center rounded-[4px]'
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
const isData = variant === 'data-previewer';
|
|
88
|
+
const isFields = variant === 'fields-previewer';
|
|
89
|
+
|
|
90
|
+
const titleCls = classNames('font-[700]', {
|
|
91
|
+
'text-[16px]': isFields,
|
|
92
|
+
'text-[18px]': isData,
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const effectiveContainer = dialogContainer || portalContainer || undefined;
|
|
96
|
+
|
|
97
|
+
const operations = customOperationElement ? (
|
|
98
|
+
customOperationElement
|
|
99
|
+
) : (
|
|
100
|
+
<div className="flex items-center gap-[10px]">
|
|
101
|
+
{onClear && (
|
|
102
|
+
<BaseButton
|
|
103
|
+
className={cn('w-[34px] h-[34px] text-[#8d8d8d] p-0 flex items-center justify-center hover:border-[#e0e0e0] hover:text-[#8d8d8d] border border-solid border-[#e0e0e0] ', {
|
|
104
|
+
'pointer-events-none opacity-50': disableOperation || loading,
|
|
105
|
+
})}
|
|
106
|
+
tooltip='清除全部'
|
|
107
|
+
icon={<BrushIcon />}
|
|
108
|
+
onClick={() => {
|
|
109
|
+
onClear?.();
|
|
110
|
+
}}
|
|
111
|
+
/>
|
|
112
|
+
)}
|
|
113
|
+
|
|
114
|
+
{onSave && (
|
|
115
|
+
<button
|
|
116
|
+
onClick={async () => {
|
|
117
|
+
setLoading(true);
|
|
118
|
+
try {
|
|
119
|
+
await onSave();
|
|
120
|
+
} catch (error) {
|
|
121
|
+
console.error('Save failed:', error);
|
|
122
|
+
} finally {
|
|
123
|
+
setLoading(false);
|
|
124
|
+
}
|
|
125
|
+
}}
|
|
126
|
+
className={classNames(
|
|
127
|
+
btnResetStyle,
|
|
128
|
+
'flex items-center gap-[6px]',
|
|
129
|
+
'bg-[#0265FF] hover:opacity-90 text-white text-[14px]',
|
|
130
|
+
{
|
|
131
|
+
'w-[115px]': isData,
|
|
132
|
+
'pointer-events-none opacity-50': disableOperation || loading,
|
|
133
|
+
}
|
|
134
|
+
)}
|
|
135
|
+
>
|
|
136
|
+
{loading ? <Spinner /> : null}
|
|
137
|
+
{isFields ? '保存' : '添加到表单'}
|
|
138
|
+
</button>
|
|
139
|
+
)}
|
|
140
|
+
{onCancel && (
|
|
141
|
+
<button
|
|
142
|
+
onClick={() => {
|
|
143
|
+
// if (disableOperation) {
|
|
144
|
+
// return;
|
|
145
|
+
// }
|
|
146
|
+
|
|
147
|
+
if (disableConfirm) {
|
|
148
|
+
onCancel?.();
|
|
149
|
+
onBackClick?.();
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
setShowConfirmDialog(true);
|
|
154
|
+
}}
|
|
155
|
+
className={classNames(
|
|
156
|
+
btnResetStyle,
|
|
157
|
+
'text-[#121111] text-[14px] bg-[#fff] border border-solid border-[#e0e0e0] hover:bg-[#f0f0f0]',
|
|
158
|
+
{
|
|
159
|
+
'pointer-events-none opacity-50': loading,
|
|
160
|
+
}
|
|
161
|
+
)}
|
|
162
|
+
>
|
|
163
|
+
{closeBtnLabel || '取消'}
|
|
164
|
+
</button>
|
|
165
|
+
)}
|
|
166
|
+
</div>
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
const contentJsx = (
|
|
170
|
+
<>
|
|
171
|
+
<div className="flex items-center gap-3">
|
|
172
|
+
{isData ? null : (
|
|
173
|
+
<IconBtn
|
|
174
|
+
icon={<BackIcon />}
|
|
175
|
+
onClick={() => {
|
|
176
|
+
// if (disableOperation) {
|
|
177
|
+
// return;
|
|
178
|
+
// }
|
|
179
|
+
|
|
180
|
+
if (disableConfirm) {
|
|
181
|
+
onCancel?.();
|
|
182
|
+
onBackClick?.();
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
setShowConfirmDialog(true);
|
|
187
|
+
}}
|
|
188
|
+
className="text-[#0265FF] hover:text-[#0265FF]"
|
|
189
|
+
/>
|
|
190
|
+
)}
|
|
191
|
+
<span className={titleCls}>{title}</span>
|
|
192
|
+
{tips && active && (
|
|
193
|
+
<div className="flex items-center gap-[6px] text-[#999999] text-[12px]">
|
|
194
|
+
<InfoIcon />
|
|
195
|
+
{tips}
|
|
196
|
+
</div>
|
|
197
|
+
)}
|
|
198
|
+
</div>
|
|
199
|
+
{operations}
|
|
200
|
+
<ConfirmDialog
|
|
201
|
+
container={effectiveContainer}
|
|
202
|
+
open={showConfirmDialog}
|
|
203
|
+
onOpenChange={setShowConfirmDialog}
|
|
204
|
+
title={confirmTitle || 'AI表单搭建有修改,是否保存?'}
|
|
205
|
+
description={confirmContent || '您修改了AI表单搭建但没有保存,是否需要保存并继续?'}
|
|
206
|
+
onLinkClick={() => setShowConfirmDialog(false)}
|
|
207
|
+
onCancel={() => {
|
|
208
|
+
setShowConfirmDialog(false);
|
|
209
|
+
onCancel?.();
|
|
210
|
+
onBackClick?.();
|
|
211
|
+
}}
|
|
212
|
+
onConfirm={async () => {
|
|
213
|
+
setShowConfirmDialog(false);
|
|
214
|
+
setLoading(true);
|
|
215
|
+
try {
|
|
216
|
+
await onSave?.(true);
|
|
217
|
+
} catch (error) {
|
|
218
|
+
console.error('Save failed:', error);
|
|
219
|
+
} finally {
|
|
220
|
+
setLoading(false);
|
|
221
|
+
}
|
|
222
|
+
}}
|
|
223
|
+
/>
|
|
224
|
+
</>
|
|
225
|
+
);
|
|
226
|
+
|
|
227
|
+
const borderCls = classNames({
|
|
228
|
+
'border-b border-solid border-[#e0e0e0]': !active && isFields,
|
|
229
|
+
'border-none': isData,
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
if (active) {
|
|
233
|
+
return (
|
|
234
|
+
<div ref={setRootRef}>
|
|
235
|
+
<LinearGradientColorBgAnimation
|
|
236
|
+
height={52}
|
|
237
|
+
style={style}
|
|
238
|
+
childrenContainerStyle={{
|
|
239
|
+
display: 'flex',
|
|
240
|
+
alignItems: 'center',
|
|
241
|
+
justifyContent: 'space-between',
|
|
242
|
+
padding: '0 20px',
|
|
243
|
+
}}
|
|
244
|
+
>
|
|
245
|
+
{contentJsx}
|
|
246
|
+
</LinearGradientColorBgAnimation>
|
|
247
|
+
</div>
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
const paddingCls = classNames({
|
|
252
|
+
'px-[20px]': isFields,
|
|
253
|
+
'px-[10px]': isData,
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
return (
|
|
257
|
+
<div
|
|
258
|
+
ref={setRootRef}
|
|
259
|
+
style={style}
|
|
260
|
+
className={classNames(
|
|
261
|
+
'w-full h-[52px] flex items-center justify-between',
|
|
262
|
+
paddingCls,
|
|
263
|
+
className,
|
|
264
|
+
borderCls
|
|
265
|
+
)}
|
|
266
|
+
>
|
|
267
|
+
{contentJsx}
|
|
268
|
+
</div>
|
|
269
|
+
);
|
|
270
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Button, ButtonProps } from './ui/button';
|
|
2
|
+
import { cn } from '../lib/utils';
|
|
3
|
+
import { transCls } from '../const/ui';
|
|
4
|
+
|
|
5
|
+
export interface PrimaryConfirmBtnProps extends ButtonProps {
|
|
6
|
+
text?: string;
|
|
7
|
+
prefixDesc?: string;
|
|
8
|
+
icon?: React.ReactNode;
|
|
9
|
+
disabledWithInfo?: boolean;
|
|
10
|
+
light?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const PrimaryConfirmBtn = ({
|
|
14
|
+
text = '确认',
|
|
15
|
+
prefixDesc,
|
|
16
|
+
className,
|
|
17
|
+
disabled,
|
|
18
|
+
light,
|
|
19
|
+
icon,
|
|
20
|
+
children,
|
|
21
|
+
...rest
|
|
22
|
+
}: PrimaryConfirmBtnProps) => {
|
|
23
|
+
const btn = (
|
|
24
|
+
<Button
|
|
25
|
+
{...rest}
|
|
26
|
+
variant="default"
|
|
27
|
+
disabled={disabled}
|
|
28
|
+
className={cn(
|
|
29
|
+
'px-[10px] py-0 rounded-[100px] text-[14px] leading-normal h-[34px] min-w-[100px] cursor-pointer w-full disabled:opacity-100 gap-[6px] shadow-none',
|
|
30
|
+
disabled
|
|
31
|
+
? 'bg-[#f0f0f0] text-[#999] cursor-not-allowed shadow-none'
|
|
32
|
+
: light
|
|
33
|
+
? 'bg-[#F0F6FF] text-[#0265FF] hover:bg-[#0265FF] hover:text-white'
|
|
34
|
+
: 'bg-[#0265ff] text-white hover:bg-[#0265ff]/80',
|
|
35
|
+
|
|
36
|
+
transCls,
|
|
37
|
+
{
|
|
38
|
+
'!bg-[#E5E6EB] !text-[#121111] shadow-none font-[400]': rest.disabledWithInfo,
|
|
39
|
+
},
|
|
40
|
+
className
|
|
41
|
+
)}
|
|
42
|
+
>
|
|
43
|
+
{icon}
|
|
44
|
+
{children || text}
|
|
45
|
+
</Button>
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
if (!prefixDesc) {
|
|
49
|
+
return btn;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<div className="flex flex-col items-start gap-2.5">
|
|
54
|
+
<p className="text-[#4D609F]">{prefixDesc}</p>
|
|
55
|
+
{btn}
|
|
56
|
+
</div>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Button, ButtonProps } from './ui/button';
|
|
3
|
+
import { BotIcon } from './bot-icon';
|
|
4
|
+
import { cn } from '../lib/utils';
|
|
5
|
+
import { transCls } from '../const/ui';
|
|
6
|
+
|
|
7
|
+
export interface PrimaryEntryBtnProps extends ButtonProps {
|
|
8
|
+
minimal?: boolean;
|
|
9
|
+
entryVariant?: 'default' | 'ghost' | 'selected' | 'light';
|
|
10
|
+
icon?: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const PrimaryEntryBtn = ({
|
|
14
|
+
children,
|
|
15
|
+
className,
|
|
16
|
+
minimal,
|
|
17
|
+
entryVariant = 'default',
|
|
18
|
+
icon,
|
|
19
|
+
...rest
|
|
20
|
+
}: PrimaryEntryBtnProps) => {
|
|
21
|
+
const variantStyles = {
|
|
22
|
+
// background: linear-gradient(180deg, #267AFF 0%, #B2EEFF 100%);
|
|
23
|
+
default:
|
|
24
|
+
"relative overflow-hidden bg-[linear-gradient(180deg,#DBE9FF_0%,#E9FFFD_100%)] h-[30px] hover:text-white before:content-[''] before:absolute before:inset-0 before:z-0 before:bg-[linear-gradient(180deg,#267AFF_0%,#B2EEFF_100%)] before:opacity-0 hover:before:opacity-100 before:transition-opacity before:duration-200 before:ease-out font-[500] text-[#0265ff]",
|
|
25
|
+
ghost: 'bg-transparent text-[#030303] font-[400] px-[10px] hover:bg-[#EFF0F6] h-[34px]',
|
|
26
|
+
light: 'text-[#030303] font-[400] px-[10px] bg-[#F0F6FF] hover:bg-[#d8dde5] h-[34px]',
|
|
27
|
+
selected: 'bg-[#EFF0F6] text-[#030303] font-[400] px-[10px]',
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<Button
|
|
32
|
+
{...rest}
|
|
33
|
+
variant="entry"
|
|
34
|
+
size="entry"
|
|
35
|
+
className={cn(
|
|
36
|
+
'rounded-[4px] cursor-pointer',
|
|
37
|
+
transCls,
|
|
38
|
+
variantStyles[entryVariant],
|
|
39
|
+
className
|
|
40
|
+
)}
|
|
41
|
+
>
|
|
42
|
+
<span className="relative z-10 inline-flex items-center gap-1.5">
|
|
43
|
+
{icon ?? <BotIcon />}
|
|
44
|
+
{minimal ? null : children}
|
|
45
|
+
</span>
|
|
46
|
+
</Button>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { cn } from '../lib/utils';
|
|
2
|
+
import { transCls } from '../const/ui';
|
|
3
|
+
import { ScrollArrowDownIcon } from './bs-icons';
|
|
4
|
+
|
|
5
|
+
export interface ScrollToBottomProps {
|
|
6
|
+
onClick?: () => void;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const ScrollToBottomBtn = ({ onClick, className }: ScrollToBottomProps) => {
|
|
11
|
+
return (
|
|
12
|
+
<button
|
|
13
|
+
type="button"
|
|
14
|
+
onClick={onClick}
|
|
15
|
+
className={cn(
|
|
16
|
+
'inline-flex items-center justify-center',
|
|
17
|
+
'w-[36px] h-[36px] rounded-full',
|
|
18
|
+
'bg-white text-[#666] shadow-[0px_0px_14px_0px_rgba(0,0,0,0.1)]',
|
|
19
|
+
'hover:shadow-[0px_14px_14px_0px_rgba(0,0,0,0.14)]',
|
|
20
|
+
'cursor-pointer hover:text-[#333] aspect-square',
|
|
21
|
+
transCls,
|
|
22
|
+
className
|
|
23
|
+
)}
|
|
24
|
+
>
|
|
25
|
+
<ScrollArrowDownIcon />
|
|
26
|
+
</button>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
3
|
+
import { cn } from '../lib/utils';
|
|
4
|
+
import { CheckerInBoxIcon } from './bs-icons';
|
|
5
|
+
|
|
6
|
+
const SquareInBoxIcon = () => {
|
|
7
|
+
// size 8, border 1px svg
|
|
8
|
+
return (
|
|
9
|
+
<svg
|
|
10
|
+
width="8"
|
|
11
|
+
height="8"
|
|
12
|
+
viewBox="0 0 8 8"
|
|
13
|
+
// fill="currentColor"
|
|
14
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
+
>
|
|
16
|
+
<rect x="0.5" y="0.5" width="7" height="7" rx="1" fill="#0265ff" />
|
|
17
|
+
</svg>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type SquareCheckerProps = React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root> & {
|
|
22
|
+
/** Optional label rendered beside the checkbox */
|
|
23
|
+
children?: React.ReactNode;
|
|
24
|
+
readonly?: boolean;
|
|
25
|
+
intermediate?: boolean;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const SquareChecker = React.forwardRef<
|
|
29
|
+
React.ElementRef<typeof CheckboxPrimitive.Root>,
|
|
30
|
+
SquareCheckerProps
|
|
31
|
+
>(({ className, children, id, readonly, disabled, intermediate, ...props }, ref) => {
|
|
32
|
+
const generatedId = React.useId();
|
|
33
|
+
const checkboxId = id ?? generatedId;
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<label
|
|
37
|
+
htmlFor={checkboxId}
|
|
38
|
+
className={cn(
|
|
39
|
+
'inline-flex items-center gap-[6px] select-none text-[#121111] text-[14px]',
|
|
40
|
+
disabled ? 'cursor-not-allowed' : 'cursor-pointer',
|
|
41
|
+
{
|
|
42
|
+
'pointer-events-none': readonly,
|
|
43
|
+
}
|
|
44
|
+
)}
|
|
45
|
+
>
|
|
46
|
+
<CheckboxPrimitive.Root
|
|
47
|
+
ref={ref}
|
|
48
|
+
id={checkboxId}
|
|
49
|
+
disabled={disabled}
|
|
50
|
+
className={cn(
|
|
51
|
+
// base layout
|
|
52
|
+
'inline-flex shrink-0 items-center justify-center',
|
|
53
|
+
'w-[16px] h-[16px] rounded-[2px] box-border border',
|
|
54
|
+
'transition-colors duration-200',
|
|
55
|
+
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#0265FF] focus-visible:ring-offset-1',
|
|
56
|
+
// normal: gray border, white bg
|
|
57
|
+
'border-[#E0E0E0] bg-white',
|
|
58
|
+
// hover: blue border (browsers suppress hover on disabled <button>)
|
|
59
|
+
'hover:border-[#0265FF]',
|
|
60
|
+
// checked: blue fill
|
|
61
|
+
'data-[state=checked]:bg-[#0265FF] data-[state=checked]:border-[#0265FF]',
|
|
62
|
+
// disabled unchecked: gray bg + gray border
|
|
63
|
+
'disabled:cursor-not-allowed disabled:bg-[#F0F0F0] disabled:border-[#C2C2C2]',
|
|
64
|
+
// disabled checked: use muted gray fill
|
|
65
|
+
'disabled:data-[state=checked]:bg-[#C2C2C2] disabled:data-[state=checked]:border-[#C2C2C2]',
|
|
66
|
+
// indeterminate: blue fill
|
|
67
|
+
intermediate && 'bg-white border-[#0265FF] text-[#0265FF]',
|
|
68
|
+
className,
|
|
69
|
+
{
|
|
70
|
+
'opacity-50': readonly,
|
|
71
|
+
}
|
|
72
|
+
)}
|
|
73
|
+
{...props}
|
|
74
|
+
>
|
|
75
|
+
<CheckboxPrimitive.Indicator className="text-white" forceMount={intermediate || undefined}>
|
|
76
|
+
{intermediate ? <SquareInBoxIcon /> : <CheckerInBoxIcon />}
|
|
77
|
+
</CheckboxPrimitive.Indicator>
|
|
78
|
+
</CheckboxPrimitive.Root>
|
|
79
|
+
|
|
80
|
+
{children != null && (
|
|
81
|
+
<span className={cn('text-sm leading-none', disabled && 'text-[#C2C2C2]')}>{children}</span>
|
|
82
|
+
)}
|
|
83
|
+
</label>
|
|
84
|
+
);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
SquareChecker.displayName = 'SquareChecker';
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
3
|
+
|
|
4
|
+
import { cn } from '../lib/utils';
|
|
5
|
+
import { BsTooltip } from './tooltip';
|
|
6
|
+
|
|
7
|
+
export interface TabRadioOption {
|
|
8
|
+
value: string;
|
|
9
|
+
label: React.ReactNode;
|
|
10
|
+
tooltips?: string;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface TabRadioGroupProps extends Omit<
|
|
15
|
+
React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>,
|
|
16
|
+
'children'
|
|
17
|
+
> {
|
|
18
|
+
options: TabRadioOption[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const TabRadioGroup = React.forwardRef<
|
|
22
|
+
React.ElementRef<typeof RadioGroupPrimitive.Root>,
|
|
23
|
+
TabRadioGroupProps
|
|
24
|
+
>(({ className, options, ...props }, ref) => {
|
|
25
|
+
return (
|
|
26
|
+
<RadioGroupPrimitive.Root
|
|
27
|
+
ref={ref}
|
|
28
|
+
className={cn(
|
|
29
|
+
'flex flex-col items-start justify-center p-[2px] rounded-[4px] bg-[#EFF0F6]',
|
|
30
|
+
className
|
|
31
|
+
)}
|
|
32
|
+
{...props}
|
|
33
|
+
>
|
|
34
|
+
<div className="flex gap-[2px] items-center w-full">
|
|
35
|
+
{options.map((option) => (
|
|
36
|
+
<TabRadioItem
|
|
37
|
+
key={option.value}
|
|
38
|
+
value={option.value}
|
|
39
|
+
tooltips={option.tooltips}
|
|
40
|
+
className={option.className}
|
|
41
|
+
>
|
|
42
|
+
{option.label}
|
|
43
|
+
</TabRadioItem>
|
|
44
|
+
))}
|
|
45
|
+
</div>
|
|
46
|
+
</RadioGroupPrimitive.Root>
|
|
47
|
+
);
|
|
48
|
+
});
|
|
49
|
+
TabRadioGroup.displayName = 'TabRadioGroup';
|
|
50
|
+
|
|
51
|
+
interface TabRadioItemProps extends React.ComponentPropsWithoutRef<
|
|
52
|
+
typeof RadioGroupPrimitive.Item
|
|
53
|
+
> {
|
|
54
|
+
children: React.ReactNode;
|
|
55
|
+
tooltips?: string;
|
|
56
|
+
className?: string;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const TabRadioItem = React.forwardRef<
|
|
60
|
+
React.ElementRef<typeof RadioGroupPrimitive.Item>,
|
|
61
|
+
TabRadioItemProps
|
|
62
|
+
>(({ className, children, tooltips, ...props }, ref) => {
|
|
63
|
+
return (
|
|
64
|
+
<RadioGroupPrimitive.Item
|
|
65
|
+
ref={ref}
|
|
66
|
+
className={cn(
|
|
67
|
+
'flex-1 h-[30px] flex items-center justify-center px-[10px] py-[7px] rounded-[4px] text-[14px] text-[#121111] cursor-pointer',
|
|
68
|
+
'border border-solid border-[#EFF0F6] bg-transparent',
|
|
69
|
+
'transition-all ease-out duration-200',
|
|
70
|
+
'outline-none',
|
|
71
|
+
'hover:text-[#121111] hover:border-[#E0E0E0] hover:bg-white',
|
|
72
|
+
'data-[state=checked]:text-[#0265FF] data-[state=checked]:border-[#E0E0E0] data-[state=checked]:bg-white',
|
|
73
|
+
className
|
|
74
|
+
)}
|
|
75
|
+
{...props}
|
|
76
|
+
>
|
|
77
|
+
{tooltips ? <BsTooltip content={tooltips}>{children}</BsTooltip> : children}
|
|
78
|
+
</RadioGroupPrimitive.Item>
|
|
79
|
+
);
|
|
80
|
+
});
|
|
81
|
+
TabRadioItem.displayName = 'TabRadioItem';
|
|
82
|
+
|
|
83
|
+
export { TabRadioGroup, TabRadioItem };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from './ui/tooltip';
|
|
3
|
+
|
|
4
|
+
export const BsTooltip = ({
|
|
5
|
+
children,
|
|
6
|
+
content,
|
|
7
|
+
}: {
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
content: React.ReactNode;
|
|
10
|
+
}) => {
|
|
11
|
+
const triggerRef = useRef<HTMLSpanElement | null>(null);
|
|
12
|
+
const [portalContainer, setPortalContainer] = useState<HTMLElement | null>(null);
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const triggerEl = triggerRef.current;
|
|
16
|
+
if (!triggerEl) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const rootNode = triggerEl.getRootNode();
|
|
21
|
+
if (rootNode instanceof ShadowRoot) {
|
|
22
|
+
const existing = rootNode.querySelector<HTMLElement>('[data-bs-tooltip-portal]');
|
|
23
|
+
if (existing) {
|
|
24
|
+
setPortalContainer(existing);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const container = document.createElement('div');
|
|
29
|
+
container.setAttribute('data-bs-tooltip-portal', 'true');
|
|
30
|
+
rootNode.appendChild(container);
|
|
31
|
+
setPortalContainer(container);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
setPortalContainer(null);
|
|
36
|
+
}, []);
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<Tooltip>
|
|
40
|
+
<TooltipTrigger asChild>
|
|
41
|
+
<span ref={triggerRef} className="inline-flex">
|
|
42
|
+
{children}
|
|
43
|
+
</span>
|
|
44
|
+
</TooltipTrigger>
|
|
45
|
+
<TooltipContent
|
|
46
|
+
portalContainer={portalContainer}
|
|
47
|
+
className="rounded-[4px] bg-[#525867] px-[12px] !py-[7px] text-[12px] text-white leading-normal max-w-[288px] animate-in fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 duration-200"
|
|
48
|
+
>
|
|
49
|
+
{content}
|
|
50
|
+
</TooltipContent>
|
|
51
|
+
</Tooltip>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
4
|
+
|
|
5
|
+
import { cn } from '../../lib/utils';
|
|
6
|
+
|
|
7
|
+
const buttonVariants = cva(
|
|
8
|
+
'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
default: 'bg-primary text-primary-foreground shadow hover:bg-primary/90',
|
|
13
|
+
destructive: 'bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90',
|
|
14
|
+
outline:
|
|
15
|
+
'border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground',
|
|
16
|
+
secondary: 'bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80',
|
|
17
|
+
ghost: 'hover:bg-accent hover:text-accent-foreground',
|
|
18
|
+
link: 'text-primary underline-offset-4 hover:underline',
|
|
19
|
+
entry: '',
|
|
20
|
+
},
|
|
21
|
+
size: {
|
|
22
|
+
default: 'h-[34px] px-4 py-2',
|
|
23
|
+
sm: 'h-8 rounded-md px-3 text-xs',
|
|
24
|
+
lg: 'h-10 rounded-md px-8',
|
|
25
|
+
icon: 'h-[24px] w-[24px]',
|
|
26
|
+
entry: 'h-[30px] px-1.5 py-0 gap-1.5',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
defaultVariants: {
|
|
30
|
+
variant: 'default',
|
|
31
|
+
size: 'default',
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
export interface ButtonProps
|
|
37
|
+
extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
38
|
+
asChild?: boolean;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
42
|
+
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
43
|
+
const Comp = asChild ? Slot : 'button';
|
|
44
|
+
return (
|
|
45
|
+
<Comp className={cn(buttonVariants({ variant, size, className }))} ref={ref} {...props} />
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
Button.displayName = 'Button';
|
|
50
|
+
|
|
51
|
+
export { Button, buttonVariants };
|