one-design-next 0.0.4-alpha.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +32 -0
- package/dist/_util/color.d.ts +103 -0
- package/dist/_util/color.js +250 -0
- package/dist/_util/date.d.ts +53 -0
- package/dist/_util/date.js +656 -0
- package/dist/_util/focusManager.d.ts +12 -0
- package/dist/_util/focusManager.js +56 -0
- package/dist/_util/queueMtPolyfill.d.ts +5 -0
- package/dist/_util/queueMtPolyfill.js +19 -0
- package/dist/_util/time.d.ts +44 -0
- package/dist/_util/time.js +150 -0
- package/dist/_util/useActive.d.ts +6 -0
- package/dist/_util/useActive.js +25 -0
- package/dist/alert/index.d.ts +63 -0
- package/dist/alert/index.js +137 -0
- package/dist/alert/style/index.css +199 -0
- package/dist/alert/style/index.d.ts +2 -0
- package/dist/alert/style/index.js +2 -0
- package/dist/auto-complete/index.d.ts +51 -0
- package/dist/auto-complete/index.js +104 -0
- package/dist/avatar/index.d.ts +68 -0
- package/dist/avatar/index.js +177 -0
- package/dist/avatar/primitive.d.ts +6 -0
- package/dist/avatar/primitive.js +23 -0
- package/dist/avatar/style/index.css +79 -0
- package/dist/avatar/style/index.d.ts +2 -0
- package/dist/avatar/style/index.js +2 -0
- package/dist/button/index.d.ts +15 -0
- package/dist/button/index.js +64 -0
- package/dist/button/style/index.css +347 -0
- package/dist/button/style/index.d.ts +2 -0
- package/dist/button/style/index.js +2 -0
- package/dist/calendar/index.d.ts +25 -0
- package/dist/calendar/index.js +379 -0
- package/dist/calendar/style/index.css +3 -0
- package/dist/calendar/style/index.d.ts +2 -0
- package/dist/calendar/style/index.js +2 -0
- package/dist/cascader/CascaderOptionContent.d.ts +20 -0
- package/dist/cascader/CascaderOptionContent.js +75 -0
- package/dist/cascader/Panel.d.ts +53 -0
- package/dist/cascader/Panel.js +116 -0
- package/dist/cascader/index.d.ts +54 -0
- package/dist/cascader/index.js +314 -0
- package/dist/cascader/style/index.css +458 -0
- package/dist/cascader/style/index.d.ts +2 -0
- package/dist/cascader/style/index.js +2 -0
- package/dist/cascader/utils.d.ts +12 -0
- package/dist/cascader/utils.js +85 -0
- package/dist/chart/index.d.ts +14 -0
- package/dist/chart/index.js +11 -0
- package/dist/chart/style/index.css +0 -0
- package/dist/chart/style/index.d.ts +2 -0
- package/dist/chart/style/index.js +2 -0
- package/dist/checkbox/Checkbox.d.ts +69 -0
- package/dist/checkbox/Checkbox.js +148 -0
- package/dist/checkbox/Context.d.ts +21 -0
- package/dist/checkbox/Context.js +2 -0
- package/dist/checkbox/Group.d.ts +49 -0
- package/dist/checkbox/Group.js +125 -0
- package/dist/checkbox/index.d.ts +5 -0
- package/dist/checkbox/index.js +3 -0
- package/dist/checkbox/style/index.css +306 -0
- package/dist/checkbox/style/index.d.ts +2 -0
- package/dist/checkbox/style/index.js +2 -0
- package/dist/collapse/index.d.ts +43 -0
- package/dist/collapse/index.js +111 -0
- package/dist/collapse/primitive.d.ts +21 -0
- package/dist/collapse/primitive.js +107 -0
- package/dist/collapse/style/index.css +63 -0
- package/dist/collapse/style/index.d.ts +2 -0
- package/dist/collapse/style/index.js +2 -0
- package/dist/color-picker/index.d.ts +55 -0
- package/dist/color-picker/index.js +588 -0
- package/dist/color-picker/style/index.css +153 -0
- package/dist/color-picker/style/index.d.ts +2 -0
- package/dist/color-picker/style/index.js +2 -0
- package/dist/config-provider/index.d.ts +46 -0
- package/dist/config-provider/index.js +37 -0
- package/dist/date-picker/MonthPicker.d.ts +15 -0
- package/dist/date-picker/MonthPicker.js +134 -0
- package/dist/date-picker/QuarterPicker.d.ts +15 -0
- package/dist/date-picker/QuarterPicker.js +135 -0
- package/dist/date-picker/YearPicker.d.ts +13 -0
- package/dist/date-picker/YearPicker.js +81 -0
- package/dist/date-picker/index.d.ts +172 -0
- package/dist/date-picker/index.js +1138 -0
- package/dist/date-picker/style/index.css +548 -0
- package/dist/date-picker/style/index.d.ts +2 -0
- package/dist/date-picker/style/index.js +2 -0
- package/dist/date-range-picker/index.d.ts +46 -0
- package/dist/date-range-picker/index.js +1034 -0
- package/dist/dialog/index.d.ts +132 -0
- package/dist/dialog/index.js +282 -0
- package/dist/dialog/style/index.css +252 -0
- package/dist/dialog/style/index.d.ts +2 -0
- package/dist/dialog/style/index.js +2 -0
- package/dist/dialog/useModalPosition.d.ts +6 -0
- package/dist/dialog/useModalPosition.js +34 -0
- package/dist/drawer/index.d.ts +76 -0
- package/dist/drawer/index.js +186 -0
- package/dist/drawer/style/index.css +235 -0
- package/dist/drawer/style/index.d.ts +2 -0
- package/dist/drawer/style/index.js +2 -0
- package/dist/dropdown/index.d.ts +86 -0
- package/dist/dropdown/index.js +836 -0
- package/dist/dropdown/style/index.css +236 -0
- package/dist/dropdown/style/index.d.ts +2 -0
- package/dist/dropdown/style/index.js +2 -0
- package/dist/hover-fill/index.d.ts +43 -0
- package/dist/hover-fill/index.js +222 -0
- package/dist/hover-fill/style/index.css +38 -0
- package/dist/hover-fill/style/index.d.ts +2 -0
- package/dist/hover-fill/style/index.js +2 -0
- package/dist/icon/index.d.ts +11 -0
- package/dist/icon/index.js +95 -0
- package/dist/icon/style/index.css +15 -0
- package/dist/icon/style/index.d.ts +2 -0
- package/dist/icon/style/index.js +2 -0
- package/dist/icon/svg/alert/alert-circle-filled.svg +1 -0
- package/dist/icon/svg/alert/alert-circle.svg +1 -0
- package/dist/icon/svg/alert/help-circle-filled.svg +1 -0
- package/dist/icon/svg/alert/help-circle.svg +1 -0
- package/dist/icon/svg/alert/info-circle-filled.svg +1 -0
- package/dist/icon/svg/alert/info-circle.svg +1 -0
- package/dist/icon/svg/alert/stop.svg +1 -0
- package/dist/icon/svg/alert/warning-filled.svg +1 -0
- package/dist/icon/svg/alert/warning.svg +1 -0
- package/dist/icon/svg/content/QRcode.svg +1 -0
- package/dist/icon/svg/content/bell-filled.svg +1 -0
- package/dist/icon/svg/content/bell.svg +1 -0
- package/dist/icon/svg/content/bidding.svg +1 -0
- package/dist/icon/svg/content/calendar.svg +1 -0
- package/dist/icon/svg/content/code.svg +1 -0
- package/dist/icon/svg/content/customColumn.svg +1 -0
- package/dist/icon/svg/content/data.svg +1 -0
- package/dist/icon/svg/content/dataReport-filled.svg +1 -0
- package/dist/icon/svg/content/dataReport.svg +1 -0
- package/dist/icon/svg/content/download-1.svg +1 -0
- package/dist/icon/svg/content/download-filled.svg +1 -0
- package/dist/icon/svg/content/download.svg +1 -0
- package/dist/icon/svg/content/exchange.svg +1 -0
- package/dist/icon/svg/content/filter-filled.svg +1 -0
- package/dist/icon/svg/content/filter.svg +1 -0
- package/dist/icon/svg/content/hot-filled.svg +1 -0
- package/dist/icon/svg/content/hot.svg +1 -0
- package/dist/icon/svg/content/link.svg +1 -0
- package/dist/icon/svg/content/location.svg +1 -0
- package/dist/icon/svg/content/maxSize.svg +1 -0
- package/dist/icon/svg/content/mobile-filled.svg +1 -0
- package/dist/icon/svg/content/mobile.svg +1 -0
- package/dist/icon/svg/content/mute.svg +1 -0
- package/dist/icon/svg/content/mutiImage-filled.svg +1 -0
- package/dist/icon/svg/content/mutiImage.svg +1 -0
- package/dist/icon/svg/content/refresh.svg +1 -0
- package/dist/icon/svg/content/report.svg +1 -0
- package/dist/icon/svg/content/save.svg +1 -0
- package/dist/icon/svg/content/search-bold.svg +1 -0
- package/dist/icon/svg/content/search-filled.svg +1 -0
- package/dist/icon/svg/content/search.svg +1 -0
- package/dist/icon/svg/content/setting.svg +1 -0
- package/dist/icon/svg/content/share.svg +1 -0
- package/dist/icon/svg/content/sort.svg +1 -0
- package/dist/icon/svg/content/sound.svg +1 -0
- package/dist/icon/svg/content/sticker-filled.svg +1 -0
- package/dist/icon/svg/content/sticker.svg +1 -0
- package/dist/icon/svg/content/tag-filled.svg +1 -0
- package/dist/icon/svg/content/tag.svg +1 -0
- package/dist/icon/svg/content/thumbDown-filled.svg +1 -0
- package/dist/icon/svg/content/thumbDown.svg +1 -0
- package/dist/icon/svg/content/thumbUp-filled.svg +1 -0
- package/dist/icon/svg/content/thumbUp.svg +1 -0
- package/dist/icon/svg/content/time-bold.svg +1 -0
- package/dist/icon/svg/content/time.svg +1 -0
- package/dist/icon/svg/content/verify.svg +1 -0
- package/dist/icon/svg/content/video.svg +1 -0
- package/dist/icon/svg/content/videoScreenshot.svg +1 -0
- package/dist/icon/svg/content/zoomIn.svg +1 -0
- package/dist/icon/svg/content/zoomOut.svg +1 -0
- package/dist/icon/svg/data/compare.svg +1 -0
- package/dist/icon/svg/data/histogram.svg +1 -0
- package/dist/icon/svg/editor/cancel-circle-filled.svg +1 -0
- package/dist/icon/svg/editor/cancel-circle.svg +1 -0
- package/dist/icon/svg/editor/cancel.svg +1 -0
- package/dist/icon/svg/editor/check-circle-filled.svg +1 -0
- package/dist/icon/svg/editor/check-circle.svg +1 -0
- package/dist/icon/svg/editor/check.svg +1 -0
- package/dist/icon/svg/editor/copy.svg +1 -0
- package/dist/icon/svg/editor/custom-filled.svg +1 -0
- package/dist/icon/svg/editor/custom.svg +1 -0
- package/dist/icon/svg/editor/delete.svg +1 -0
- package/dist/icon/svg/editor/deleteAD-filled.svg +1 -0
- package/dist/icon/svg/editor/draggable.svg +1 -0
- package/dist/icon/svg/editor/edit.svg +1 -0
- package/dist/icon/svg/editor/import.svg +1 -0
- package/dist/icon/svg/editor/minus-circle-filled.svg +1 -0
- package/dist/icon/svg/editor/minus-circle.svg +1 -0
- package/dist/icon/svg/editor/minus.svg +1 -0
- package/dist/icon/svg/editor/modify-bold.svg +1 -0
- package/dist/icon/svg/editor/modify.svg +1 -0
- package/dist/icon/svg/editor/multiCreate.svg +1 -0
- package/dist/icon/svg/editor/mutiSelect-filled.svg +1 -0
- package/dist/icon/svg/editor/mutiSelect.svg +1 -0
- package/dist/icon/svg/editor/pause-filled.svg +1 -0
- package/dist/icon/svg/editor/play-filled.svg +1 -0
- package/dist/icon/svg/editor/plus-circle-filled.svg +1 -0
- package/dist/icon/svg/editor/plus-circle.svg +1 -0
- package/dist/icon/svg/editor/plus.svg +1 -0
- package/dist/icon/svg/editor/send.svg +1 -0
- package/dist/icon/svg/editor/subdivide.svg +1 -0
- package/dist/icon/svg/navigation/arrowDown-filled.svg +1 -0
- package/dist/icon/svg/navigation/arrowDown.svg +1 -0
- package/dist/icon/svg/navigation/arrowLeft-filled.svg +1 -0
- package/dist/icon/svg/navigation/arrowLeft.svg +1 -0
- package/dist/icon/svg/navigation/arrowRight-filled.svg +1 -0
- package/dist/icon/svg/navigation/arrowRight.svg +1 -0
- package/dist/icon/svg/navigation/arrowUp-filled.svg +1 -0
- package/dist/icon/svg/navigation/arrowUp.svg +1 -0
- package/dist/icon/svg/navigation/bottom-filled.svg +1 -0
- package/dist/icon/svg/navigation/bottom.svg +1 -0
- package/dist/icon/svg/navigation/doubleLeft-filled.svg +1 -0
- package/dist/icon/svg/navigation/doubleLeft.svg +1 -0
- package/dist/icon/svg/navigation/doubleRight-filled.svg +1 -0
- package/dist/icon/svg/navigation/doubleRight.svg +1 -0
- package/dist/icon/svg/navigation/down-bold.svg +1 -0
- package/dist/icon/svg/navigation/down-filled.svg +1 -0
- package/dist/icon/svg/navigation/down.svg +1 -0
- package/dist/icon/svg/navigation/fall-filled.svg +1 -0
- package/dist/icon/svg/navigation/fold.svg +1 -0
- package/dist/icon/svg/navigation/fullScreen.svg +1 -0
- package/dist/icon/svg/navigation/left-bold.svg +1 -0
- package/dist/icon/svg/navigation/left-filled.svg +1 -0
- package/dist/icon/svg/navigation/left.svg +1 -0
- package/dist/icon/svg/navigation/leftFirst-filled.svg +1 -0
- package/dist/icon/svg/navigation/leftFirst.svg +1 -0
- package/dist/icon/svg/navigation/logout.svg +1 -0
- package/dist/icon/svg/navigation/menu.svg +1 -0
- package/dist/icon/svg/navigation/menuLeft-bold.svg +1 -0
- package/dist/icon/svg/navigation/menuLeft.svg +1 -0
- package/dist/icon/svg/navigation/menuRight-bold.svg +1 -0
- package/dist/icon/svg/navigation/menuRight.svg +1 -0
- package/dist/icon/svg/navigation/more-vertical.svg +1 -0
- package/dist/icon/svg/navigation/more.svg +1 -0
- package/dist/icon/svg/navigation/pointerLeft-filled.svg +1 -0
- package/dist/icon/svg/navigation/pointerRight-filled.svg +1 -0
- package/dist/icon/svg/navigation/right-bold.svg +1 -0
- package/dist/icon/svg/navigation/right-filled.svg +1 -0
- package/dist/icon/svg/navigation/right.svg +1 -0
- package/dist/icon/svg/navigation/rightLast-filled.svg +1 -0
- package/dist/icon/svg/navigation/rightLast.svg +1 -0
- package/dist/icon/svg/navigation/rise-filled.svg +1 -0
- package/dist/icon/svg/navigation/top-filled.svg +1 -0
- package/dist/icon/svg/navigation/top.svg +1 -0
- package/dist/icon/svg/navigation/unfold-filled.svg +1 -0
- package/dist/icon/svg/navigation/unfold.svg +1 -0
- package/dist/icon/svg/navigation/up-bold.svg +1 -0
- package/dist/icon/svg/navigation/up-filled.svg +1 -0
- package/dist/icon/svg/navigation/up.svg +1 -0
- package/dist/icon/svg/product/AIFile.svg +1 -0
- package/dist/icon/svg/product/LandingPage.svg +1 -0
- package/dist/icon/svg/product/addressBook.svg +1 -0
- package/dist/icon/svg/product/alarmClock.svg +1 -0
- package/dist/icon/svg/product/asset-square.svg +1 -0
- package/dist/icon/svg/product/assetProtecting.svg +1 -0
- package/dist/icon/svg/product/autoAD-square-filled.svg +1 -0
- package/dist/icon/svg/product/channels-square-filled.svg +1 -0
- package/dist/icon/svg/product/channels.svg +1 -0
- package/dist/icon/svg/product/chatBubble-filled.svg +1 -0
- package/dist/icon/svg/product/checkBadge.svg +1 -0
- package/dist/icon/svg/product/comments.svg +1 -0
- package/dist/icon/svg/product/container.svg +1 -0
- package/dist/icon/svg/product/dataAuth.svg +1 -0
- package/dist/icon/svg/product/dataBoard.svg +1 -0
- package/dist/icon/svg/product/dataBox.svg +1 -0
- package/dist/icon/svg/product/dataFolder.svg +1 -0
- package/dist/icon/svg/product/dataRising.svg +1 -0
- package/dist/icon/svg/product/detect.svg +1 -0
- package/dist/icon/svg/product/exposure-filled.svg +1 -0
- package/dist/icon/svg/product/extendedConfig.svg +1 -0
- package/dist/icon/svg/product/file-filled.svg +1 -0
- package/dist/icon/svg/product/flag.svg +1 -0
- package/dist/icon/svg/product/folderZip.svg +1 -0
- package/dist/icon/svg/product/folderzip-bold.svg +1 -0
- package/dist/icon/svg/product/guideBook.svg +1 -0
- package/dist/icon/svg/product/hosting.svg +1 -0
- package/dist/icon/svg/product/icon-outlined.svg +1 -0
- package/dist/icon/svg/product/idea-bold.svg +1 -0
- package/dist/icon/svg/product/idea.svg +1 -0
- package/dist/icon/svg/product/image-bold.svg +1 -0
- package/dist/icon/svg/product/image-filled.svg +1 -0
- package/dist/icon/svg/product/image.svg +1 -0
- package/dist/icon/svg/product/images.svg +1 -0
- package/dist/icon/svg/product/keyword.svg +1 -0
- package/dist/icon/svg/product/linkSquare.svg +1 -0
- package/dist/icon/svg/product/lock.svg +1 -0
- package/dist/icon/svg/product/magic-filled.svg +1 -0
- package/dist/icon/svg/product/magic.svg +1 -0
- package/dist/icon/svg/product/miniProgram.svg +1 -0
- package/dist/icon/svg/product/minigame-filled.svg +1 -0
- package/dist/icon/svg/product/mobilePage.svg +1 -0
- package/dist/icon/svg/product/moments-filled.svg +1 -0
- package/dist/icon/svg/product/notepad-bold.svg +1 -0
- package/dist/icon/svg/product/notepad.svg +1 -0
- package/dist/icon/svg/product/offiaccount-filled.svg +1 -0
- package/dist/icon/svg/product/playing.svg +1 -0
- package/dist/icon/svg/product/qualification.svg +1 -0
- package/dist/icon/svg/product/quickFile.svg +1 -0
- package/dist/icon/svg/product/ringStruckture.svg +1 -0
- package/dist/icon/svg/product/searchAD-filled.svg +1 -0
- package/dist/icon/svg/product/searchAD.svg +1 -0
- package/dist/icon/svg/product/shield-filled.svg +1 -0
- package/dist/icon/svg/product/shield.svg +1 -0
- package/dist/icon/svg/product/shop.svg +1 -0
- package/dist/icon/svg/product/shopping.svg +1 -0
- package/dist/icon/svg/product/star-filled.svg +1 -0
- package/dist/icon/svg/product/star.svg +1 -0
- package/dist/icon/svg/product/support-bold.svg +1 -0
- package/dist/icon/svg/product/target.svg +1 -0
- package/dist/icon/svg/product/targeting.svg +1 -0
- package/dist/icon/svg/product/task-filled.svg +1 -0
- package/dist/icon/svg/product/task.svg +1 -0
- package/dist/icon/svg/product/template.svg +1 -0
- package/dist/icon/svg/product/templateBag.svg +1 -0
- package/dist/icon/svg/product/text.svg +1 -0
- package/dist/icon/svg/product/treeStructure.svg +1 -0
- package/dist/icon/svg/product/user-circle.svg +1 -0
- package/dist/icon/svg/product/userList.svg +1 -0
- package/dist/icon/svg/product/userPack.svg +1 -0
- package/dist/icon/svg/product/users-bold.svg +1 -0
- package/dist/icon/svg/product/users.svg +1 -0
- package/dist/icon/svg/product/videoBag-filled.svg +1 -0
- package/dist/icon/svg/product/viewMask.svg +1 -0
- package/dist/icon/svg/product/wallet.svg +1 -0
- package/dist/icon/svg/product/wechatBubble-filled.svg +1 -0
- package/dist/icon/svg/product/wechatBubble.svg +1 -0
- package/dist/icon/svg/product/wechatSearch.svg +1 -0
- package/dist/icon/svg/product/writing.svg +1 -0
- package/dist/icon/svg-data.d.ts +221 -0
- package/dist/icon/svg-data.js +224 -0
- package/dist/icon/test-icons.html +122 -0
- package/dist/icon/types.d.ts +3 -0
- package/dist/icon/types.js +10 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.js +46 -0
- package/dist/input/index.d.ts +80 -0
- package/dist/input/index.js +437 -0
- package/dist/input/style/index.css +256 -0
- package/dist/input/style/index.d.ts +2 -0
- package/dist/input/style/index.js +2 -0
- package/dist/input-number/index.d.ts +36 -0
- package/dist/input-number/index.js +429 -0
- package/dist/input-number/style/index.css +70 -0
- package/dist/input-number/style/index.d.ts +2 -0
- package/dist/input-number/style/index.js +2 -0
- package/dist/input-otp/index.d.ts +71 -0
- package/dist/input-otp/index.js +87 -0
- package/dist/input-otp/style/index.css +114 -0
- package/dist/input-otp/style/index.d.ts +2 -0
- package/dist/input-otp/style/index.js +2 -0
- package/dist/message/MessageBase.d.ts +86 -0
- package/dist/message/MessageBase.js +395 -0
- package/dist/message/MessageReact16.d.ts +2 -0
- package/dist/message/MessageReact16.js +86 -0
- package/dist/message/MessageReact18.d.ts +2 -0
- package/dist/message/MessageReact18.js +98 -0
- package/dist/message/index.d.ts +3 -0
- package/dist/message/index.js +7 -0
- package/dist/message/style/index.css +133 -0
- package/dist/message/style/index.d.ts +2 -0
- package/dist/message/style/index.js +2 -0
- package/dist/modal-base/gap.d.ts +14 -0
- package/dist/modal-base/gap.js +31 -0
- package/dist/modal-base/index.d.ts +26 -0
- package/dist/modal-base/index.js +110 -0
- package/dist/number-flow/index.d.ts +13 -0
- package/dist/number-flow/index.js +25 -0
- package/dist/number-flow/style/index.css +0 -0
- package/dist/number-flow/style/index.d.ts +2 -0
- package/dist/number-flow/style/index.js +2 -0
- package/dist/pagination/index.d.ts +38 -0
- package/dist/pagination/index.js +349 -0
- package/dist/pagination/style/index.css +128 -0
- package/dist/pagination/style/index.d.ts +2 -0
- package/dist/pagination/style/index.js +2 -0
- package/dist/pop-base/index.d.ts +123 -0
- package/dist/pop-base/index.js +349 -0
- package/dist/pop-base/mergeProps.d.ts +37 -0
- package/dist/pop-base/mergeProps.js +144 -0
- package/dist/pop-base/style/index.css +150 -0
- package/dist/pop-base/style/index.d.ts +2 -0
- package/dist/pop-base/style/index.js +2 -0
- package/dist/pop-base/useForkRef.d.ts +5 -0
- package/dist/pop-base/useForkRef.js +52 -0
- package/dist/popover/index.d.ts +4 -0
- package/dist/popover/index.js +9 -0
- package/dist/radio/index.d.ts +21 -0
- package/dist/radio/index.js +45 -0
- package/dist/radio/primitive.d.ts +5 -0
- package/dist/radio/primitive.js +28 -0
- package/dist/radio/style/index.css +219 -0
- package/dist/radio/style/index.d.ts +2 -0
- package/dist/radio/style/index.js +2 -0
- package/dist/scroll-area/index.d.ts +24 -0
- package/dist/scroll-area/index.js +96 -0
- package/dist/scroll-area/style/index.css +77 -0
- package/dist/scroll-area/style/index.d.ts +2 -0
- package/dist/scroll-area/style/index.js +2 -0
- package/dist/select/index.d.ts +85 -0
- package/dist/select/index.js +262 -0
- package/dist/select/style/index.css +1736 -0
- package/dist/select/style/index.d.ts +2 -0
- package/dist/select/style/index.js +2 -0
- package/dist/select/useIcons.d.ts +25 -0
- package/dist/select/useIcons.js +80 -0
- package/dist/slider/index.d.ts +69 -0
- package/dist/slider/index.js +264 -0
- package/dist/slider/style/index.css +237 -0
- package/dist/slider/style/index.d.ts +2 -0
- package/dist/slider/style/index.js +2 -0
- package/dist/style/base.css +298 -0
- package/dist/style/index.d.ts +6 -0
- package/dist/style/index.js +17 -0
- package/dist/switch/index.d.ts +12 -0
- package/dist/switch/index.js +55 -0
- package/dist/switch/style/index.css +152 -0
- package/dist/switch/style/index.d.ts +2 -0
- package/dist/switch/style/index.js +2 -0
- package/dist/table/TableCellContent.d.ts +20 -0
- package/dist/table/TableCellContent.js +77 -0
- package/dist/table/index.d.ts +97 -0
- package/dist/table/index.js +791 -0
- package/dist/table/style/index.css +320 -0
- package/dist/table/style/index.d.ts +2 -0
- package/dist/table/style/index.js +2 -0
- package/dist/table/useSelection.d.ts +13 -0
- package/dist/table/useSelection.js +259 -0
- package/dist/tabs/index.d.ts +51 -0
- package/dist/tabs/index.js +617 -0
- package/dist/tabs/style/index.css +369 -0
- package/dist/tabs/style/index.d.ts +2 -0
- package/dist/tabs/style/index.js +2 -0
- package/dist/text-swap/index.d.ts +58 -0
- package/dist/text-swap/index.js +280 -0
- package/dist/text-swap/style/index.css +32 -0
- package/dist/text-swap/style/index.d.ts +2 -0
- package/dist/text-swap/style/index.js +2 -0
- package/dist/time-picker/index.d.ts +67 -0
- package/dist/time-picker/index.js +945 -0
- package/dist/time-picker/style/index.css +166 -0
- package/dist/time-picker/style/index.d.ts +2 -0
- package/dist/time-picker/style/index.js +2 -0
- package/dist/tooltip/index.d.ts +10 -0
- package/dist/tooltip/index.js +178 -0
- package/dist/tree-select/index.d.ts +25 -0
- package/dist/tree-select/index.js +140 -0
- package/dist/tree-select/style/index.css +204 -0
- package/dist/tree-select/style/index.d.ts +1 -0
- package/dist/tree-select/style/index.js +1 -0
- package/package.json +124 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { HiddenInput, Input, Root } from '@radix-ui/react-one-time-password-field';
|
|
2
|
+
import React, { useEffect, useImperativeHandle, useRef } from 'react';
|
|
3
|
+
import "./style";
|
|
4
|
+
var InputOtp = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
5
|
+
var className = _ref.className,
|
|
6
|
+
style = _ref.style,
|
|
7
|
+
_ref$length = _ref.length,
|
|
8
|
+
length = _ref$length === void 0 ? 6 : _ref$length,
|
|
9
|
+
_ref$size = _ref.size,
|
|
10
|
+
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
11
|
+
_ref$disabled = _ref.disabled,
|
|
12
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
13
|
+
_ref$autoFocus = _ref.autoFocus,
|
|
14
|
+
autoFocus = _ref$autoFocus === void 0 ? false : _ref$autoFocus,
|
|
15
|
+
_ref$value = _ref.value,
|
|
16
|
+
value = _ref$value === void 0 ? '' : _ref$value,
|
|
17
|
+
_ref$defaultValue = _ref.defaultValue,
|
|
18
|
+
defaultValue = _ref$defaultValue === void 0 ? '' : _ref$defaultValue,
|
|
19
|
+
_ref$autoSubmit = _ref.autoSubmit,
|
|
20
|
+
autoSubmit = _ref$autoSubmit === void 0 ? false : _ref$autoSubmit,
|
|
21
|
+
onAutoSubmit = _ref.onAutoSubmit,
|
|
22
|
+
onChange = _ref.onChange,
|
|
23
|
+
_ref$placeholder = _ref.placeholder,
|
|
24
|
+
placeholder = _ref$placeholder === void 0 ? '' : _ref$placeholder,
|
|
25
|
+
_ref$autoComplete = _ref.autoComplete,
|
|
26
|
+
autoComplete = _ref$autoComplete === void 0 ? 'one-time-code' : _ref$autoComplete,
|
|
27
|
+
_onFocus = _ref.onFocus,
|
|
28
|
+
_onBlur = _ref.onBlur;
|
|
29
|
+
var innerRef = useRef(null);
|
|
30
|
+
var inputRefs = useRef([]);
|
|
31
|
+
useImperativeHandle(ref, function () {
|
|
32
|
+
if (innerRef.current) {
|
|
33
|
+
Object.assign(innerRef.current, {
|
|
34
|
+
focus: function focus() {
|
|
35
|
+
var _inputRefs$current$;
|
|
36
|
+
(_inputRefs$current$ = inputRefs.current[0]) === null || _inputRefs$current$ === void 0 || _inputRefs$current$.focus();
|
|
37
|
+
},
|
|
38
|
+
inputs: inputRefs.current
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return innerRef.current;
|
|
42
|
+
});
|
|
43
|
+
useEffect(function () {
|
|
44
|
+
if (inputRefs.current.length > 0 && placeholder) {
|
|
45
|
+
inputRefs.current.forEach(function (input) {
|
|
46
|
+
input.placeholder = placeholder;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}, [placeholder]);
|
|
50
|
+
var inputs = Array.from({
|
|
51
|
+
length: length
|
|
52
|
+
}, function (_, index) {
|
|
53
|
+
return /*#__PURE__*/React.createElement(Input, {
|
|
54
|
+
ref: function ref(el) {
|
|
55
|
+
if (el) {
|
|
56
|
+
inputRefs.current[index] = el;
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"data-odn-otp-input": true,
|
|
60
|
+
"data-odn-otp-input-intent": "normal",
|
|
61
|
+
"data-odn-otp-input-size": size,
|
|
62
|
+
key: index,
|
|
63
|
+
onFocus: function onFocus(e) {
|
|
64
|
+
return _onFocus === null || _onFocus === void 0 ? void 0 : _onFocus(e, index);
|
|
65
|
+
},
|
|
66
|
+
onBlur: function onBlur(e) {
|
|
67
|
+
return _onBlur === null || _onBlur === void 0 ? void 0 : _onBlur(e, index);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
return /*#__PURE__*/React.createElement(Root, {
|
|
72
|
+
ref: innerRef,
|
|
73
|
+
"data-odn-otp-root": true,
|
|
74
|
+
autoComplete: autoComplete,
|
|
75
|
+
disabled: disabled,
|
|
76
|
+
autoFocus: autoFocus,
|
|
77
|
+
value: value,
|
|
78
|
+
defaultValue: defaultValue,
|
|
79
|
+
autoSubmit: autoSubmit,
|
|
80
|
+
onAutoSubmit: onAutoSubmit,
|
|
81
|
+
onValueChange: onChange,
|
|
82
|
+
className: className,
|
|
83
|
+
style: style
|
|
84
|
+
}, inputs, /*#__PURE__*/React.createElement(HiddenInput, null));
|
|
85
|
+
});
|
|
86
|
+
InputOtp.displayName = 'InputOtp';
|
|
87
|
+
export default InputOtp;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
html {
|
|
2
|
+
--odn-otp-padding-block-medium: 6px;
|
|
3
|
+
--odn-otp-width-medium: 30px;
|
|
4
|
+
--odn-otp-font-size-medium: 14px;
|
|
5
|
+
--odn-otp-line-height-medium: 1.5714285714285714;
|
|
6
|
+
--odn-otp-border-radius-medium: 6px;
|
|
7
|
+
--odn-otp-icon-size-medium: 16px;
|
|
8
|
+
--odn-otp-icon-margin-inline-medium: 4px;
|
|
9
|
+
--odn-otp-padding-block-small: 4px;
|
|
10
|
+
--odn-otp-width-small: 24px;
|
|
11
|
+
--odn-otp-font-size-small: 12px;
|
|
12
|
+
--odn-otp-line-height-small: 1.6666666666666667;
|
|
13
|
+
--odn-otp-border-radius-small: 6px;
|
|
14
|
+
--odn-otp-icon-size-small: 14px;
|
|
15
|
+
--odn-otp-icon-margin-inline-small: 4px;
|
|
16
|
+
--odn-otp-padding-block-large: 8px;
|
|
17
|
+
--odn-otp-width-large: 36px;
|
|
18
|
+
--odn-otp-font-size-large: 16px;
|
|
19
|
+
--odn-otp-line-height-large: 1.5;
|
|
20
|
+
--odn-otp-border-radius-large: 6px;
|
|
21
|
+
--odn-otp-icon-size-large: 18px;
|
|
22
|
+
--odn-otp-icon-margin-inline-large: 4px;
|
|
23
|
+
--odn-otp-bg-normal: #fff;
|
|
24
|
+
--odn-otp-bg-normal-hover: var(--odn-color-black-1);
|
|
25
|
+
--odn-otp-bg-normal-focus: #fff;
|
|
26
|
+
--odn-otp-bg-disabled: var(--odn-color-black-3);
|
|
27
|
+
--odn-otp-color-normal: var(--odn-color-black-12);
|
|
28
|
+
--odn-otp-color-normal-hover: var(--odn-color-black-12);
|
|
29
|
+
--odn-otp-color-normal-focus: var(--odn-color-black-12);
|
|
30
|
+
--odn-otp-color-disabled: var(--odn-color-black-8);
|
|
31
|
+
--odn-otp-border-normal: 1px solid var(--odn-color-black-6);
|
|
32
|
+
--odn-otp-border-normal-hover: 1px solid var(--odn-color-black-7);
|
|
33
|
+
--odn-otp-border-normal-focus: 1px solid var(--odn-color-blue-6);
|
|
34
|
+
--odn-otp-border-disabled: 1px solid var(--odn-color-black-6);
|
|
35
|
+
--odn-otp-shadow-normal: none;
|
|
36
|
+
--odn-otp-shadow-normal-hover: none;
|
|
37
|
+
--odn-otp-shadow-normal-focus: 0 0 0 2px var(--odn-color-blue-2);
|
|
38
|
+
--odn-otp-shadow-disabled: none;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
[data-odn-otp-root] {
|
|
42
|
+
display: flex;
|
|
43
|
+
gap: 8px;
|
|
44
|
+
flex-wrap: nowrap;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
[data-odn-otp-input] {
|
|
48
|
+
text-align: center;
|
|
49
|
+
position: relative;
|
|
50
|
+
min-width: 0;
|
|
51
|
+
font-size: inherit;
|
|
52
|
+
border: none;
|
|
53
|
+
border-radius: 0;
|
|
54
|
+
outline: none;
|
|
55
|
+
background: transparent;
|
|
56
|
+
color: inherit;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
[data-odn-otp-input-disabled=true] {
|
|
60
|
+
color: var(--odn-otp-color-disabled);
|
|
61
|
+
background: var(--odn-otp-bg-disabled);
|
|
62
|
+
border: var(--odn-otp-border-disabled);
|
|
63
|
+
box-shadow: var(--odn-otp-shadow-disabled);
|
|
64
|
+
cursor: not-allowed;
|
|
65
|
+
}
|
|
66
|
+
[data-odn-otp-input-disabled=true] [data-odn-otp] {
|
|
67
|
+
cursor: not-allowed;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
[data-odn-otp-input-size=small] {
|
|
71
|
+
padding: var(--odn-otp-padding-block-small) 0;
|
|
72
|
+
width: var(--odn-otp-width-small);
|
|
73
|
+
font-size: var(--odn-otp-font-size-small);
|
|
74
|
+
line-height: var(--odn-otp-line-height-small);
|
|
75
|
+
border-radius: var(--odn-otp-border-radius-small);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
[data-odn-otp-input-size=medium] {
|
|
79
|
+
padding: var(--odn-otp-padding-block-medium) 0;
|
|
80
|
+
width: var(--odn-otp-width-medium);
|
|
81
|
+
font-size: var(--odn-otp-font-size-medium);
|
|
82
|
+
line-height: var(--odn-otp-line-height-medium);
|
|
83
|
+
border-radius: var(--odn-otp-border-radius-medium);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
[data-odn-otp-input-size=large] {
|
|
87
|
+
padding: var(--odn-otp-padding-block-large) 0;
|
|
88
|
+
width: var(--odn-otp-width-large);
|
|
89
|
+
font-size: var(--odn-otp-font-size-large);
|
|
90
|
+
line-height: var(--odn-otp-line-height-large);
|
|
91
|
+
border-radius: var(--odn-otp-border-radius-large);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
[data-odn-otp-input-intent=normal]:not([data-odn-otp-input-disabled=true]) {
|
|
95
|
+
color: var(--odn-otp-color-normal);
|
|
96
|
+
background: var(--odn-otp-bg-normal);
|
|
97
|
+
border: var(--odn-otp-border-normal);
|
|
98
|
+
box-shadow: var(--odn-otp-shadow-normal);
|
|
99
|
+
}
|
|
100
|
+
[data-odn-otp-input-intent=normal]:not([data-odn-otp-input-disabled=true]):hover {
|
|
101
|
+
color: var(--odn-otp-color-normal-hover);
|
|
102
|
+
background: var(--odn-otp-bg-normal-hover);
|
|
103
|
+
border: var(--odn-otp-border-normal-hover);
|
|
104
|
+
box-shadow: var(--odn-otp-shadow-normal-hover);
|
|
105
|
+
}
|
|
106
|
+
[data-odn-otp-input-intent=normal]:not([data-odn-otp-input-disabled=true]):focus {
|
|
107
|
+
color: var(--odn-otp-color-normal-focus);
|
|
108
|
+
background: var(--odn-otp-bg-normal-focus);
|
|
109
|
+
border: var(--odn-otp-border-normal-focus);
|
|
110
|
+
box-shadow: var(--odn-otp-shadow-normal-focus);
|
|
111
|
+
}
|
|
112
|
+
[data-odn-otp-input-intent=normal]:not([data-odn-otp-input-disabled=true])::selection {
|
|
113
|
+
background: var(--odn-otp-bg-normal-selection);
|
|
114
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './style';
|
|
3
|
+
export interface MessageProps {
|
|
4
|
+
/**
|
|
5
|
+
* @description 类名
|
|
6
|
+
*/
|
|
7
|
+
className?: string;
|
|
8
|
+
/**
|
|
9
|
+
* @description 样式
|
|
10
|
+
*/
|
|
11
|
+
style?: React.CSSProperties;
|
|
12
|
+
/**
|
|
13
|
+
* @description 是否显示关闭按钮,可以结合 duration 0 来只点击关闭
|
|
14
|
+
*/
|
|
15
|
+
closable?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* @description 内容
|
|
18
|
+
*/
|
|
19
|
+
content: React.ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* @description 持续时间
|
|
22
|
+
*/
|
|
23
|
+
duration?: number;
|
|
24
|
+
/**
|
|
25
|
+
* @description 获取容器,默认到 document.body
|
|
26
|
+
*/
|
|
27
|
+
getContainer?: () => HTMLElement;
|
|
28
|
+
/**
|
|
29
|
+
* @description 类型
|
|
30
|
+
*/
|
|
31
|
+
intent?: MessageIntent;
|
|
32
|
+
/**
|
|
33
|
+
* @description 关闭回调
|
|
34
|
+
*/
|
|
35
|
+
onClose?: () => void;
|
|
36
|
+
/**
|
|
37
|
+
* @description 鼠标进入回调
|
|
38
|
+
*/
|
|
39
|
+
onMouseEnter?: () => void;
|
|
40
|
+
/**
|
|
41
|
+
* @description 鼠标离开回调
|
|
42
|
+
*/
|
|
43
|
+
onMouseLeave?: () => void;
|
|
44
|
+
/**
|
|
45
|
+
* @description 是否可折叠
|
|
46
|
+
*/
|
|
47
|
+
collapsible?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* @description 是否可折叠
|
|
50
|
+
*/
|
|
51
|
+
sameCollapsible?: boolean;
|
|
52
|
+
}
|
|
53
|
+
type MessageFunc = (config: MessageProps | string) => void;
|
|
54
|
+
export type MessageIntent = 'info' | 'success' | 'warning' | 'danger' | 'error';
|
|
55
|
+
export interface Message extends React.ForwardRefExoticComponent<MessageProps & React.RefAttributes<HTMLDivElement>> {
|
|
56
|
+
info: MessageFunc;
|
|
57
|
+
success: MessageFunc;
|
|
58
|
+
warning: MessageFunc;
|
|
59
|
+
danger: MessageFunc;
|
|
60
|
+
error: MessageFunc;
|
|
61
|
+
}
|
|
62
|
+
export interface odnMessageState {
|
|
63
|
+
collapsed: boolean;
|
|
64
|
+
collapsible: boolean;
|
|
65
|
+
sameCollapsible: boolean;
|
|
66
|
+
sameCollapsed: boolean;
|
|
67
|
+
messages: {
|
|
68
|
+
id: string;
|
|
69
|
+
intent: MessageIntent;
|
|
70
|
+
}[];
|
|
71
|
+
}
|
|
72
|
+
declare global {
|
|
73
|
+
interface Window {
|
|
74
|
+
odnMessageState: odnMessageState;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
export declare const updateStyles: () => void;
|
|
78
|
+
export declare const Message: Message;
|
|
79
|
+
export declare const createNewInstance: (renderer: {
|
|
80
|
+
render: (element: React.ReactElement, container: HTMLElement) => void;
|
|
81
|
+
unmount: (container: HTMLElement) => void;
|
|
82
|
+
}) => (props: MessageProps) => {
|
|
83
|
+
destroy: () => void;
|
|
84
|
+
};
|
|
85
|
+
export declare const addStaticMethods: (MessageComponent: any) => void;
|
|
86
|
+
export {};
|
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
var _excluded = ["className", "style", "closable", "content", "duration", "getContainer", "intent", "onClose", "onMouseEnter", "onMouseLeave"],
|
|
5
|
+
_excluded2 = ["onClose", "getContainer", "intent", "collapsible", "sameCollapsible"];
|
|
6
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
10
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
11
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
12
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
14
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
15
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
16
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
17
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
18
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
19
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
20
|
+
import React, { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
|
|
21
|
+
import Icon from "../icon";
|
|
22
|
+
import "./style";
|
|
23
|
+
var INTENTS = ['info', 'success', 'warning', 'danger', 'error'];
|
|
24
|
+
var defaultProps = {
|
|
25
|
+
className: undefined,
|
|
26
|
+
style: {},
|
|
27
|
+
closable: false,
|
|
28
|
+
content: undefined,
|
|
29
|
+
duration: 3,
|
|
30
|
+
getContainer: function getContainer() {
|
|
31
|
+
return document.body;
|
|
32
|
+
},
|
|
33
|
+
intent: 'info',
|
|
34
|
+
onClose: undefined
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// 更新样式的核心函数
|
|
38
|
+
export var updateStyles = function updateStyles() {
|
|
39
|
+
// 拿到 html 上的 --odn-message-gap 的值
|
|
40
|
+
var messageGapStr = getComputedStyle(document.documentElement).getPropertyValue('--odn-message-gap');
|
|
41
|
+
var messageGap = parseInt(messageGapStr, 10) || 14;
|
|
42
|
+
var messageHeightStr = getComputedStyle(document.documentElement).getPropertyValue('--odn-message-height');
|
|
43
|
+
var messageHeight = parseInt(messageHeightStr, 10) || 54;
|
|
44
|
+
setTimeout(function () {
|
|
45
|
+
var _window$odnMessageSta = window.odnMessageState,
|
|
46
|
+
messages = _window$odnMessageSta.messages,
|
|
47
|
+
collapsed = _window$odnMessageSta.collapsed,
|
|
48
|
+
sameCollapsed = _window$odnMessageSta.sameCollapsed;
|
|
49
|
+
if (sameCollapsed) {
|
|
50
|
+
// 倒着遍历,将相同 intent 的 message 放在一起,构成一个二级数组
|
|
51
|
+
var messagesIntented = [];
|
|
52
|
+
var intentGroups = new Map();
|
|
53
|
+
|
|
54
|
+
// 先按 intent 分组
|
|
55
|
+
messages.forEach(function (message) {
|
|
56
|
+
var _intentGroups$get;
|
|
57
|
+
if (!intentGroups.has(message.intent)) {
|
|
58
|
+
intentGroups.set(message.intent, []);
|
|
59
|
+
}
|
|
60
|
+
(_intentGroups$get = intentGroups.get(message.intent)) === null || _intentGroups$get === void 0 || _intentGroups$get.push(message);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// 按照原始顺序将分组后的消息放入数组
|
|
64
|
+
var seenIntents = new Set();
|
|
65
|
+
messages.forEach(function (message) {
|
|
66
|
+
if (!seenIntents.has(message.intent)) {
|
|
67
|
+
seenIntents.add(message.intent);
|
|
68
|
+
var group = intentGroups.get(message.intent);
|
|
69
|
+
if (group) {
|
|
70
|
+
messagesIntented.push(group);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// 计算每个组的累计偏移值
|
|
76
|
+
var groupOffsets = messagesIntented.map(function (group, index) {
|
|
77
|
+
var offset = 0;
|
|
78
|
+
// 从当前组往后计算所有组的偏移值,只考虑每组最后三个消息
|
|
79
|
+
for (var i = index + 1; i < messagesIntented.length; i++) {
|
|
80
|
+
var nextGroup = messagesIntented[i];
|
|
81
|
+
var visibleCount = Math.min(3, nextGroup.length); // 最多只考虑三个消息
|
|
82
|
+
if (visibleCount === 1) {
|
|
83
|
+
offset += messageGap + messageHeight;
|
|
84
|
+
} else {
|
|
85
|
+
offset += messageGap + messageHeight + 7 * (visibleCount - 1);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return offset;
|
|
89
|
+
});
|
|
90
|
+
messagesIntented.forEach(function (messages, groupIndex) {
|
|
91
|
+
messages.forEach(function (_ref, index) {
|
|
92
|
+
var id = _ref.id;
|
|
93
|
+
var message = document.querySelector("[data-odn-message-container][data-id=\"".concat(id, "\"]"));
|
|
94
|
+
if (sameCollapsed) {
|
|
95
|
+
// 每组中最后三个消息显示,其他的隐藏
|
|
96
|
+
var visible = index >= messages.length - 3;
|
|
97
|
+
message.style.opacity = visible ? '1' : '0';
|
|
98
|
+
message.style.visibility = visible ? 'visible' : 'hidden';
|
|
99
|
+
|
|
100
|
+
// 计算当前消息的偏移值
|
|
101
|
+
var groupOffset = groupOffsets[groupIndex];
|
|
102
|
+
var messageOffset = messageGap * Math.min(2, messages.length - 1 - index); // 最多只考虑三个消息的偏移
|
|
103
|
+
var scale = 1 - 0.05 * Math.min(2, messages.length - 1 - index); // 最多只考虑三个消息的缩放
|
|
104
|
+
|
|
105
|
+
message.style.transform = "translate3d(0, ".concat(groupOffset + messageOffset, "px, 0) scale(").concat(scale, ")");
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
} else {
|
|
110
|
+
messages.forEach(function (_ref2, index) {
|
|
111
|
+
var id = _ref2.id;
|
|
112
|
+
var message = document.querySelector("[data-odn-message-container][data-id=\"".concat(id, "\"]"));
|
|
113
|
+
var visible = index >= messages.length - 3;
|
|
114
|
+
message.style.opacity = visible ? '1' : '0';
|
|
115
|
+
message.style.visibility = visible ? 'visible' : 'hidden';
|
|
116
|
+
if (collapsed) {
|
|
117
|
+
message.style.transform = "translate3d(0, ".concat(messageGap * (messages.length - 1 - index), "px, 0) scale(").concat(1 - 0.05 * (messages.length - 1 - index), ")");
|
|
118
|
+
} else {
|
|
119
|
+
message.style.transform = "translate3d(0, ".concat((messageGap + messageHeight) * (messages.length - 1 - index), "px, 0)");
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}, 50);
|
|
124
|
+
};
|
|
125
|
+
export var Message = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
126
|
+
var _ref3$className = _ref3.className,
|
|
127
|
+
className = _ref3$className === void 0 ? defaultProps.className : _ref3$className,
|
|
128
|
+
_ref3$style = _ref3.style,
|
|
129
|
+
style = _ref3$style === void 0 ? defaultProps.style : _ref3$style,
|
|
130
|
+
_ref3$closable = _ref3.closable,
|
|
131
|
+
closable = _ref3$closable === void 0 ? defaultProps.closable : _ref3$closable,
|
|
132
|
+
_ref3$content = _ref3.content,
|
|
133
|
+
content = _ref3$content === void 0 ? defaultProps.content : _ref3$content,
|
|
134
|
+
_ref3$duration = _ref3.duration,
|
|
135
|
+
duration = _ref3$duration === void 0 ? defaultProps.duration : _ref3$duration,
|
|
136
|
+
_ref3$getContainer = _ref3.getContainer,
|
|
137
|
+
getContainer = _ref3$getContainer === void 0 ? defaultProps.getContainer : _ref3$getContainer,
|
|
138
|
+
_ref3$intent = _ref3.intent,
|
|
139
|
+
intentProp = _ref3$intent === void 0 ? defaultProps.intent : _ref3$intent,
|
|
140
|
+
_ref3$onClose = _ref3.onClose,
|
|
141
|
+
onClose = _ref3$onClose === void 0 ? defaultProps.onClose : _ref3$onClose,
|
|
142
|
+
_ref3$onMouseEnter = _ref3.onMouseEnter,
|
|
143
|
+
onMouseEnter = _ref3$onMouseEnter === void 0 ? defaultProps.onMouseEnter : _ref3$onMouseEnter,
|
|
144
|
+
_ref3$onMouseLeave = _ref3.onMouseLeave,
|
|
145
|
+
onMouseLeave = _ref3$onMouseLeave === void 0 ? defaultProps.onMouseLeave : _ref3$onMouseLeave,
|
|
146
|
+
otherProps = _objectWithoutProperties(_ref3, _excluded);
|
|
147
|
+
var intent = INTENTS.includes(intentProp) ? intentProp : defaultProps.intent;
|
|
148
|
+
var domRef = useRef(null);
|
|
149
|
+
var timer;
|
|
150
|
+
var clearCloseTimer = function clearCloseTimer() {
|
|
151
|
+
if (timer) {
|
|
152
|
+
clearTimeout(timer);
|
|
153
|
+
timer = null;
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
var setCloseTimer = function setCloseTimer() {
|
|
157
|
+
if (duration) {
|
|
158
|
+
timer = setTimeout(function () {
|
|
159
|
+
if (onClose) {
|
|
160
|
+
onClose();
|
|
161
|
+
}
|
|
162
|
+
}, duration * 1000);
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
var handleMouseEnter = function handleMouseEnter() {
|
|
166
|
+
clearCloseTimer();
|
|
167
|
+
if (window.odnMessageState.collapsible) {
|
|
168
|
+
window.odnMessageState.collapsed = false;
|
|
169
|
+
updateStyles();
|
|
170
|
+
}
|
|
171
|
+
if (window.odnMessageState.sameCollapsible) {
|
|
172
|
+
window.odnMessageState.sameCollapsed = false;
|
|
173
|
+
updateStyles();
|
|
174
|
+
}
|
|
175
|
+
if (onMouseEnter) {
|
|
176
|
+
onMouseEnter();
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
var handleMouseLeave = function handleMouseLeave() {
|
|
180
|
+
setCloseTimer();
|
|
181
|
+
if (window.odnMessageState.collapsible) {
|
|
182
|
+
window.odnMessageState.collapsed = true;
|
|
183
|
+
updateStyles();
|
|
184
|
+
}
|
|
185
|
+
if (window.odnMessageState.sameCollapsible) {
|
|
186
|
+
window.odnMessageState.sameCollapsed = true;
|
|
187
|
+
updateStyles();
|
|
188
|
+
}
|
|
189
|
+
if (onMouseLeave) {
|
|
190
|
+
onMouseLeave();
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
useEffect(function () {
|
|
194
|
+
setCloseTimer();
|
|
195
|
+
return function () {
|
|
196
|
+
clearCloseTimer();
|
|
197
|
+
if (window.odnMessageState.messages) {
|
|
198
|
+
window.odnMessageState.messages = window.odnMessageState.messages.filter(function (message) {
|
|
199
|
+
var _domRef$current;
|
|
200
|
+
return message.id !== ((_domRef$current = domRef.current) === null || _domRef$current === void 0 ? void 0 : _domRef$current.dataset.id);
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
}, []);
|
|
205
|
+
useImperativeHandle(ref, function () {
|
|
206
|
+
return {
|
|
207
|
+
close: function close() {
|
|
208
|
+
if (onClose) {
|
|
209
|
+
onClose();
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
getDomNode: function getDomNode() {
|
|
213
|
+
return domRef.current;
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
});
|
|
217
|
+
var iconMap = {
|
|
218
|
+
info: 'info-circle-filled',
|
|
219
|
+
danger: 'cancel-circle-filled',
|
|
220
|
+
warning: 'alert-circle-filled',
|
|
221
|
+
success: 'check-circle-filled',
|
|
222
|
+
error: 'cancel-circle-filled'
|
|
223
|
+
};
|
|
224
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
225
|
+
"data-odn-message": true,
|
|
226
|
+
"data-odn-message-intent": intent,
|
|
227
|
+
onMouseEnter: handleMouseEnter,
|
|
228
|
+
onMouseLeave: handleMouseLeave,
|
|
229
|
+
ref: domRef,
|
|
230
|
+
className: className,
|
|
231
|
+
style: style
|
|
232
|
+
}, otherProps), /*#__PURE__*/React.createElement(Icon, {
|
|
233
|
+
"data-odn-message-prefix-icon": true,
|
|
234
|
+
name: iconMap[intent]
|
|
235
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
236
|
+
"data-odn-message-content": true
|
|
237
|
+
}, content), closable && /*#__PURE__*/React.createElement("svg", {
|
|
238
|
+
"data-odn-message-close-icon": true,
|
|
239
|
+
viewBox: "0 0 18 18",
|
|
240
|
+
onClick: function onClick() {
|
|
241
|
+
if (onClose) {
|
|
242
|
+
onClose();
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
246
|
+
d: "M14.1265 4.93709C14.3218 4.74183 14.3218 4.42524 14.1265 4.22998L13.773 3.87643C13.5777 3.68117 13.2611 3.68116 13.0659 3.87643L9.00002 7.94229L4.93416 3.87643C4.7389 3.68117 4.42231 3.68117 4.22705 3.87643L3.8735 4.22998C3.67824 4.42524 3.67824 4.74183 3.8735 4.93709L7.93936 9.00295L3.8735 13.0688C3.67824 13.2641 3.67824 13.5807 3.8735 13.7759L4.22705 14.1295C4.42231 14.3247 4.7389 14.3247 4.93416 14.1295L9.00002 10.0636L13.0659 14.1295C13.2611 14.3247 13.5777 14.3247 13.773 14.1295L14.1265 13.7759C14.3218 13.5807 14.3218 13.2641 14.1265 13.0688L10.0607 9.00295L14.1265 4.93709Z",
|
|
247
|
+
fillRule: "evenodd"
|
|
248
|
+
})));
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
// 通用的 newInstance 逻辑
|
|
252
|
+
export var createNewInstance = function createNewInstance(renderer) {
|
|
253
|
+
return function (props) {
|
|
254
|
+
var onClose = props.onClose,
|
|
255
|
+
getContainer = props.getContainer,
|
|
256
|
+
_props$intent = props.intent,
|
|
257
|
+
intent = _props$intent === void 0 ? 'info' : _props$intent,
|
|
258
|
+
_props$collapsible = props.collapsible,
|
|
259
|
+
collapsible = _props$collapsible === void 0 ? false : _props$collapsible,
|
|
260
|
+
_props$sameCollapsibl = props.sameCollapsible,
|
|
261
|
+
sameCollapsible = _props$sameCollapsibl === void 0 ? false : _props$sameCollapsibl,
|
|
262
|
+
otherProps = _objectWithoutProperties(props, _excluded2);
|
|
263
|
+
var id = Math.random().toString(36).substring(2, 15);
|
|
264
|
+
var container = document.createElement('div');
|
|
265
|
+
container.dataset.odnMessageContainer = 'true';
|
|
266
|
+
container.dataset.odnMessageIntent = intent;
|
|
267
|
+
container.dataset.id = id;
|
|
268
|
+
var dest = getContainer ? getContainer() : document.body;
|
|
269
|
+
var newObj = {
|
|
270
|
+
id: id,
|
|
271
|
+
intent: intent
|
|
272
|
+
};
|
|
273
|
+
if (!window.odnMessageState) {
|
|
274
|
+
window.odnMessageState = {
|
|
275
|
+
collapsible: collapsible,
|
|
276
|
+
sameCollapsible: sameCollapsible,
|
|
277
|
+
collapsed: collapsible,
|
|
278
|
+
sameCollapsed: sameCollapsible,
|
|
279
|
+
messages: [newObj]
|
|
280
|
+
};
|
|
281
|
+
} else {
|
|
282
|
+
var newMessages = _toConsumableArray(window.odnMessageState.messages);
|
|
283
|
+
if (collapsible !== undefined) {
|
|
284
|
+
window.odnMessageState.collapsible = collapsible;
|
|
285
|
+
window.odnMessageState.collapsed = collapsible;
|
|
286
|
+
}
|
|
287
|
+
if (sameCollapsible !== undefined) {
|
|
288
|
+
window.odnMessageState.sameCollapsible = sameCollapsible;
|
|
289
|
+
window.odnMessageState.sameCollapsed = sameCollapsible;
|
|
290
|
+
}
|
|
291
|
+
newMessages.push(newObj);
|
|
292
|
+
if (sameCollapsible) {
|
|
293
|
+
// 如果 sameCollapsible 为 true,则从最后一个往前找,如果碰到相同的 intent,则放在该项之后,如果碰到不同的 intent,则排在刚才所有相同 intent 的后面
|
|
294
|
+
var insertIndex = newMessages.length - 1;
|
|
295
|
+
var foundSameIntent = false;
|
|
296
|
+
var lastSameIntentIndex = -1;
|
|
297
|
+
|
|
298
|
+
// 先找到最后一个相同类型的消息的位置
|
|
299
|
+
for (var i = newMessages.length - 1; i >= 0; i--) {
|
|
300
|
+
if (newMessages[i].intent === intent) {
|
|
301
|
+
lastSameIntentIndex = i;
|
|
302
|
+
foundSameIntent = true;
|
|
303
|
+
} else if (foundSameIntent) {
|
|
304
|
+
// 如果已经找到相同类型的消息,且遇到了不同类型的消息,就停止搜索
|
|
305
|
+
break;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
if (lastSameIntentIndex !== -1) {
|
|
309
|
+
// 如果找到了相同类型的消息,就放在它的后面
|
|
310
|
+
insertIndex = lastSameIntentIndex + 1;
|
|
311
|
+
} else {
|
|
312
|
+
// 如果没有找到相同类型的消息,就放在最后一个位置
|
|
313
|
+
insertIndex = newMessages.length;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// 将新消息插入到正确的位置
|
|
317
|
+
newMessages.splice(insertIndex, 0, newObj);
|
|
318
|
+
// 移除之前添加的最后一个元素(因为我们已经把它插入到正确的位置了)
|
|
319
|
+
newMessages.pop();
|
|
320
|
+
|
|
321
|
+
// 重新排序,确保相同类型的消息相邻,且新消息在最后
|
|
322
|
+
var sameIntentMessages = newMessages.filter(function (msg) {
|
|
323
|
+
return msg.intent === intent && msg.id !== newObj.id;
|
|
324
|
+
});
|
|
325
|
+
var otherMessages = newMessages.filter(function (msg) {
|
|
326
|
+
return msg.intent !== intent;
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
// 将相同类型的消息放在一起,新消息在最后
|
|
330
|
+
newMessages.length = 0;
|
|
331
|
+
newMessages.push.apply(newMessages, _toConsumableArray(otherMessages).concat(_toConsumableArray(sameIntentMessages), [newObj]));
|
|
332
|
+
}
|
|
333
|
+
window.odnMessageState.messages = newMessages;
|
|
334
|
+
}
|
|
335
|
+
var instance;
|
|
336
|
+
updateStyles();
|
|
337
|
+
var close = function close() {
|
|
338
|
+
if (onClose) {
|
|
339
|
+
onClose();
|
|
340
|
+
}
|
|
341
|
+
window.odnMessageState.messages = window.odnMessageState.messages.filter(function (message) {
|
|
342
|
+
return message.id !== id;
|
|
343
|
+
});
|
|
344
|
+
container.style.opacity = '0';
|
|
345
|
+
container.style.visibility = 'hidden';
|
|
346
|
+
container.style.transition = '0.15s cubic-bezier(0, 0, 0.2, 1) all';
|
|
347
|
+
updateStyles();
|
|
348
|
+
setTimeout(function () {
|
|
349
|
+
var _container$parentNode;
|
|
350
|
+
renderer.unmount(container);
|
|
351
|
+
(_container$parentNode = container.parentNode) === null || _container$parentNode === void 0 || _container$parentNode.removeChild(container);
|
|
352
|
+
}, 300);
|
|
353
|
+
};
|
|
354
|
+
renderer.render( /*#__PURE__*/React.createElement(Message, _extends({
|
|
355
|
+
ref: function ref(message) {
|
|
356
|
+
instance = message;
|
|
357
|
+
},
|
|
358
|
+
onClose: close,
|
|
359
|
+
intent: intent
|
|
360
|
+
}, otherProps)), container);
|
|
361
|
+
|
|
362
|
+
// 将容器添加到目标元素
|
|
363
|
+
dest.appendChild(container);
|
|
364
|
+
return {
|
|
365
|
+
destroy: function destroy() {
|
|
366
|
+
if (instance) {
|
|
367
|
+
instance.close();
|
|
368
|
+
}
|
|
369
|
+
dest.removeChild(container);
|
|
370
|
+
}
|
|
371
|
+
};
|
|
372
|
+
};
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
// 添加静态方法
|
|
376
|
+
export var addStaticMethods = function addStaticMethods(MessageComponent) {
|
|
377
|
+
INTENTS.forEach(function (intent) {
|
|
378
|
+
MessageComponent[intent] = function (config) {
|
|
379
|
+
var cnfg = {
|
|
380
|
+
intent: intent
|
|
381
|
+
};
|
|
382
|
+
if (typeof config === 'string') {
|
|
383
|
+
cnfg = {
|
|
384
|
+
content: config,
|
|
385
|
+
intent: intent
|
|
386
|
+
};
|
|
387
|
+
} else {
|
|
388
|
+
cnfg = config;
|
|
389
|
+
}
|
|
390
|
+
return MessageComponent.newInstance(_objectSpread(_objectSpread({}, cnfg), {}, {
|
|
391
|
+
intent: intent
|
|
392
|
+
}));
|
|
393
|
+
};
|
|
394
|
+
});
|
|
395
|
+
};
|