x-ui-design 0.9.88 → 0.9.89
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/dist/index.esm.js +14 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +14 -10
- package/dist/index.js.map +1 -1
- package/lib/hooks/usePopupPosition.ts +14 -9
- package/package.json +1 -1
- package/src/app/page.tsx +5 -2
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import { Placement } from "../types";
|
|
12
12
|
import { getElementParentDetails } from "../helpers";
|
|
13
13
|
|
|
14
|
-
const OFFSET =
|
|
14
|
+
const OFFSET = 8;
|
|
15
15
|
const LEFT_OR_RIGHT = ['left', 'right'];
|
|
16
16
|
|
|
17
17
|
type TPopupPosition = {
|
|
@@ -249,13 +249,18 @@ export const usePopupPosition = ({
|
|
|
249
249
|
};
|
|
250
250
|
}, [open, targetRef, listenPopoverPossitions, calculatePosition]);
|
|
251
251
|
|
|
252
|
-
return {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
252
|
+
return useMemo(() => {
|
|
253
|
+
const startedTargetRects = targetRef.current?.getBoundingClientRect() || {};
|
|
254
|
+
const visible = Object.keys(popupPosition).length
|
|
255
|
+
|
|
256
|
+
return {
|
|
257
|
+
_placement,
|
|
258
|
+
popupStyle: {
|
|
259
|
+
zIndex: 10000,
|
|
260
|
+
position: "absolute",
|
|
261
|
+
opacity: visible ? 1 : 0,
|
|
262
|
+
...!visible ? startedTargetRects : popupPosition
|
|
263
|
+
}
|
|
259
264
|
}
|
|
260
|
-
};
|
|
265
|
+
}, [targetRef, _placement, popupPosition]);
|
|
261
266
|
};
|
package/package.json
CHANGED
package/src/app/page.tsx
CHANGED
|
@@ -193,8 +193,8 @@ export default function Home() {
|
|
|
193
193
|
// </div>
|
|
194
194
|
// </Popover>
|
|
195
195
|
// </div>
|
|
196
|
-
|
|
197
|
-
|
|
196
|
+
<div>
|
|
197
|
+
<Dropdown trigger={'hover'} getPopupContainer={() => document.body} overlay={() => {
|
|
198
198
|
return <Menu items={items} selectable selectedKeys={['13']} />
|
|
199
199
|
{/* {items.map((item) => {
|
|
200
200
|
return <MenuItem key={item.key} itemKey={item.key} label={item.label} />
|
|
@@ -203,6 +203,9 @@ export default function Home() {
|
|
|
203
203
|
}}>
|
|
204
204
|
Dropdown
|
|
205
205
|
</Dropdown>
|
|
206
|
+
<DatePicker placement='right' getPopupContainer={() => document.body} />
|
|
207
|
+
|
|
208
|
+
</div>
|
|
206
209
|
// </div>
|
|
207
210
|
// <div style={{ minWidth: 1500 }} />
|
|
208
211
|
// </div>
|