@kaitify/react 0.0.1-beta.1
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 +3 -0
- package/docs/.vitepress/cache/deps/_metadata.json +52 -0
- package/docs/.vitepress/cache/deps/chunk-Q2AYPHVK.js +9719 -0
- package/docs/.vitepress/cache/deps/chunk-Q2AYPHVK.js.map +7 -0
- package/docs/.vitepress/cache/deps/chunk-QAXAIFA7.js +12705 -0
- package/docs/.vitepress/cache/deps/chunk-QAXAIFA7.js.map +7 -0
- package/docs/.vitepress/cache/deps/package.json +3 -0
- package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js +4505 -0
- package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js.map +7 -0
- package/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js +583 -0
- package/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js.map +7 -0
- package/docs/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap.js +1145 -0
- package/docs/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap.js.map +7 -0
- package/docs/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js.js +1665 -0
- package/docs/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js.js.map +7 -0
- package/docs/.vitepress/cache/deps/vitepress___minisearch.js +1813 -0
- package/docs/.vitepress/cache/deps/vitepress___minisearch.js.map +7 -0
- package/docs/.vitepress/cache/deps/vue.js +343 -0
- package/docs/.vitepress/cache/deps/vue.js.map +7 -0
- package/docs/.vitepress/config.ts +185 -0
- package/docs/.vitepress/global.d.ts +1 -0
- package/docs/.vitepress/theme/index.ts +6 -0
- package/docs/.vitepress/theme/style.less +17 -0
- package/docs/.vitepress/tsconfig.json +12 -0
- package/docs/changelog.md +10 -0
- package/docs/guide/bubble.md +71 -0
- package/docs/guide/checkbox.md +38 -0
- package/docs/guide/divider.md +41 -0
- package/docs/guide/icon.md +34 -0
- package/docs/guide/install.md +70 -0
- package/docs/guide/introduction.md +28 -0
- package/docs/guide/locale.md +67 -0
- package/docs/guide/menu.md +112 -0
- package/docs/guide/quick-start.md +76 -0
- package/docs/guide/shortcut.md +77 -0
- package/docs/guide/tabs.md +42 -0
- package/docs/guide/wrapper.md +303 -0
- package/docs/index.md +41 -0
- package/docs/menus/built-in/align-center.md +29 -0
- package/docs/menus/built-in/align-justify.md +29 -0
- package/docs/menus/built-in/align-left.md +29 -0
- package/docs/menus/built-in/align-right.md +29 -0
- package/docs/menus/built-in/attachment.md +41 -0
- package/docs/menus/built-in/back-color.md +33 -0
- package/docs/menus/built-in/blockquote.md +29 -0
- package/docs/menus/built-in/bold.md +29 -0
- package/docs/menus/built-in/clear-format.md +29 -0
- package/docs/menus/built-in/code-block-languages.md +37 -0
- package/docs/menus/built-in/code-block.md +29 -0
- package/docs/menus/built-in/code.md +29 -0
- package/docs/menus/built-in/color.md +33 -0
- package/docs/menus/built-in/decrease-indent.md +29 -0
- package/docs/menus/built-in/emoji.md +35 -0
- package/docs/menus/built-in/font-family.md +44 -0
- package/docs/menus/built-in/font-size.md +44 -0
- package/docs/menus/built-in/full-screen.md +39 -0
- package/docs/menus/built-in/heading.md +66 -0
- package/docs/menus/built-in/horizontal.md +29 -0
- package/docs/menus/built-in/image.md +41 -0
- package/docs/menus/built-in/increase-indent.md +29 -0
- package/docs/menus/built-in/italic.md +29 -0
- package/docs/menus/built-in/line-height.md +44 -0
- package/docs/menus/built-in/link-unset.md +29 -0
- package/docs/menus/built-in/link.md +29 -0
- package/docs/menus/built-in/math.md +29 -0
- package/docs/menus/built-in/ordered-list.md +29 -0
- package/docs/menus/built-in/redo.md +25 -0
- package/docs/menus/built-in/strikethrough.md +29 -0
- package/docs/menus/built-in/subscript.md +29 -0
- package/docs/menus/built-in/superscript.md +29 -0
- package/docs/menus/built-in/table-add-column.md +33 -0
- package/docs/menus/built-in/table-add-row.md +33 -0
- package/docs/menus/built-in/table-delete-column.md +29 -0
- package/docs/menus/built-in/table-delete-row.md +29 -0
- package/docs/menus/built-in/table-merge-cell.md +33 -0
- package/docs/menus/built-in/table-unset.md +29 -0
- package/docs/menus/built-in/table.md +37 -0
- package/docs/menus/built-in/task.md +29 -0
- package/docs/menus/built-in/underline.md +29 -0
- package/docs/menus/built-in/undo.md +25 -0
- package/docs/menus/built-in/unordered-list.md +29 -0
- package/docs/menus/built-in/video-controls.md +29 -0
- package/docs/menus/built-in/video-loop.md +29 -0
- package/docs/menus/built-in/video-muted.md +29 -0
- package/docs/menus/built-in/video.md +41 -0
- package/docs/menus/built-in/wrap-down.md +33 -0
- package/docs/menus/built-in/wrap-up.md +33 -0
- package/docs/menus/introduction.md +27 -0
- package/examples/App.tsx +179 -0
- package/examples/main.tsx +9 -0
- package/examples/style.less +21 -0
- package/index.html +13 -0
- package/lib/core/button/button.d.ts +5 -0
- package/lib/core/button/index.d.ts +3 -0
- package/lib/core/button/props.d.ts +38 -0
- package/lib/core/checkbox/checkbox.d.ts +5 -0
- package/lib/core/checkbox/index.d.ts +3 -0
- package/lib/core/checkbox/props.d.ts +21 -0
- package/lib/core/divider/divider.d.ts +4 -0
- package/lib/core/divider/index.d.ts +2 -0
- package/lib/core/icon/icon.d.ts +5 -0
- package/lib/core/icon/index.d.ts +3 -0
- package/lib/core/icon/props.d.ts +22 -0
- package/lib/core/popover/index.d.ts +3 -0
- package/lib/core/popover/popover.d.ts +7 -0
- package/lib/core/popover/props.d.ts +94 -0
- package/lib/core/tabs/index.d.ts +3 -0
- package/lib/core/tabs/props.d.ts +21 -0
- package/lib/core/tabs/tabs.d.ts +2 -0
- package/lib/core/teleport/index.d.ts +3 -0
- package/lib/core/teleport/props.d.ts +11 -0
- package/lib/core/teleport/teleport.d.ts +5 -0
- package/lib/editor/bubble/bubble.d.ts +6 -0
- package/lib/editor/bubble/index.d.ts +3 -0
- package/lib/editor/bubble/props.d.ts +63 -0
- package/lib/editor/menu/built-in/align-center/align-center.d.ts +2 -0
- package/lib/editor/menu/built-in/align-center/index.d.ts +3 -0
- package/lib/editor/menu/built-in/align-center/props.d.ts +10 -0
- package/lib/editor/menu/built-in/align-justify/align-justify.d.ts +2 -0
- package/lib/editor/menu/built-in/align-justify/index.d.ts +3 -0
- package/lib/editor/menu/built-in/align-justify/props.d.ts +10 -0
- package/lib/editor/menu/built-in/align-left/align-left.d.ts +2 -0
- package/lib/editor/menu/built-in/align-left/index.d.ts +3 -0
- package/lib/editor/menu/built-in/align-left/props.d.ts +10 -0
- package/lib/editor/menu/built-in/align-right/align-right.d.ts +2 -0
- package/lib/editor/menu/built-in/align-right/index.d.ts +3 -0
- package/lib/editor/menu/built-in/align-right/props.d.ts +10 -0
- package/lib/editor/menu/built-in/attachment/attachment.d.ts +2 -0
- package/lib/editor/menu/built-in/attachment/index.d.ts +3 -0
- package/lib/editor/menu/built-in/attachment/props.d.ts +26 -0
- package/lib/editor/menu/built-in/back-color/back-color.d.ts +2 -0
- package/lib/editor/menu/built-in/back-color/index.d.ts +3 -0
- package/lib/editor/menu/built-in/back-color/props.d.ts +15 -0
- package/lib/editor/menu/built-in/blockquote/blockquote.d.ts +2 -0
- package/lib/editor/menu/built-in/blockquote/index.d.ts +3 -0
- package/lib/editor/menu/built-in/blockquote/props.d.ts +10 -0
- package/lib/editor/menu/built-in/bold/bold.d.ts +2 -0
- package/lib/editor/menu/built-in/bold/index.d.ts +3 -0
- package/lib/editor/menu/built-in/bold/props.d.ts +10 -0
- package/lib/editor/menu/built-in/clear-format/clear-format.d.ts +2 -0
- package/lib/editor/menu/built-in/clear-format/index.d.ts +3 -0
- package/lib/editor/menu/built-in/clear-format/props.d.ts +10 -0
- package/lib/editor/menu/built-in/code/code.d.ts +2 -0
- package/lib/editor/menu/built-in/code/index.d.ts +3 -0
- package/lib/editor/menu/built-in/code/props.d.ts +10 -0
- package/lib/editor/menu/built-in/code-block/code-block-languages.d.ts +2 -0
- package/lib/editor/menu/built-in/code-block/code-block.d.ts +2 -0
- package/lib/editor/menu/built-in/code-block/index.d.ts +4 -0
- package/lib/editor/menu/built-in/code-block/props.d.ts +32 -0
- package/lib/editor/menu/built-in/color/color.d.ts +2 -0
- package/lib/editor/menu/built-in/color/index.d.ts +3 -0
- package/lib/editor/menu/built-in/color/props.d.ts +15 -0
- package/lib/editor/menu/built-in/decrease-indent/decrease-indent.d.ts +2 -0
- package/lib/editor/menu/built-in/decrease-indent/index.d.ts +3 -0
- package/lib/editor/menu/built-in/decrease-indent/props.d.ts +10 -0
- package/lib/editor/menu/built-in/emoji/emoji.d.ts +2 -0
- package/lib/editor/menu/built-in/emoji/index.d.ts +3 -0
- package/lib/editor/menu/built-in/emoji/props.d.ts +15 -0
- package/lib/editor/menu/built-in/font-family/font-family.d.ts +2 -0
- package/lib/editor/menu/built-in/font-family/index.d.ts +3 -0
- package/lib/editor/menu/built-in/font-family/props.d.ts +21 -0
- package/lib/editor/menu/built-in/font-size/font-size.d.ts +2 -0
- package/lib/editor/menu/built-in/font-size/index.d.ts +3 -0
- package/lib/editor/menu/built-in/font-size/props.d.ts +21 -0
- package/lib/editor/menu/built-in/full-screen/full-screen.d.ts +2 -0
- package/lib/editor/menu/built-in/full-screen/index.d.ts +3 -0
- package/lib/editor/menu/built-in/full-screen/props.d.ts +18 -0
- package/lib/editor/menu/built-in/heading/heading.d.ts +2 -0
- package/lib/editor/menu/built-in/heading/index.d.ts +3 -0
- package/lib/editor/menu/built-in/heading/props.d.ts +21 -0
- package/lib/editor/menu/built-in/horizontal/horizontal.d.ts +2 -0
- package/lib/editor/menu/built-in/horizontal/index.d.ts +3 -0
- package/lib/editor/menu/built-in/horizontal/props.d.ts +10 -0
- package/lib/editor/menu/built-in/image/image.d.ts +2 -0
- package/lib/editor/menu/built-in/image/index.d.ts +3 -0
- package/lib/editor/menu/built-in/image/props.d.ts +26 -0
- package/lib/editor/menu/built-in/increase-indent/increase-indent.d.ts +2 -0
- package/lib/editor/menu/built-in/increase-indent/index.d.ts +3 -0
- package/lib/editor/menu/built-in/increase-indent/props.d.ts +10 -0
- package/lib/editor/menu/built-in/index.d.ts +38 -0
- package/lib/editor/menu/built-in/italic/index.d.ts +3 -0
- package/lib/editor/menu/built-in/italic/italic.d.ts +2 -0
- package/lib/editor/menu/built-in/italic/props.d.ts +10 -0
- package/lib/editor/menu/built-in/line-height/index.d.ts +3 -0
- package/lib/editor/menu/built-in/line-height/line-height.d.ts +2 -0
- package/lib/editor/menu/built-in/line-height/props.d.ts +21 -0
- package/lib/editor/menu/built-in/link/index.d.ts +4 -0
- package/lib/editor/menu/built-in/link/link-unset.d.ts +2 -0
- package/lib/editor/menu/built-in/link/link.d.ts +2 -0
- package/lib/editor/menu/built-in/link/props.d.ts +21 -0
- package/lib/editor/menu/built-in/math/index.d.ts +3 -0
- package/lib/editor/menu/built-in/math/math.d.ts +2 -0
- package/lib/editor/menu/built-in/math/props.d.ts +11 -0
- package/lib/editor/menu/built-in/ordered-list/index.d.ts +3 -0
- package/lib/editor/menu/built-in/ordered-list/ordered-list.d.ts +2 -0
- package/lib/editor/menu/built-in/ordered-list/props.d.ts +11 -0
- package/lib/editor/menu/built-in/redo/index.d.ts +3 -0
- package/lib/editor/menu/built-in/redo/props.d.ts +6 -0
- package/lib/editor/menu/built-in/redo/redo.d.ts +2 -0
- package/lib/editor/menu/built-in/strikethrough/index.d.ts +3 -0
- package/lib/editor/menu/built-in/strikethrough/props.d.ts +10 -0
- package/lib/editor/menu/built-in/strikethrough/strikethrough.d.ts +2 -0
- package/lib/editor/menu/built-in/subscript/index.d.ts +3 -0
- package/lib/editor/menu/built-in/subscript/props.d.ts +10 -0
- package/lib/editor/menu/built-in/subscript/subscript.d.ts +2 -0
- package/lib/editor/menu/built-in/superscript/index.d.ts +3 -0
- package/lib/editor/menu/built-in/superscript/props.d.ts +10 -0
- package/lib/editor/menu/built-in/superscript/superscript.d.ts +2 -0
- package/lib/editor/menu/built-in/table/index.d.ts +9 -0
- package/lib/editor/menu/built-in/table/props.d.ts +97 -0
- package/lib/editor/menu/built-in/table/table-add-column.d.ts +2 -0
- package/lib/editor/menu/built-in/table/table-add-row.d.ts +2 -0
- package/lib/editor/menu/built-in/table/table-delete-column.d.ts +2 -0
- package/lib/editor/menu/built-in/table/table-delete-row.d.ts +2 -0
- package/lib/editor/menu/built-in/table/table-merge-cell.d.ts +2 -0
- package/lib/editor/menu/built-in/table/table-unset.d.ts +2 -0
- package/lib/editor/menu/built-in/table/table.d.ts +2 -0
- package/lib/editor/menu/built-in/task/index.d.ts +3 -0
- package/lib/editor/menu/built-in/task/props.d.ts +10 -0
- package/lib/editor/menu/built-in/task/task.d.ts +2 -0
- package/lib/editor/menu/built-in/underline/index.d.ts +3 -0
- package/lib/editor/menu/built-in/underline/props.d.ts +10 -0
- package/lib/editor/menu/built-in/underline/underline.d.ts +2 -0
- package/lib/editor/menu/built-in/undo/index.d.ts +3 -0
- package/lib/editor/menu/built-in/undo/props.d.ts +6 -0
- package/lib/editor/menu/built-in/undo/undo.d.ts +2 -0
- package/lib/editor/menu/built-in/unordered-list/index.d.ts +3 -0
- package/lib/editor/menu/built-in/unordered-list/props.d.ts +11 -0
- package/lib/editor/menu/built-in/unordered-list/unordered-list.d.ts +2 -0
- package/lib/editor/menu/built-in/video/index.d.ts +6 -0
- package/lib/editor/menu/built-in/video/props.d.ts +56 -0
- package/lib/editor/menu/built-in/video/video-controls.d.ts +2 -0
- package/lib/editor/menu/built-in/video/video-loop.d.ts +2 -0
- package/lib/editor/menu/built-in/video/video-muted.d.ts +2 -0
- package/lib/editor/menu/built-in/video/video.d.ts +2 -0
- package/lib/editor/menu/built-in/wrap-down/index.d.ts +3 -0
- package/lib/editor/menu/built-in/wrap-down/props.d.ts +15 -0
- package/lib/editor/menu/built-in/wrap-down/wrap-down.d.ts +2 -0
- package/lib/editor/menu/built-in/wrap-up/index.d.ts +3 -0
- package/lib/editor/menu/built-in/wrap-up/props.d.ts +15 -0
- package/lib/editor/menu/built-in/wrap-up/wrap-up.d.ts +2 -0
- package/lib/editor/menu/index.d.ts +4 -0
- package/lib/editor/menu/menu.d.ts +6 -0
- package/lib/editor/menu/props.d.ts +89 -0
- package/lib/editor/wrapper/index.d.ts +3 -0
- package/lib/editor/wrapper/props.d.ts +206 -0
- package/lib/editor/wrapper/render.d.ts +18 -0
- package/lib/editor/wrapper/wrapper.d.ts +6 -0
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/use-editor.d.ts +32 -0
- package/lib/index.d.ts +9 -0
- package/lib/kaitify-react.es.js +47868 -0
- package/lib/kaitify-react.umd.js +30 -0
- package/lib/locale/en-us.d.ts +31 -0
- package/lib/locale/index.d.ts +2 -0
- package/lib/locale/ja-jp.d.ts +31 -0
- package/lib/locale/ko-kr.d.ts +31 -0
- package/package.json +56 -0
- package/src/core/button/button.tsx +29 -0
- package/src/core/button/index.ts +3 -0
- package/src/core/button/props.ts +39 -0
- package/src/core/button/style.module.less +57 -0
- package/src/core/checkbox/checkbox.tsx +39 -0
- package/src/core/checkbox/index.ts +3 -0
- package/src/core/checkbox/props.ts +21 -0
- package/src/core/checkbox/style.module.less +99 -0
- package/src/core/divider/divider.tsx +17 -0
- package/src/core/divider/index.ts +2 -0
- package/src/core/divider/style.module.less +12 -0
- package/src/core/icon/icon.tsx +14 -0
- package/src/core/icon/index.ts +3 -0
- package/src/core/icon/props.ts +23 -0
- package/src/core/icon/style.module.less +19 -0
- package/src/core/popover/index.ts +3 -0
- package/src/core/popover/popover.tsx +286 -0
- package/src/core/popover/props.ts +97 -0
- package/src/core/popover/style.module.less +247 -0
- package/src/core/tabs/index.ts +3 -0
- package/src/core/tabs/props.ts +19 -0
- package/src/core/tabs/style.module.less +62 -0
- package/src/core/tabs/tabs.tsx +35 -0
- package/src/core/teleport/index.ts +3 -0
- package/src/core/teleport/props.ts +12 -0
- package/src/core/teleport/teleport.tsx +23 -0
- package/src/editor/bubble/bubble.tsx +244 -0
- package/src/editor/bubble/index.ts +3 -0
- package/src/editor/bubble/props.ts +65 -0
- package/src/editor/bubble/style.module.less +33 -0
- package/src/editor/menu/built-in/align-center/align-center.tsx +37 -0
- package/src/editor/menu/built-in/align-center/index.ts +3 -0
- package/src/editor/menu/built-in/align-center/props.ts +10 -0
- package/src/editor/menu/built-in/align-justify/align-justify.tsx +37 -0
- package/src/editor/menu/built-in/align-justify/index.ts +3 -0
- package/src/editor/menu/built-in/align-justify/props.ts +10 -0
- package/src/editor/menu/built-in/align-left/align-left.tsx +37 -0
- package/src/editor/menu/built-in/align-left/index.ts +3 -0
- package/src/editor/menu/built-in/align-left/props.ts +10 -0
- package/src/editor/menu/built-in/align-right/align-right.tsx +37 -0
- package/src/editor/menu/built-in/align-right/index.ts +3 -0
- package/src/editor/menu/built-in/align-right/props.ts +10 -0
- package/src/editor/menu/built-in/attachment/attachment.tsx +190 -0
- package/src/editor/menu/built-in/attachment/index.ts +3 -0
- package/src/editor/menu/built-in/attachment/props.ts +27 -0
- package/src/editor/menu/built-in/attachment/style.module.less +138 -0
- package/src/editor/menu/built-in/back-color/back-color.tsx +97 -0
- package/src/editor/menu/built-in/back-color/index.ts +3 -0
- package/src/editor/menu/built-in/back-color/props.ts +16 -0
- package/src/editor/menu/built-in/back-color/style.module.less +62 -0
- package/src/editor/menu/built-in/blockquote/blockquote.tsx +36 -0
- package/src/editor/menu/built-in/blockquote/index.ts +3 -0
- package/src/editor/menu/built-in/blockquote/props.ts +10 -0
- package/src/editor/menu/built-in/bold/bold.tsx +45 -0
- package/src/editor/menu/built-in/bold/index.ts +3 -0
- package/src/editor/menu/built-in/bold/props.ts +10 -0
- package/src/editor/menu/built-in/clear-format/clear-format.tsx +28 -0
- package/src/editor/menu/built-in/clear-format/index.ts +3 -0
- package/src/editor/menu/built-in/clear-format/props.ts +10 -0
- package/src/editor/menu/built-in/code/code.tsx +49 -0
- package/src/editor/menu/built-in/code/index.ts +3 -0
- package/src/editor/menu/built-in/code/props.ts +10 -0
- package/src/editor/menu/built-in/code-block/code-block-languages.tsx +73 -0
- package/src/editor/menu/built-in/code-block/code-block.tsx +36 -0
- package/src/editor/menu/built-in/code-block/index.ts +4 -0
- package/src/editor/menu/built-in/code-block/props.ts +32 -0
- package/src/editor/menu/built-in/color/color.tsx +96 -0
- package/src/editor/menu/built-in/color/index.ts +3 -0
- package/src/editor/menu/built-in/color/props.ts +16 -0
- package/src/editor/menu/built-in/color/style.module.less +62 -0
- package/src/editor/menu/built-in/decrease-indent/decrease-indent.tsx +31 -0
- package/src/editor/menu/built-in/decrease-indent/index.ts +3 -0
- package/src/editor/menu/built-in/decrease-indent/props.ts +10 -0
- package/src/editor/menu/built-in/emoji/emoji.tsx +143 -0
- package/src/editor/menu/built-in/emoji/index.ts +3 -0
- package/src/editor/menu/built-in/emoji/props.ts +16 -0
- package/src/editor/menu/built-in/emoji/style.module.less +26 -0
- package/src/editor/menu/built-in/font-family/font-family.tsx +99 -0
- package/src/editor/menu/built-in/font-family/index.ts +3 -0
- package/src/editor/menu/built-in/font-family/props.ts +20 -0
- package/src/editor/menu/built-in/font-size/font-size.tsx +110 -0
- package/src/editor/menu/built-in/font-size/index.ts +3 -0
- package/src/editor/menu/built-in/font-size/props.ts +20 -0
- package/src/editor/menu/built-in/full-screen/full-screen.tsx +66 -0
- package/src/editor/menu/built-in/full-screen/index.ts +3 -0
- package/src/editor/menu/built-in/full-screen/props.ts +18 -0
- package/src/editor/menu/built-in/heading/heading.tsx +101 -0
- package/src/editor/menu/built-in/heading/index.ts +3 -0
- package/src/editor/menu/built-in/heading/props.ts +20 -0
- package/src/editor/menu/built-in/horizontal/horizontal.tsx +40 -0
- package/src/editor/menu/built-in/horizontal/index.ts +3 -0
- package/src/editor/menu/built-in/horizontal/props.ts +10 -0
- package/src/editor/menu/built-in/image/image.tsx +189 -0
- package/src/editor/menu/built-in/image/index.ts +3 -0
- package/src/editor/menu/built-in/image/props.ts +27 -0
- package/src/editor/menu/built-in/image/style.module.less +138 -0
- package/src/editor/menu/built-in/increase-indent/increase-indent.tsx +31 -0
- package/src/editor/menu/built-in/increase-indent/index.ts +3 -0
- package/src/editor/menu/built-in/increase-indent/props.ts +10 -0
- package/src/editor/menu/built-in/index.ts +38 -0
- package/src/editor/menu/built-in/italic/index.ts +3 -0
- package/src/editor/menu/built-in/italic/italic.tsx +45 -0
- package/src/editor/menu/built-in/italic/props.ts +10 -0
- package/src/editor/menu/built-in/line-height/index.ts +3 -0
- package/src/editor/menu/built-in/line-height/line-height.tsx +81 -0
- package/src/editor/menu/built-in/line-height/props.ts +20 -0
- package/src/editor/menu/built-in/link/index.ts +4 -0
- package/src/editor/menu/built-in/link/link-unset.tsx +30 -0
- package/src/editor/menu/built-in/link/link.tsx +147 -0
- package/src/editor/menu/built-in/link/props.ts +23 -0
- package/src/editor/menu/built-in/link/style.module.less +51 -0
- package/src/editor/menu/built-in/math/index.ts +3 -0
- package/src/editor/menu/built-in/math/math.tsx +98 -0
- package/src/editor/menu/built-in/math/props.ts +12 -0
- package/src/editor/menu/built-in/math/style.module.less +54 -0
- package/src/editor/menu/built-in/ordered-list/index.ts +3 -0
- package/src/editor/menu/built-in/ordered-list/ordered-list.tsx +85 -0
- package/src/editor/menu/built-in/ordered-list/props.ts +12 -0
- package/src/editor/menu/built-in/ordered-list/style.module.less +16 -0
- package/src/editor/menu/built-in/redo/index.ts +3 -0
- package/src/editor/menu/built-in/redo/props.ts +6 -0
- package/src/editor/menu/built-in/redo/redo.tsx +30 -0
- package/src/editor/menu/built-in/strikethrough/index.ts +3 -0
- package/src/editor/menu/built-in/strikethrough/props.ts +10 -0
- package/src/editor/menu/built-in/strikethrough/strikethrough.tsx +45 -0
- package/src/editor/menu/built-in/subscript/index.ts +3 -0
- package/src/editor/menu/built-in/subscript/props.ts +10 -0
- package/src/editor/menu/built-in/subscript/subscript.tsx +45 -0
- package/src/editor/menu/built-in/superscript/index.ts +3 -0
- package/src/editor/menu/built-in/superscript/props.ts +10 -0
- package/src/editor/menu/built-in/superscript/superscript.tsx +45 -0
- package/src/editor/menu/built-in/table/index.ts +9 -0
- package/src/editor/menu/built-in/table/props.ts +105 -0
- package/src/editor/menu/built-in/table/style.module.less +63 -0
- package/src/editor/menu/built-in/table/table-add-column.tsx +31 -0
- package/src/editor/menu/built-in/table/table-add-row.tsx +31 -0
- package/src/editor/menu/built-in/table/table-delete-column.tsx +31 -0
- package/src/editor/menu/built-in/table/table-delete-row.tsx +31 -0
- package/src/editor/menu/built-in/table/table-merge-cell.tsx +34 -0
- package/src/editor/menu/built-in/table/table-unset.tsx +31 -0
- package/src/editor/menu/built-in/table/table.tsx +144 -0
- package/src/editor/menu/built-in/task/index.ts +3 -0
- package/src/editor/menu/built-in/task/props.ts +10 -0
- package/src/editor/menu/built-in/task/task.tsx +36 -0
- package/src/editor/menu/built-in/underline/index.ts +3 -0
- package/src/editor/menu/built-in/underline/props.ts +10 -0
- package/src/editor/menu/built-in/underline/underline.tsx +46 -0
- package/src/editor/menu/built-in/undo/index.ts +3 -0
- package/src/editor/menu/built-in/undo/props.ts +6 -0
- package/src/editor/menu/built-in/undo/undo.tsx +31 -0
- package/src/editor/menu/built-in/unordered-list/index.ts +3 -0
- package/src/editor/menu/built-in/unordered-list/props.ts +12 -0
- package/src/editor/menu/built-in/unordered-list/style.module.less +16 -0
- package/src/editor/menu/built-in/unordered-list/unordered-list.tsx +85 -0
- package/src/editor/menu/built-in/video/index.ts +6 -0
- package/src/editor/menu/built-in/video/props.ts +60 -0
- package/src/editor/menu/built-in/video/style.module.less +92 -0
- package/src/editor/menu/built-in/video/video-controls.tsx +44 -0
- package/src/editor/menu/built-in/video/video-loop.tsx +47 -0
- package/src/editor/menu/built-in/video/video-muted.tsx +48 -0
- package/src/editor/menu/built-in/video/video.tsx +138 -0
- package/src/editor/menu/built-in/wrap-down/index.ts +3 -0
- package/src/editor/menu/built-in/wrap-down/props.ts +16 -0
- package/src/editor/menu/built-in/wrap-down/wrap-down.tsx +49 -0
- package/src/editor/menu/built-in/wrap-up/index.ts +3 -0
- package/src/editor/menu/built-in/wrap-up/props.ts +16 -0
- package/src/editor/menu/built-in/wrap-up/wrap-up.tsx +52 -0
- package/src/editor/menu/index.ts +4 -0
- package/src/editor/menu/menu.tsx +176 -0
- package/src/editor/menu/props.ts +90 -0
- package/src/editor/menu/style.module.less +80 -0
- package/src/editor/wrapper/index.ts +3 -0
- package/src/editor/wrapper/props.ts +209 -0
- package/src/editor/wrapper/render.ts +79 -0
- package/src/editor/wrapper/style.module.less +10 -0
- package/src/editor/wrapper/wrapper.tsx +220 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/use-editor.ts +47 -0
- package/src/iconfont/iconfont.css +247 -0
- package/src/iconfont/iconfont.ttf +0 -0
- package/src/iconfont/iconfont.woff +0 -0
- package/src/index.ts +20 -0
- package/src/locale/en-us.ts +30 -0
- package/src/locale/index.ts +18 -0
- package/src/locale/ja-jp.ts +30 -0
- package/src/locale/ko-kr.ts +30 -0
- package/src/var.less +19 -0
- package/tsconfig.json +32 -0
- package/tsconfig.node.json +11 -0
- package/vite-env.d.ts +5 -0
- package/vite.config.ts +58 -0
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import React, { forwardRef, useEffect, useId, useImperativeHandle, useMemo, useRef, useState } from 'react'
|
|
2
|
+
import classNames from 'classnames'
|
|
3
|
+
import { createPopper, Instance } from '@popperjs/core'
|
|
4
|
+
import { event as DapEvent } from 'dap-util'
|
|
5
|
+
import { CSSTransition } from 'react-transition-group'
|
|
6
|
+
import { useEditor } from '@/hooks'
|
|
7
|
+
import { Teleport } from '../teleport'
|
|
8
|
+
import { PopoverPropsType, PopoverPlacementType, PopoverRefType } from './props'
|
|
9
|
+
import styles from './style.module.less'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 浮层组件
|
|
13
|
+
*/
|
|
14
|
+
const Popover = forwardRef<PopoverRefType, PopoverPropsType>(({ placement = 'bottom', trigger = 'hover', delay = 0, animation = 'translate', ...props }, ref) => {
|
|
15
|
+
//唯一id
|
|
16
|
+
const uid = useId()
|
|
17
|
+
//深色模式
|
|
18
|
+
const { dark } = useEditor()
|
|
19
|
+
//是否显示
|
|
20
|
+
const [visible, setVisible] = useState(false)
|
|
21
|
+
//浮层真实位置
|
|
22
|
+
const [realPlacement, setRealPlacement] = useState<PopoverPlacementType>(placement)
|
|
23
|
+
//目标元素
|
|
24
|
+
const referRef = useRef<HTMLDivElement | null>(null)
|
|
25
|
+
//三角形元素
|
|
26
|
+
const arrowRef = useRef<HTMLDivElement | null>(null)
|
|
27
|
+
//浮层元素
|
|
28
|
+
const popoverRef = useRef<HTMLDivElement | null>(null)
|
|
29
|
+
//popperjs实例
|
|
30
|
+
const popperInstance = useRef<Instance | undefined>()
|
|
31
|
+
|
|
32
|
+
//浮层剩余位置
|
|
33
|
+
const popoverRemainingPlacements = useMemo<PopoverPlacementType[]>(() => {
|
|
34
|
+
if (placement.startsWith('top')) {
|
|
35
|
+
return (['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'] as PopoverPlacementType[]).filter(item => item != placement)
|
|
36
|
+
}
|
|
37
|
+
if (placement.startsWith('bottom')) {
|
|
38
|
+
return (['bottom', 'bottom-start', 'bottom-end', 'top', 'top-start', 'top-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'] as PopoverPlacementType[]).filter(item => item != placement)
|
|
39
|
+
}
|
|
40
|
+
if (placement.startsWith('left')) {
|
|
41
|
+
return (['left', 'left-start', 'left-end', 'right', 'right-start', 'right-end', 'top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end'] as PopoverPlacementType[]).filter(item => item != placement)
|
|
42
|
+
}
|
|
43
|
+
return (['right', 'right-start', 'right-end', 'left', 'left-start', 'left-end', 'top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end'] as PopoverPlacementType[]).filter(item => item != placement)
|
|
44
|
+
}, [placement])
|
|
45
|
+
|
|
46
|
+
//更新浮层位置
|
|
47
|
+
const update = async () => {
|
|
48
|
+
if (popperInstance.current) {
|
|
49
|
+
await popperInstance.current.update()
|
|
50
|
+
setRealPlacement(popperInstance.current.state.placement)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//创建popperjs实例
|
|
54
|
+
const createPopperjs = () => {
|
|
55
|
+
popperInstance.current = createPopper(referRef.current as HTMLElement, popoverRef.current as HTMLElement, {
|
|
56
|
+
placement: placement,
|
|
57
|
+
modifiers: [
|
|
58
|
+
//控制浮层的位置计算方式,包括使用 GPU 加速、是否启用自适应等
|
|
59
|
+
{
|
|
60
|
+
name: 'computeStyles',
|
|
61
|
+
options: {
|
|
62
|
+
adaptive: true, //启用自适应
|
|
63
|
+
gpuAcceleration: false //关闭GPU加速
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
//如果弹出框在预设的位置被页面边界或其他限制遮挡,popperjs会自动尝试翻转到其他位置。它会检查可用的视窗空间并自动调整位置,确保内容不会超出视窗或被遮挡。
|
|
67
|
+
{
|
|
68
|
+
name: 'flip',
|
|
69
|
+
options: {
|
|
70
|
+
enabled: true,
|
|
71
|
+
fallbackPlacements: popoverRemainingPlacements
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
//控制offset为0
|
|
75
|
+
{
|
|
76
|
+
name: 'offset',
|
|
77
|
+
options: {
|
|
78
|
+
offset: [0, 0]
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
//设置箭头元素的位置,使其始终指向目标元素
|
|
82
|
+
{
|
|
83
|
+
name: 'arrow',
|
|
84
|
+
options: {
|
|
85
|
+
element: arrowRef.current!
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
//确保浮层不会超出指定的边界区域,通常用于当浮层过大或目标位置变化时自动修正浮层位置
|
|
89
|
+
{
|
|
90
|
+
name: 'preventOverflow',
|
|
91
|
+
options: {
|
|
92
|
+
enabled: true,
|
|
93
|
+
boundary: 'viewport',
|
|
94
|
+
padding: 5
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
})
|
|
99
|
+
}
|
|
100
|
+
//销毁popperjs实例
|
|
101
|
+
const destroyPopperjs = () => {
|
|
102
|
+
if (popperInstance.current) {
|
|
103
|
+
popperInstance.current.destroy()
|
|
104
|
+
popperInstance.current = undefined
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
//显示浮层
|
|
108
|
+
const showPopover = () => {
|
|
109
|
+
if (props.disabled) {
|
|
110
|
+
return
|
|
111
|
+
}
|
|
112
|
+
//延迟显示
|
|
113
|
+
if (delay > 0) {
|
|
114
|
+
setTimeout(() => {
|
|
115
|
+
setVisible(true)
|
|
116
|
+
}, delay)
|
|
117
|
+
return
|
|
118
|
+
}
|
|
119
|
+
//正常显示
|
|
120
|
+
setVisible(true)
|
|
121
|
+
}
|
|
122
|
+
//隐藏浮层
|
|
123
|
+
const hidePopover = () => {
|
|
124
|
+
if (props.disabled) {
|
|
125
|
+
return
|
|
126
|
+
}
|
|
127
|
+
setVisible(false)
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
//浮层显示前
|
|
131
|
+
const onShow = () => {
|
|
132
|
+
props.onShow?.(popoverRef.current as HTMLElement)
|
|
133
|
+
}
|
|
134
|
+
//浮层显示时
|
|
135
|
+
const onShowing = () => {
|
|
136
|
+
createPopperjs()
|
|
137
|
+
props.onShowing?.(popoverRef.current as HTMLElement)
|
|
138
|
+
}
|
|
139
|
+
//浮层显示后
|
|
140
|
+
const onShown = () => {
|
|
141
|
+
props.onShown?.(popoverRef.current as HTMLElement)
|
|
142
|
+
}
|
|
143
|
+
//浮层隐藏前
|
|
144
|
+
const onHide = () => {
|
|
145
|
+
props.onHide?.(popoverRef.current as HTMLElement)
|
|
146
|
+
}
|
|
147
|
+
//浮层隐藏时
|
|
148
|
+
const onHiding = () => {
|
|
149
|
+
props.onHiding?.(popoverRef.current as HTMLElement)
|
|
150
|
+
}
|
|
151
|
+
//浮层隐藏后
|
|
152
|
+
const onHidden = () => {
|
|
153
|
+
destroyPopperjs()
|
|
154
|
+
props.onHidden?.(popoverRef.current as HTMLElement)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
//鼠标移入
|
|
158
|
+
const handleMouseEnter = () => {
|
|
159
|
+
if (trigger != 'hover') {
|
|
160
|
+
return
|
|
161
|
+
}
|
|
162
|
+
showPopover()
|
|
163
|
+
}
|
|
164
|
+
//鼠标移出
|
|
165
|
+
const handleMouseLeave = (e: React.MouseEvent) => {
|
|
166
|
+
if (trigger != 'hover') {
|
|
167
|
+
return
|
|
168
|
+
}
|
|
169
|
+
//移出到目标元素里
|
|
170
|
+
if (referRef.current?.contains(e.relatedTarget as HTMLElement)) {
|
|
171
|
+
return
|
|
172
|
+
}
|
|
173
|
+
//移出到浮层元素里
|
|
174
|
+
if (popoverRef.current?.contains(e.relatedTarget as HTMLElement)) {
|
|
175
|
+
return
|
|
176
|
+
}
|
|
177
|
+
hidePopover()
|
|
178
|
+
}
|
|
179
|
+
//点击
|
|
180
|
+
const handleClick = () => {
|
|
181
|
+
if (trigger != 'click') {
|
|
182
|
+
return
|
|
183
|
+
}
|
|
184
|
+
if (visible) hidePopover()
|
|
185
|
+
else showPopover()
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
useImperativeHandle(ref, () => ({
|
|
189
|
+
visible,
|
|
190
|
+
showPopover,
|
|
191
|
+
hidePopover,
|
|
192
|
+
popperInstance,
|
|
193
|
+
realPlacement,
|
|
194
|
+
update
|
|
195
|
+
}))
|
|
196
|
+
|
|
197
|
+
//监听外部改变placement,更新poperjs对象
|
|
198
|
+
useEffect(() => {
|
|
199
|
+
//更新realPlacement的值
|
|
200
|
+
setRealPlacement(placement)
|
|
201
|
+
if (popperInstance.current && visible) {
|
|
202
|
+
popperInstance.current.state.options.placement = placement
|
|
203
|
+
popperInstance.current.state.options.modifiers.find(mod => mod.name === 'flip').options.fallbackPlacements = popoverRemainingPlacements
|
|
204
|
+
update()
|
|
205
|
+
}
|
|
206
|
+
}, [placement])
|
|
207
|
+
|
|
208
|
+
//点击其他地方关闭浮层
|
|
209
|
+
useEffect(() => {
|
|
210
|
+
DapEvent.on(document.documentElement, `click.kaitify-popover-${uid}`, e => {
|
|
211
|
+
//点击目标元素
|
|
212
|
+
if (referRef.current?.contains(e.target as HTMLElement)) {
|
|
213
|
+
return
|
|
214
|
+
}
|
|
215
|
+
//点击浮层元素
|
|
216
|
+
if (popoverRef.current?.contains(e.target as HTMLElement)) {
|
|
217
|
+
return
|
|
218
|
+
}
|
|
219
|
+
//关闭浮层
|
|
220
|
+
hidePopover()
|
|
221
|
+
})
|
|
222
|
+
return () => {
|
|
223
|
+
destroyPopperjs()
|
|
224
|
+
DapEvent.off(document.documentElement, `click.kaitify-popover-${uid}`)
|
|
225
|
+
}
|
|
226
|
+
}, [])
|
|
227
|
+
|
|
228
|
+
return (
|
|
229
|
+
<>
|
|
230
|
+
<div
|
|
231
|
+
ref={referRef}
|
|
232
|
+
className={classNames(styles['kaitify-popover-refer'], {
|
|
233
|
+
[styles['kaitify-dark']]: dark
|
|
234
|
+
})}
|
|
235
|
+
onMouseEnter={handleMouseEnter}
|
|
236
|
+
onMouseLeave={handleMouseLeave}
|
|
237
|
+
onClick={handleClick}
|
|
238
|
+
>
|
|
239
|
+
{props.refer}
|
|
240
|
+
</div>
|
|
241
|
+
<Teleport to='body'>
|
|
242
|
+
<CSSTransition
|
|
243
|
+
in={visible}
|
|
244
|
+
timeout={200}
|
|
245
|
+
classNames={{
|
|
246
|
+
enter: animation === 'translate' ? styles['kaitify-popover-translate-enter'] : styles['kaitify-popover-fade-enter'],
|
|
247
|
+
enterActive: animation === 'translate' ? styles['kaitify-popover-translate-enter-active'] : styles['kaitify-popover-fade-enter-active'],
|
|
248
|
+
exit: animation === 'translate' ? styles['kaitify-popover-translate-exit'] : styles['kaitify-popover-fade-exit'],
|
|
249
|
+
exitActive: animation === 'translate' ? styles['kaitify-popover-translate-exit-active'] : styles['kaitify-popover-fade-exit-active']
|
|
250
|
+
}}
|
|
251
|
+
nodeRef={popoverRef}
|
|
252
|
+
unmountOnExit
|
|
253
|
+
onEnter={onShow}
|
|
254
|
+
onEntering={onShowing}
|
|
255
|
+
onEntered={onShown}
|
|
256
|
+
onExit={onHide}
|
|
257
|
+
onExiting={onHiding}
|
|
258
|
+
onExited={onHidden}
|
|
259
|
+
>
|
|
260
|
+
<div
|
|
261
|
+
ref={popoverRef}
|
|
262
|
+
className={classNames(styles['kaitify-popover'], {
|
|
263
|
+
[styles['kaitify-dark']]: dark
|
|
264
|
+
})}
|
|
265
|
+
onMouseLeave={handleMouseLeave}
|
|
266
|
+
data-arrow={props.arrow}
|
|
267
|
+
data-placement={realPlacement}
|
|
268
|
+
style={{ zIndex: props.zIndex ?? 10 }}
|
|
269
|
+
>
|
|
270
|
+
{/* 主体 */}
|
|
271
|
+
<div className={styles['kaitify-popover-wrapper']}>
|
|
272
|
+
{/* 内容区域 */}
|
|
273
|
+
<div className={styles['kaitify-popover-content']} style={{ width: props.width ?? 'auto', maxHeight: props.maxHeight ?? '', minWidth: props.minWidth ?? '' }}>
|
|
274
|
+
{props.children}
|
|
275
|
+
</div>
|
|
276
|
+
{/* arrow */}
|
|
277
|
+
{props.arrow && <div ref={arrowRef} className={styles['kaitify-popover-arrow']} data-placement={realPlacement} />}
|
|
278
|
+
</div>
|
|
279
|
+
</div>
|
|
280
|
+
</CSSTransition>
|
|
281
|
+
</Teleport>
|
|
282
|
+
</>
|
|
283
|
+
)
|
|
284
|
+
})
|
|
285
|
+
|
|
286
|
+
export default Popover
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Instance } from '@popperjs/core'
|
|
2
|
+
import { ReactNode } from 'react'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 浮层位置类型
|
|
6
|
+
*/
|
|
7
|
+
export type PopoverPlacementType = 'auto' | 'auto-start' | 'auto-end' | 'bottom-start' | 'bottom' | 'bottom-end' | 'top-start' | 'top' | 'top-end' | 'left-start' | 'left' | 'left-end' | 'right-start' | 'right' | 'right-end'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* 浮层组件属性类型
|
|
11
|
+
*/
|
|
12
|
+
export type PopoverPropsType = {
|
|
13
|
+
/**
|
|
14
|
+
* 浮层宽度
|
|
15
|
+
*/
|
|
16
|
+
width?: string | number
|
|
17
|
+
/**
|
|
18
|
+
* 浮层最小宽度
|
|
19
|
+
*/
|
|
20
|
+
minWidth?: string | number
|
|
21
|
+
/**
|
|
22
|
+
* 浮层最大高度
|
|
23
|
+
*/
|
|
24
|
+
maxHeight?: string | number
|
|
25
|
+
/**
|
|
26
|
+
* 浮层位置
|
|
27
|
+
*/
|
|
28
|
+
placement?: PopoverPlacementType
|
|
29
|
+
/**
|
|
30
|
+
* 是否显示三角形
|
|
31
|
+
*/
|
|
32
|
+
arrow?: boolean
|
|
33
|
+
/**
|
|
34
|
+
* 触发浮层的方式
|
|
35
|
+
*/
|
|
36
|
+
trigger?: 'hover' | 'click' | 'custom'
|
|
37
|
+
/**
|
|
38
|
+
* 浮层显示动画
|
|
39
|
+
*/
|
|
40
|
+
animation?: 'fade' | 'translate'
|
|
41
|
+
/**
|
|
42
|
+
* 浮层层级
|
|
43
|
+
*/
|
|
44
|
+
zIndex?: number
|
|
45
|
+
/**
|
|
46
|
+
* 显示延迟时间
|
|
47
|
+
*/
|
|
48
|
+
delay?: number
|
|
49
|
+
/**
|
|
50
|
+
* 是否禁用浮层
|
|
51
|
+
*/
|
|
52
|
+
disabled?: boolean
|
|
53
|
+
/**
|
|
54
|
+
* 目标元素插槽
|
|
55
|
+
*/
|
|
56
|
+
refer: ReactNode
|
|
57
|
+
/**
|
|
58
|
+
* 浮层内容插槽
|
|
59
|
+
*/
|
|
60
|
+
children: ReactNode
|
|
61
|
+
/**
|
|
62
|
+
* 浮层显示前触发的事件
|
|
63
|
+
*/
|
|
64
|
+
onShow?: (el: Element) => void
|
|
65
|
+
/**
|
|
66
|
+
* 浮层显示时触发的事件
|
|
67
|
+
*/
|
|
68
|
+
onShowing?: (el: Element) => void
|
|
69
|
+
/**
|
|
70
|
+
* 浮层显示后触发的事件
|
|
71
|
+
*/
|
|
72
|
+
onShown?: (el: Element) => void
|
|
73
|
+
/**
|
|
74
|
+
* 浮层隐藏前触发的事件
|
|
75
|
+
*/
|
|
76
|
+
onHide?: (el: Element) => void
|
|
77
|
+
/**
|
|
78
|
+
* 浮层隐藏时触发的事件
|
|
79
|
+
*/
|
|
80
|
+
onHiding?: (el: Element) => void
|
|
81
|
+
/**
|
|
82
|
+
* 浮层隐藏后触发的事件
|
|
83
|
+
*/
|
|
84
|
+
onHidden?: (el: Element) => void
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* 浮层组件实例类型
|
|
89
|
+
*/
|
|
90
|
+
export type PopoverRefType = {
|
|
91
|
+
visible: boolean
|
|
92
|
+
showPopover: () => void
|
|
93
|
+
hidePopover: () => void
|
|
94
|
+
popperInstance: React.MutableRefObject<Instance | undefined>
|
|
95
|
+
update: () => Promise<void>
|
|
96
|
+
realPlacement: PopoverPlacementType
|
|
97
|
+
}
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
.kaitify-popover-refer {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
justify-content: flex-start;
|
|
4
|
+
align-items: center;
|
|
5
|
+
padding: 0;
|
|
6
|
+
margin: 0;
|
|
7
|
+
position: relative;
|
|
8
|
+
color: @font-color;
|
|
9
|
+
font-size: @font-size;
|
|
10
|
+
line-height: @line-height;
|
|
11
|
+
font-family: @font-family;
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
|
|
14
|
+
&.kaitify-dark {
|
|
15
|
+
color: @font-color-dark;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.kaitify-popover {
|
|
20
|
+
&,
|
|
21
|
+
*,
|
|
22
|
+
*::before,
|
|
23
|
+
*::after {
|
|
24
|
+
box-sizing: border-box;
|
|
25
|
+
outline: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&[data-placement^='bottom'] {
|
|
29
|
+
padding-top: @small-padding;
|
|
30
|
+
|
|
31
|
+
&[data-arrow='true'] {
|
|
32
|
+
padding-top: calc(@small-padding + 6px);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
&[data-placement^='top'] {
|
|
36
|
+
padding-bottom: @small-padding;
|
|
37
|
+
|
|
38
|
+
&[data-arrow='true'] {
|
|
39
|
+
padding-bottom: calc(@small-padding + 6px);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
&[data-placement^='left'] {
|
|
43
|
+
padding-right: @small-padding;
|
|
44
|
+
|
|
45
|
+
&[data-arrow='true'] {
|
|
46
|
+
padding-right: calc(@small-padding + 6px);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
&[data-placement^='right'] {
|
|
50
|
+
padding-left: @small-padding;
|
|
51
|
+
|
|
52
|
+
&[data-arrow='true'] {
|
|
53
|
+
padding-left: calc(@small-padding + 6px);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.kaitify-popover-wrapper {
|
|
58
|
+
position: relative;
|
|
59
|
+
background: @background-color;
|
|
60
|
+
border: 1px solid @border-color;
|
|
61
|
+
border-radius: @border-radius;
|
|
62
|
+
box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.06);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.kaitify-popover-content {
|
|
66
|
+
display: block;
|
|
67
|
+
color: @font-color;
|
|
68
|
+
font-size: @font-size;
|
|
69
|
+
font-family: @font-family;
|
|
70
|
+
line-height: @line-height;
|
|
71
|
+
overflow-x: hidden;
|
|
72
|
+
overflow-y: auto;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.kaitify-popover-arrow {
|
|
76
|
+
display: inline-block;
|
|
77
|
+
width: 0;
|
|
78
|
+
height: 0;
|
|
79
|
+
border-color: transparent;
|
|
80
|
+
border-style: solid;
|
|
81
|
+
border-width: 6px;
|
|
82
|
+
|
|
83
|
+
&::before {
|
|
84
|
+
position: absolute;
|
|
85
|
+
display: inline-block;
|
|
86
|
+
width: 0;
|
|
87
|
+
height: 0;
|
|
88
|
+
border-color: transparent;
|
|
89
|
+
border-style: solid;
|
|
90
|
+
border-width: 5px;
|
|
91
|
+
content: '';
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
&[data-placement^='bottom'] {
|
|
95
|
+
border-top: none;
|
|
96
|
+
border-bottom-color: @border-color;
|
|
97
|
+
bottom: 100%;
|
|
98
|
+
|
|
99
|
+
&::before {
|
|
100
|
+
border-top: none;
|
|
101
|
+
border-bottom-color: @background-color;
|
|
102
|
+
left: 1px;
|
|
103
|
+
top: 1.5px;
|
|
104
|
+
right: auto;
|
|
105
|
+
bottom: 0;
|
|
106
|
+
margin-left: -6px;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
&[data-placement^='top'] {
|
|
111
|
+
border-bottom: none;
|
|
112
|
+
border-top-color: @border-color;
|
|
113
|
+
top: 100%;
|
|
114
|
+
|
|
115
|
+
&::before {
|
|
116
|
+
border-bottom: none;
|
|
117
|
+
border-top-color: @background-color;
|
|
118
|
+
left: 1px;
|
|
119
|
+
bottom: 1.5px;
|
|
120
|
+
top: auto;
|
|
121
|
+
right: auto;
|
|
122
|
+
margin-left: -6px;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
&[data-placement='right'] {
|
|
127
|
+
border-left: none;
|
|
128
|
+
border-right-color: @border-color;
|
|
129
|
+
right: 100%;
|
|
130
|
+
|
|
131
|
+
&::before {
|
|
132
|
+
border-left: none;
|
|
133
|
+
border-right-color: @background-color;
|
|
134
|
+
left: 1.5px;
|
|
135
|
+
top: 1px;
|
|
136
|
+
right: auto;
|
|
137
|
+
bottom: auto;
|
|
138
|
+
margin-top: -6px;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
&[data-placement='left'] {
|
|
143
|
+
border-right: none;
|
|
144
|
+
border-left-color: @border-color;
|
|
145
|
+
left: 100%;
|
|
146
|
+
|
|
147
|
+
&::before {
|
|
148
|
+
border-right: none;
|
|
149
|
+
border-left-color: @background-color;
|
|
150
|
+
right: 1.5px;
|
|
151
|
+
top: 1px;
|
|
152
|
+
bottom: auto;
|
|
153
|
+
left: auto;
|
|
154
|
+
margin-top: -6px;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
&.kaitify-dark {
|
|
160
|
+
.kaitify-popover-wrapper {
|
|
161
|
+
background: @background-color-dark;
|
|
162
|
+
border-color: @border-color-dark;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.kaitify-popover-content {
|
|
166
|
+
color: @font-color-dark;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.kaitify-popover-arrow {
|
|
170
|
+
&[data-placement^='bottom'] {
|
|
171
|
+
border-bottom-color: @border-color-dark;
|
|
172
|
+
|
|
173
|
+
&::before {
|
|
174
|
+
border-bottom-color: @background-color-dark;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
&[data-placement^='top'] {
|
|
179
|
+
border-top-color: @border-color-dark;
|
|
180
|
+
|
|
181
|
+
&::before {
|
|
182
|
+
border-top-color: @background-color-dark;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
&[data-placement='right'] {
|
|
187
|
+
border-left: none;
|
|
188
|
+
border-right-color: @border-color-dark;
|
|
189
|
+
right: 100%;
|
|
190
|
+
|
|
191
|
+
&::before {
|
|
192
|
+
border-right-color: @background-color-dark;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
&[data-placement='left'] {
|
|
197
|
+
border-left-color: @border-color-dark;
|
|
198
|
+
|
|
199
|
+
&::before {
|
|
200
|
+
border-left-color: @background-color-dark;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.kaitify-popover-translate-enter {
|
|
208
|
+
opacity: 0;
|
|
209
|
+
transform: translateY(20px);
|
|
210
|
+
}
|
|
211
|
+
.kaitify-popover-translate-exit {
|
|
212
|
+
opacity: 1;
|
|
213
|
+
transform: translateY(0px);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.kaitify-popover-translate-enter-active {
|
|
217
|
+
opacity: 1;
|
|
218
|
+
transform: translateY(0px);
|
|
219
|
+
transition: opacity 200ms ease-in-out, transform 200ms ease-in-out;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.kaitify-popover-translate-exit-active {
|
|
223
|
+
opacity: 0;
|
|
224
|
+
transform: translateY(20px);
|
|
225
|
+
transition: opacity 200ms ease-in-out, transform 200ms ease-in-out;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.kaitify-popover-fade-enter {
|
|
229
|
+
opacity: 0;
|
|
230
|
+
transform: translateY(20px);
|
|
231
|
+
}
|
|
232
|
+
.kaitify-popover-fade-exit {
|
|
233
|
+
opacity: 1;
|
|
234
|
+
transform: translateY(0px);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.kaitify-popover-fade-enter-active {
|
|
238
|
+
opacity: 1;
|
|
239
|
+
transform: translateY(0px);
|
|
240
|
+
transition: opacity 200ms ease-in-out, transform 200ms ease-in-out;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.kaitify-popover-fade-exit-active {
|
|
244
|
+
opacity: 0;
|
|
245
|
+
transform: translateY(20px);
|
|
246
|
+
transition: opacity 200ms ease-in-out, transform 200ms ease-in-out;
|
|
247
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ReactNode } from 'react'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 选项卡组件属性类型
|
|
5
|
+
*/
|
|
6
|
+
export type TabsPropsType = {
|
|
7
|
+
/**
|
|
8
|
+
* 选项卡分栏数据
|
|
9
|
+
*/
|
|
10
|
+
data: { label: string; value: string | number }[]
|
|
11
|
+
/**
|
|
12
|
+
* 选项卡默认选项
|
|
13
|
+
*/
|
|
14
|
+
defaultValue: string | number
|
|
15
|
+
/**
|
|
16
|
+
* 默认插槽
|
|
17
|
+
*/
|
|
18
|
+
children: ReactNode | ((current: string | number) => ReactNode)
|
|
19
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
.kaitify-tabs {
|
|
2
|
+
display: block;
|
|
3
|
+
width: 100%;
|
|
4
|
+
position: relative;
|
|
5
|
+
font-size: @font-size;
|
|
6
|
+
color: @font-color;
|
|
7
|
+
line-height: @line-height;
|
|
8
|
+
font-family: @font-family;
|
|
9
|
+
|
|
10
|
+
&.kaitify-dark {
|
|
11
|
+
color: @font-color-dark;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&,
|
|
15
|
+
*,
|
|
16
|
+
*::before,
|
|
17
|
+
*::after {
|
|
18
|
+
box-sizing: border-box;
|
|
19
|
+
outline: none;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.kaitify-tabs-header {
|
|
23
|
+
display: flex;
|
|
24
|
+
justify-content: flex-start;
|
|
25
|
+
align-items: center;
|
|
26
|
+
width: 100%;
|
|
27
|
+
padding: @small-padding 0;
|
|
28
|
+
|
|
29
|
+
.kaitify-tabs-header-item {
|
|
30
|
+
padding: @small-padding @padding;
|
|
31
|
+
position: relative;
|
|
32
|
+
transition: color 300ms;
|
|
33
|
+
|
|
34
|
+
&:hover {
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
color: @theme;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&.kaitify-tabs-header-item-active {
|
|
40
|
+
color: @theme;
|
|
41
|
+
|
|
42
|
+
&::before {
|
|
43
|
+
position: absolute;
|
|
44
|
+
width: calc((100% - @small-padding * 2) * 2 / 3);
|
|
45
|
+
height: 2px;
|
|
46
|
+
left: 50%;
|
|
47
|
+
bottom: 0;
|
|
48
|
+
transform: translateX(-50%);
|
|
49
|
+
content: '';
|
|
50
|
+
background: @theme;
|
|
51
|
+
border-radius: 2px;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.kaitify-tabs-content {
|
|
58
|
+
position: relative;
|
|
59
|
+
display: block;
|
|
60
|
+
width: 100%;
|
|
61
|
+
}
|
|
62
|
+
}
|