@kaitify/react 0.0.1-beta.2 → 0.0.1-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/changelog.md +6 -1
- package/docs/guide/install.md +5 -5
- package/examples/App.tsx +13 -11
- package/lib/kaitify-react.es.js +5 -5
- package/lib/kaitify-react.umd.js +2 -2
- package/package.json +3 -4
- package/src/core/popover/popover.tsx +4 -4
- package/test.html +40 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaitify/react",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "so-better",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@iconify/react": "^6.0.2",
|
|
20
|
-
"@kaitify/core": "0.0.2-beta.
|
|
20
|
+
"@kaitify/core": "0.0.2-beta.9",
|
|
21
21
|
"@popperjs/core": "^2.11.8",
|
|
22
22
|
"classnames": "^2.5.1",
|
|
23
23
|
"dap-util": "^1.6.0",
|
|
@@ -31,8 +31,7 @@
|
|
|
31
31
|
"@types/react-dom": "^18.3.1",
|
|
32
32
|
"@types/react-transition-group": "^4.4.5",
|
|
33
33
|
"@vitejs/plugin-react": "^5.0.4",
|
|
34
|
-
"less": "^
|
|
35
|
-
"less-loader": "^5.0.0",
|
|
34
|
+
"less": "^4.2.0",
|
|
36
35
|
"terser": "^5.16.9",
|
|
37
36
|
"typescript": "~5.9.3",
|
|
38
37
|
"vite": "^5.4.10",
|
|
@@ -28,6 +28,8 @@ const Popover = forwardRef<PopoverRefType, PopoverPropsType>(({ placement = 'bot
|
|
|
28
28
|
const popoverRef = useRef<HTMLDivElement | null>(null)
|
|
29
29
|
//popperjs实例
|
|
30
30
|
const popperInstance = useRef<Instance | undefined>()
|
|
31
|
+
//计时器实例
|
|
32
|
+
const timeoutRef = useRef<ReturnType<typeof setTimeout>>()
|
|
31
33
|
|
|
32
34
|
//浮层剩余位置
|
|
33
35
|
const popoverRemainingPlacements = useMemo<PopoverPlacementType[]>(() => {
|
|
@@ -111,7 +113,8 @@ const Popover = forwardRef<PopoverRefType, PopoverPropsType>(({ placement = 'bot
|
|
|
111
113
|
}
|
|
112
114
|
//延迟显示
|
|
113
115
|
if (delay > 0) {
|
|
114
|
-
|
|
116
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current)
|
|
117
|
+
timeoutRef.current = setTimeout(() => {
|
|
115
118
|
setVisible(true)
|
|
116
119
|
}, delay)
|
|
117
120
|
return
|
|
@@ -121,9 +124,6 @@ const Popover = forwardRef<PopoverRefType, PopoverPropsType>(({ placement = 'bot
|
|
|
121
124
|
}
|
|
122
125
|
//隐藏浮层
|
|
123
126
|
const hidePopover = () => {
|
|
124
|
-
if (props.disabled) {
|
|
125
|
-
return
|
|
126
|
-
}
|
|
127
127
|
setVisible(false)
|
|
128
128
|
}
|
|
129
129
|
|
package/test.html
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Document</title>
|
|
7
|
+
<script type="importmap">
|
|
8
|
+
{
|
|
9
|
+
"imports": {
|
|
10
|
+
"react": "https://esm.sh/react@18",
|
|
11
|
+
"react-dom": "https://esm.sh/react-dom@18",
|
|
12
|
+
"@kaitify/react": "/lib/kaitify-react.es.js"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
</script>
|
|
16
|
+
</head>
|
|
17
|
+
<body>
|
|
18
|
+
<div id="root"></div>
|
|
19
|
+
<script type="module">
|
|
20
|
+
import React from 'react'
|
|
21
|
+
import ReactDom from 'react-dom'
|
|
22
|
+
import { Wrapper, Bubble, BoldMenu, AlignLeftMenu, AlignCenterMenu, AlignRightMenu, AlignJustifyMenu, AttachmentMenu, BackColorMenu, BlockquoteMenu, CodeMenu, CodeBlockMenu, ColorMenu, FontFamilyMenu, FontSizeMenu, HeadingMenu, RedoMenu, UndoMenu, HorizontalMenu, ImageMenu, IncreaseIndentMenu, DecreaseIndentMenu, ItalicMenu, LineHeightMenu, LinkMenu, OrderedListMenu, UnorderedListMenu, MathMenu, StrikethroughMenu, SubscriptMenu, SuperscriptMenu, TableMenu, UnderlineMenu, VideoMenu, TaskMenu, WrapUpMenu, WrapDownMenu, CodeBlockLanguagesMenu, TableUnsetMenu, TableDeleteRowMenu, TableDeleteColumnMenu, TableAddRowMenu, TableAddColumnMenu, TableMergeCellMenu, VideoControlsMenu, VideoMutedMenu, VideoLoopMenu, ClearFormatMenu, LinkUnsetMenu, EmojiMenu, Divider } from '@kaitify/react'
|
|
23
|
+
|
|
24
|
+
const App = () => {
|
|
25
|
+
const [value, setValue] = React.useState('')
|
|
26
|
+
|
|
27
|
+
return React.createElement(Wrapper, {
|
|
28
|
+
value: value,
|
|
29
|
+
onChange: setValue,
|
|
30
|
+
style: { width: '100%', height: '100%' },
|
|
31
|
+
placeholder: 'Please Enter Text...',
|
|
32
|
+
before: React.createElement(EmojiMenu)
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const root = ReactDom.createRoot(document.getElementById('root'))
|
|
37
|
+
root.render(React.createElement(App))
|
|
38
|
+
</script>
|
|
39
|
+
</body>
|
|
40
|
+
</html>
|