@x-plat/design-system 0.5.15 → 0.5.16
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/components/Dropdown/index.cjs +8 -6
- package/dist/components/Dropdown/index.js +8 -6
- package/dist/components/PopOver/index.cjs +8 -6
- package/dist/components/PopOver/index.js +8 -6
- package/dist/components/Select/index.cjs +8 -6
- package/dist/components/Select/index.js +8 -6
- package/dist/components/index.cjs +8 -6
- package/dist/components/index.js +8 -6
- package/dist/index.cjs +8 -6
- package/dist/index.js +8 -6
- package/package.json +1 -1
|
@@ -47,20 +47,22 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
47
47
|
const calculatePosition = import_react.default.useCallback(() => {
|
|
48
48
|
if (!triggerRef.current || !popRef.current) return;
|
|
49
49
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
50
|
-
const
|
|
50
|
+
const popW = popRef.current.offsetWidth;
|
|
51
|
+
const popH = popRef.current.offsetHeight;
|
|
51
52
|
const viewportHeight = window.innerHeight;
|
|
52
53
|
const viewportWidth = window.innerWidth;
|
|
53
54
|
let direction = "bottom";
|
|
54
55
|
let top;
|
|
55
|
-
let left
|
|
56
|
-
if (triggerRect.bottom +
|
|
56
|
+
let left;
|
|
57
|
+
if (triggerRect.bottom + popH > viewportHeight && triggerRect.top - popH > 0) {
|
|
57
58
|
direction = "top";
|
|
58
|
-
top = triggerRect.top -
|
|
59
|
+
top = triggerRect.top - popH;
|
|
59
60
|
} else {
|
|
60
61
|
top = triggerRect.bottom;
|
|
61
62
|
}
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
left = triggerRect.left;
|
|
64
|
+
if (left + popW > viewportWidth - 8) {
|
|
65
|
+
left = triggerRect.right - popW;
|
|
64
66
|
}
|
|
65
67
|
if (left < 8) left = 8;
|
|
66
68
|
setPosition({
|
|
@@ -11,20 +11,22 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
11
11
|
const calculatePosition = React.useCallback(() => {
|
|
12
12
|
if (!triggerRef.current || !popRef.current) return;
|
|
13
13
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
14
|
-
const
|
|
14
|
+
const popW = popRef.current.offsetWidth;
|
|
15
|
+
const popH = popRef.current.offsetHeight;
|
|
15
16
|
const viewportHeight = window.innerHeight;
|
|
16
17
|
const viewportWidth = window.innerWidth;
|
|
17
18
|
let direction = "bottom";
|
|
18
19
|
let top;
|
|
19
|
-
let left
|
|
20
|
-
if (triggerRect.bottom +
|
|
20
|
+
let left;
|
|
21
|
+
if (triggerRect.bottom + popH > viewportHeight && triggerRect.top - popH > 0) {
|
|
21
22
|
direction = "top";
|
|
22
|
-
top = triggerRect.top -
|
|
23
|
+
top = triggerRect.top - popH;
|
|
23
24
|
} else {
|
|
24
25
|
top = triggerRect.bottom;
|
|
25
26
|
}
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
left = triggerRect.left;
|
|
28
|
+
if (left + popW > viewportWidth - 8) {
|
|
29
|
+
left = triggerRect.right - popW;
|
|
28
30
|
}
|
|
29
31
|
if (left < 8) left = 8;
|
|
30
32
|
setPosition({
|
|
@@ -47,20 +47,22 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
47
47
|
const calculatePosition = import_react.default.useCallback(() => {
|
|
48
48
|
if (!triggerRef.current || !popRef.current) return;
|
|
49
49
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
50
|
-
const
|
|
50
|
+
const popW = popRef.current.offsetWidth;
|
|
51
|
+
const popH = popRef.current.offsetHeight;
|
|
51
52
|
const viewportHeight = window.innerHeight;
|
|
52
53
|
const viewportWidth = window.innerWidth;
|
|
53
54
|
let direction = "bottom";
|
|
54
55
|
let top;
|
|
55
|
-
let left
|
|
56
|
-
if (triggerRect.bottom +
|
|
56
|
+
let left;
|
|
57
|
+
if (triggerRect.bottom + popH > viewportHeight && triggerRect.top - popH > 0) {
|
|
57
58
|
direction = "top";
|
|
58
|
-
top = triggerRect.top -
|
|
59
|
+
top = triggerRect.top - popH;
|
|
59
60
|
} else {
|
|
60
61
|
top = triggerRect.bottom;
|
|
61
62
|
}
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
left = triggerRect.left;
|
|
64
|
+
if (left + popW > viewportWidth - 8) {
|
|
65
|
+
left = triggerRect.right - popW;
|
|
64
66
|
}
|
|
65
67
|
if (left < 8) left = 8;
|
|
66
68
|
setPosition({
|
|
@@ -11,20 +11,22 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
11
11
|
const calculatePosition = React.useCallback(() => {
|
|
12
12
|
if (!triggerRef.current || !popRef.current) return;
|
|
13
13
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
14
|
-
const
|
|
14
|
+
const popW = popRef.current.offsetWidth;
|
|
15
|
+
const popH = popRef.current.offsetHeight;
|
|
15
16
|
const viewportHeight = window.innerHeight;
|
|
16
17
|
const viewportWidth = window.innerWidth;
|
|
17
18
|
let direction = "bottom";
|
|
18
19
|
let top;
|
|
19
|
-
let left
|
|
20
|
-
if (triggerRect.bottom +
|
|
20
|
+
let left;
|
|
21
|
+
if (triggerRect.bottom + popH > viewportHeight && triggerRect.top - popH > 0) {
|
|
21
22
|
direction = "top";
|
|
22
|
-
top = triggerRect.top -
|
|
23
|
+
top = triggerRect.top - popH;
|
|
23
24
|
} else {
|
|
24
25
|
top = triggerRect.bottom;
|
|
25
26
|
}
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
left = triggerRect.left;
|
|
28
|
+
if (left + popW > viewportWidth - 8) {
|
|
29
|
+
left = triggerRect.right - popW;
|
|
28
30
|
}
|
|
29
31
|
if (left < 8) left = 8;
|
|
30
32
|
setPosition({
|
|
@@ -48,20 +48,22 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
48
48
|
const calculatePosition = import_react.default.useCallback(() => {
|
|
49
49
|
if (!triggerRef.current || !popRef.current) return;
|
|
50
50
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
51
|
-
const
|
|
51
|
+
const popW = popRef.current.offsetWidth;
|
|
52
|
+
const popH = popRef.current.offsetHeight;
|
|
52
53
|
const viewportHeight = window.innerHeight;
|
|
53
54
|
const viewportWidth = window.innerWidth;
|
|
54
55
|
let direction = "bottom";
|
|
55
56
|
let top;
|
|
56
|
-
let left
|
|
57
|
-
if (triggerRect.bottom +
|
|
57
|
+
let left;
|
|
58
|
+
if (triggerRect.bottom + popH > viewportHeight && triggerRect.top - popH > 0) {
|
|
58
59
|
direction = "top";
|
|
59
|
-
top = triggerRect.top -
|
|
60
|
+
top = triggerRect.top - popH;
|
|
60
61
|
} else {
|
|
61
62
|
top = triggerRect.bottom;
|
|
62
63
|
}
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
left = triggerRect.left;
|
|
65
|
+
if (left + popW > viewportWidth - 8) {
|
|
66
|
+
left = triggerRect.right - popW;
|
|
65
67
|
}
|
|
66
68
|
if (left < 8) left = 8;
|
|
67
69
|
setPosition({
|
|
@@ -11,20 +11,22 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
11
11
|
const calculatePosition = React.useCallback(() => {
|
|
12
12
|
if (!triggerRef.current || !popRef.current) return;
|
|
13
13
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
14
|
-
const
|
|
14
|
+
const popW = popRef.current.offsetWidth;
|
|
15
|
+
const popH = popRef.current.offsetHeight;
|
|
15
16
|
const viewportHeight = window.innerHeight;
|
|
16
17
|
const viewportWidth = window.innerWidth;
|
|
17
18
|
let direction = "bottom";
|
|
18
19
|
let top;
|
|
19
|
-
let left
|
|
20
|
-
if (triggerRect.bottom +
|
|
20
|
+
let left;
|
|
21
|
+
if (triggerRect.bottom + popH > viewportHeight && triggerRect.top - popH > 0) {
|
|
21
22
|
direction = "top";
|
|
22
|
-
top = triggerRect.top -
|
|
23
|
+
top = triggerRect.top - popH;
|
|
23
24
|
} else {
|
|
24
25
|
top = triggerRect.bottom;
|
|
25
26
|
}
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
left = triggerRect.left;
|
|
28
|
+
if (left + popW > viewportWidth - 8) {
|
|
29
|
+
left = triggerRect.right - popW;
|
|
28
30
|
}
|
|
29
31
|
if (left < 8) left = 8;
|
|
30
32
|
setPosition({
|
|
@@ -3397,20 +3397,22 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
3397
3397
|
const calculatePosition = import_react18.default.useCallback(() => {
|
|
3398
3398
|
if (!triggerRef.current || !popRef.current) return;
|
|
3399
3399
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
3400
|
-
const
|
|
3400
|
+
const popW = popRef.current.offsetWidth;
|
|
3401
|
+
const popH = popRef.current.offsetHeight;
|
|
3401
3402
|
const viewportHeight = window.innerHeight;
|
|
3402
3403
|
const viewportWidth = window.innerWidth;
|
|
3403
3404
|
let direction = "bottom";
|
|
3404
3405
|
let top;
|
|
3405
|
-
let left
|
|
3406
|
-
if (triggerRect.bottom +
|
|
3406
|
+
let left;
|
|
3407
|
+
if (triggerRect.bottom + popH > viewportHeight && triggerRect.top - popH > 0) {
|
|
3407
3408
|
direction = "top";
|
|
3408
|
-
top = triggerRect.top -
|
|
3409
|
+
top = triggerRect.top - popH;
|
|
3409
3410
|
} else {
|
|
3410
3411
|
top = triggerRect.bottom;
|
|
3411
3412
|
}
|
|
3412
|
-
|
|
3413
|
-
|
|
3413
|
+
left = triggerRect.left;
|
|
3414
|
+
if (left + popW > viewportWidth - 8) {
|
|
3415
|
+
left = triggerRect.right - popW;
|
|
3414
3416
|
}
|
|
3415
3417
|
if (left < 8) left = 8;
|
|
3416
3418
|
setPosition({
|
package/dist/components/index.js
CHANGED
|
@@ -3309,20 +3309,22 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
3309
3309
|
const calculatePosition = React17.useCallback(() => {
|
|
3310
3310
|
if (!triggerRef.current || !popRef.current) return;
|
|
3311
3311
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
3312
|
-
const
|
|
3312
|
+
const popW = popRef.current.offsetWidth;
|
|
3313
|
+
const popH = popRef.current.offsetHeight;
|
|
3313
3314
|
const viewportHeight = window.innerHeight;
|
|
3314
3315
|
const viewportWidth = window.innerWidth;
|
|
3315
3316
|
let direction = "bottom";
|
|
3316
3317
|
let top;
|
|
3317
|
-
let left
|
|
3318
|
-
if (triggerRect.bottom +
|
|
3318
|
+
let left;
|
|
3319
|
+
if (triggerRect.bottom + popH > viewportHeight && triggerRect.top - popH > 0) {
|
|
3319
3320
|
direction = "top";
|
|
3320
|
-
top = triggerRect.top -
|
|
3321
|
+
top = triggerRect.top - popH;
|
|
3321
3322
|
} else {
|
|
3322
3323
|
top = triggerRect.bottom;
|
|
3323
3324
|
}
|
|
3324
|
-
|
|
3325
|
-
|
|
3325
|
+
left = triggerRect.left;
|
|
3326
|
+
if (left + popW > viewportWidth - 8) {
|
|
3327
|
+
left = triggerRect.right - popW;
|
|
3326
3328
|
}
|
|
3327
3329
|
if (left < 8) left = 8;
|
|
3328
3330
|
setPosition({
|
package/dist/index.cjs
CHANGED
|
@@ -7821,20 +7821,22 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
7821
7821
|
const calculatePosition = import_react18.default.useCallback(() => {
|
|
7822
7822
|
if (!triggerRef.current || !popRef.current) return;
|
|
7823
7823
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
7824
|
-
const
|
|
7824
|
+
const popW = popRef.current.offsetWidth;
|
|
7825
|
+
const popH = popRef.current.offsetHeight;
|
|
7825
7826
|
const viewportHeight = window.innerHeight;
|
|
7826
7827
|
const viewportWidth = window.innerWidth;
|
|
7827
7828
|
let direction = "bottom";
|
|
7828
7829
|
let top;
|
|
7829
|
-
let left
|
|
7830
|
-
if (triggerRect.bottom +
|
|
7830
|
+
let left;
|
|
7831
|
+
if (triggerRect.bottom + popH > viewportHeight && triggerRect.top - popH > 0) {
|
|
7831
7832
|
direction = "top";
|
|
7832
|
-
top = triggerRect.top -
|
|
7833
|
+
top = triggerRect.top - popH;
|
|
7833
7834
|
} else {
|
|
7834
7835
|
top = triggerRect.bottom;
|
|
7835
7836
|
}
|
|
7836
|
-
|
|
7837
|
-
|
|
7837
|
+
left = triggerRect.left;
|
|
7838
|
+
if (left + popW > viewportWidth - 8) {
|
|
7839
|
+
left = triggerRect.right - popW;
|
|
7838
7840
|
}
|
|
7839
7841
|
if (left < 8) left = 8;
|
|
7840
7842
|
setPosition({
|
package/dist/index.js
CHANGED
|
@@ -7424,20 +7424,22 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
7424
7424
|
const calculatePosition = React17.useCallback(() => {
|
|
7425
7425
|
if (!triggerRef.current || !popRef.current) return;
|
|
7426
7426
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
7427
|
-
const
|
|
7427
|
+
const popW = popRef.current.offsetWidth;
|
|
7428
|
+
const popH = popRef.current.offsetHeight;
|
|
7428
7429
|
const viewportHeight = window.innerHeight;
|
|
7429
7430
|
const viewportWidth = window.innerWidth;
|
|
7430
7431
|
let direction = "bottom";
|
|
7431
7432
|
let top;
|
|
7432
|
-
let left
|
|
7433
|
-
if (triggerRect.bottom +
|
|
7433
|
+
let left;
|
|
7434
|
+
if (triggerRect.bottom + popH > viewportHeight && triggerRect.top - popH > 0) {
|
|
7434
7435
|
direction = "top";
|
|
7435
|
-
top = triggerRect.top -
|
|
7436
|
+
top = triggerRect.top - popH;
|
|
7436
7437
|
} else {
|
|
7437
7438
|
top = triggerRect.bottom;
|
|
7438
7439
|
}
|
|
7439
|
-
|
|
7440
|
-
|
|
7440
|
+
left = triggerRect.left;
|
|
7441
|
+
if (left + popW > viewportWidth - 8) {
|
|
7442
|
+
left = triggerRect.right - popW;
|
|
7441
7443
|
}
|
|
7442
7444
|
if (left < 8) left = 8;
|
|
7443
7445
|
setPosition({
|