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.
@@ -11,7 +11,7 @@ import {
11
11
  import { Placement } from "../types";
12
12
  import { getElementParentDetails } from "../helpers";
13
13
 
14
- const OFFSET = 11;
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
- _placement,
254
- popupStyle: {
255
- zIndex: 10000,
256
- position: "absolute",
257
- opacity: Object.keys(popupPosition).length ? 1 : 0,
258
- ...popupPosition
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x-ui-design",
3
- "version": "0.9.88",
3
+ "version": "0.9.89",
4
4
  "license": "ISC",
5
5
  "author": "Gabriel Boyajyan",
6
6
  "main": "dist/index.js",
package/src/app/page.tsx CHANGED
@@ -193,8 +193,8 @@ export default function Home() {
193
193
  // </div>
194
194
  // </Popover>
195
195
  // </div>
196
- // {/* <DatePicker placement='right' getPopupContainer={() => document.body} /> */}
197
- <Dropdown trigger={'hover'} overlay={() => {
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>