@x-plat/design-system 0.14.17 → 0.14.18
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 +9 -2
- package/dist/components/Dropdown/index.js +9 -2
- package/dist/components/PopOver/index.cjs +9 -2
- package/dist/components/PopOver/index.js +9 -2
- package/dist/components/Select/index.cjs +9 -2
- package/dist/components/Select/index.js +9 -2
- package/dist/components/TimePicker/index.cjs +9 -2
- package/dist/components/TimePicker/index.js +9 -2
- package/dist/components/index.cjs +9 -2
- package/dist/components/index.js +9 -2
- package/dist/index.cjs +9 -2
- package/dist/index.js +9 -2
- package/package.json +1 -1
|
@@ -103,9 +103,11 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
103
103
|
const sizeRef = import_react.default.useRef(null);
|
|
104
104
|
const scrollParentRef = import_react.default.useRef(null);
|
|
105
105
|
const placedRef = import_react.default.useRef(false);
|
|
106
|
+
const frozenMaxRef = import_react.default.useRef(void 0);
|
|
106
107
|
const calculatePosition = import_react.default.useCallback((remeasure = false) => {
|
|
107
108
|
const pop = popRef.current;
|
|
108
109
|
if (!triggerRef.current || !pop) return;
|
|
110
|
+
if (remeasure) frozenMaxRef.current = void 0;
|
|
109
111
|
if (remeasure || !sizeRef.current) {
|
|
110
112
|
sizeRef.current = {
|
|
111
113
|
w: pop.offsetWidth,
|
|
@@ -127,12 +129,16 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
127
129
|
};
|
|
128
130
|
const first = !placedRef.current;
|
|
129
131
|
if (first) pop.style.transition = "none";
|
|
130
|
-
const
|
|
132
|
+
const frozen = frozenMaxRef.current;
|
|
133
|
+
const effectiveH = frozen == null ? popH : Math.min(popH, frozen);
|
|
134
|
+
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
131
135
|
triggerRect,
|
|
132
136
|
popW,
|
|
133
|
-
|
|
137
|
+
effectiveH,
|
|
134
138
|
clip
|
|
135
139
|
);
|
|
140
|
+
if (frozenMaxRef.current === void 0) frozenMaxRef.current = suggested;
|
|
141
|
+
const maxHeight = frozenMaxRef.current;
|
|
136
142
|
pop.style.top = `${top + window.scrollY}px`;
|
|
137
143
|
pop.style.left = `${left + window.scrollX}px`;
|
|
138
144
|
pop.style.maxHeight = maxHeight === null ? "" : `${maxHeight}px`;
|
|
@@ -151,6 +157,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
151
157
|
sizeRef.current = null;
|
|
152
158
|
scrollParentRef.current = null;
|
|
153
159
|
placedRef.current = false;
|
|
160
|
+
frozenMaxRef.current = void 0;
|
|
154
161
|
return;
|
|
155
162
|
}
|
|
156
163
|
if (triggerRef.current) {
|
|
@@ -67,9 +67,11 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
67
67
|
const sizeRef = React.useRef(null);
|
|
68
68
|
const scrollParentRef = React.useRef(null);
|
|
69
69
|
const placedRef = React.useRef(false);
|
|
70
|
+
const frozenMaxRef = React.useRef(void 0);
|
|
70
71
|
const calculatePosition = React.useCallback((remeasure = false) => {
|
|
71
72
|
const pop = popRef.current;
|
|
72
73
|
if (!triggerRef.current || !pop) return;
|
|
74
|
+
if (remeasure) frozenMaxRef.current = void 0;
|
|
73
75
|
if (remeasure || !sizeRef.current) {
|
|
74
76
|
sizeRef.current = {
|
|
75
77
|
w: pop.offsetWidth,
|
|
@@ -91,12 +93,16 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
91
93
|
};
|
|
92
94
|
const first = !placedRef.current;
|
|
93
95
|
if (first) pop.style.transition = "none";
|
|
94
|
-
const
|
|
96
|
+
const frozen = frozenMaxRef.current;
|
|
97
|
+
const effectiveH = frozen == null ? popH : Math.min(popH, frozen);
|
|
98
|
+
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
95
99
|
triggerRect,
|
|
96
100
|
popW,
|
|
97
|
-
|
|
101
|
+
effectiveH,
|
|
98
102
|
clip
|
|
99
103
|
);
|
|
104
|
+
if (frozenMaxRef.current === void 0) frozenMaxRef.current = suggested;
|
|
105
|
+
const maxHeight = frozenMaxRef.current;
|
|
100
106
|
pop.style.top = `${top + window.scrollY}px`;
|
|
101
107
|
pop.style.left = `${left + window.scrollX}px`;
|
|
102
108
|
pop.style.maxHeight = maxHeight === null ? "" : `${maxHeight}px`;
|
|
@@ -115,6 +121,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
115
121
|
sizeRef.current = null;
|
|
116
122
|
scrollParentRef.current = null;
|
|
117
123
|
placedRef.current = false;
|
|
124
|
+
frozenMaxRef.current = void 0;
|
|
118
125
|
return;
|
|
119
126
|
}
|
|
120
127
|
if (triggerRef.current) {
|
|
@@ -103,9 +103,11 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
103
103
|
const sizeRef = import_react.default.useRef(null);
|
|
104
104
|
const scrollParentRef = import_react.default.useRef(null);
|
|
105
105
|
const placedRef = import_react.default.useRef(false);
|
|
106
|
+
const frozenMaxRef = import_react.default.useRef(void 0);
|
|
106
107
|
const calculatePosition = import_react.default.useCallback((remeasure = false) => {
|
|
107
108
|
const pop = popRef.current;
|
|
108
109
|
if (!triggerRef.current || !pop) return;
|
|
110
|
+
if (remeasure) frozenMaxRef.current = void 0;
|
|
109
111
|
if (remeasure || !sizeRef.current) {
|
|
110
112
|
sizeRef.current = {
|
|
111
113
|
w: pop.offsetWidth,
|
|
@@ -127,12 +129,16 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
127
129
|
};
|
|
128
130
|
const first = !placedRef.current;
|
|
129
131
|
if (first) pop.style.transition = "none";
|
|
130
|
-
const
|
|
132
|
+
const frozen = frozenMaxRef.current;
|
|
133
|
+
const effectiveH = frozen == null ? popH : Math.min(popH, frozen);
|
|
134
|
+
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
131
135
|
triggerRect,
|
|
132
136
|
popW,
|
|
133
|
-
|
|
137
|
+
effectiveH,
|
|
134
138
|
clip
|
|
135
139
|
);
|
|
140
|
+
if (frozenMaxRef.current === void 0) frozenMaxRef.current = suggested;
|
|
141
|
+
const maxHeight = frozenMaxRef.current;
|
|
136
142
|
pop.style.top = `${top + window.scrollY}px`;
|
|
137
143
|
pop.style.left = `${left + window.scrollX}px`;
|
|
138
144
|
pop.style.maxHeight = maxHeight === null ? "" : `${maxHeight}px`;
|
|
@@ -151,6 +157,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
151
157
|
sizeRef.current = null;
|
|
152
158
|
scrollParentRef.current = null;
|
|
153
159
|
placedRef.current = false;
|
|
160
|
+
frozenMaxRef.current = void 0;
|
|
154
161
|
return;
|
|
155
162
|
}
|
|
156
163
|
if (triggerRef.current) {
|
|
@@ -67,9 +67,11 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
67
67
|
const sizeRef = React.useRef(null);
|
|
68
68
|
const scrollParentRef = React.useRef(null);
|
|
69
69
|
const placedRef = React.useRef(false);
|
|
70
|
+
const frozenMaxRef = React.useRef(void 0);
|
|
70
71
|
const calculatePosition = React.useCallback((remeasure = false) => {
|
|
71
72
|
const pop = popRef.current;
|
|
72
73
|
if (!triggerRef.current || !pop) return;
|
|
74
|
+
if (remeasure) frozenMaxRef.current = void 0;
|
|
73
75
|
if (remeasure || !sizeRef.current) {
|
|
74
76
|
sizeRef.current = {
|
|
75
77
|
w: pop.offsetWidth,
|
|
@@ -91,12 +93,16 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
91
93
|
};
|
|
92
94
|
const first = !placedRef.current;
|
|
93
95
|
if (first) pop.style.transition = "none";
|
|
94
|
-
const
|
|
96
|
+
const frozen = frozenMaxRef.current;
|
|
97
|
+
const effectiveH = frozen == null ? popH : Math.min(popH, frozen);
|
|
98
|
+
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
95
99
|
triggerRect,
|
|
96
100
|
popW,
|
|
97
|
-
|
|
101
|
+
effectiveH,
|
|
98
102
|
clip
|
|
99
103
|
);
|
|
104
|
+
if (frozenMaxRef.current === void 0) frozenMaxRef.current = suggested;
|
|
105
|
+
const maxHeight = frozenMaxRef.current;
|
|
100
106
|
pop.style.top = `${top + window.scrollY}px`;
|
|
101
107
|
pop.style.left = `${left + window.scrollX}px`;
|
|
102
108
|
pop.style.maxHeight = maxHeight === null ? "" : `${maxHeight}px`;
|
|
@@ -115,6 +121,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
115
121
|
sizeRef.current = null;
|
|
116
122
|
scrollParentRef.current = null;
|
|
117
123
|
placedRef.current = false;
|
|
124
|
+
frozenMaxRef.current = void 0;
|
|
118
125
|
return;
|
|
119
126
|
}
|
|
120
127
|
if (triggerRef.current) {
|
|
@@ -104,9 +104,11 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
104
104
|
const sizeRef = import_react.default.useRef(null);
|
|
105
105
|
const scrollParentRef = import_react.default.useRef(null);
|
|
106
106
|
const placedRef = import_react.default.useRef(false);
|
|
107
|
+
const frozenMaxRef = import_react.default.useRef(void 0);
|
|
107
108
|
const calculatePosition = import_react.default.useCallback((remeasure = false) => {
|
|
108
109
|
const pop = popRef.current;
|
|
109
110
|
if (!triggerRef.current || !pop) return;
|
|
111
|
+
if (remeasure) frozenMaxRef.current = void 0;
|
|
110
112
|
if (remeasure || !sizeRef.current) {
|
|
111
113
|
sizeRef.current = {
|
|
112
114
|
w: pop.offsetWidth,
|
|
@@ -128,12 +130,16 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
128
130
|
};
|
|
129
131
|
const first = !placedRef.current;
|
|
130
132
|
if (first) pop.style.transition = "none";
|
|
131
|
-
const
|
|
133
|
+
const frozen = frozenMaxRef.current;
|
|
134
|
+
const effectiveH = frozen == null ? popH : Math.min(popH, frozen);
|
|
135
|
+
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
132
136
|
triggerRect,
|
|
133
137
|
popW,
|
|
134
|
-
|
|
138
|
+
effectiveH,
|
|
135
139
|
clip
|
|
136
140
|
);
|
|
141
|
+
if (frozenMaxRef.current === void 0) frozenMaxRef.current = suggested;
|
|
142
|
+
const maxHeight = frozenMaxRef.current;
|
|
137
143
|
pop.style.top = `${top + window.scrollY}px`;
|
|
138
144
|
pop.style.left = `${left + window.scrollX}px`;
|
|
139
145
|
pop.style.maxHeight = maxHeight === null ? "" : `${maxHeight}px`;
|
|
@@ -152,6 +158,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
152
158
|
sizeRef.current = null;
|
|
153
159
|
scrollParentRef.current = null;
|
|
154
160
|
placedRef.current = false;
|
|
161
|
+
frozenMaxRef.current = void 0;
|
|
155
162
|
return;
|
|
156
163
|
}
|
|
157
164
|
if (triggerRef.current) {
|
|
@@ -67,9 +67,11 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
67
67
|
const sizeRef = React.useRef(null);
|
|
68
68
|
const scrollParentRef = React.useRef(null);
|
|
69
69
|
const placedRef = React.useRef(false);
|
|
70
|
+
const frozenMaxRef = React.useRef(void 0);
|
|
70
71
|
const calculatePosition = React.useCallback((remeasure = false) => {
|
|
71
72
|
const pop = popRef.current;
|
|
72
73
|
if (!triggerRef.current || !pop) return;
|
|
74
|
+
if (remeasure) frozenMaxRef.current = void 0;
|
|
73
75
|
if (remeasure || !sizeRef.current) {
|
|
74
76
|
sizeRef.current = {
|
|
75
77
|
w: pop.offsetWidth,
|
|
@@ -91,12 +93,16 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
91
93
|
};
|
|
92
94
|
const first = !placedRef.current;
|
|
93
95
|
if (first) pop.style.transition = "none";
|
|
94
|
-
const
|
|
96
|
+
const frozen = frozenMaxRef.current;
|
|
97
|
+
const effectiveH = frozen == null ? popH : Math.min(popH, frozen);
|
|
98
|
+
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
95
99
|
triggerRect,
|
|
96
100
|
popW,
|
|
97
|
-
|
|
101
|
+
effectiveH,
|
|
98
102
|
clip
|
|
99
103
|
);
|
|
104
|
+
if (frozenMaxRef.current === void 0) frozenMaxRef.current = suggested;
|
|
105
|
+
const maxHeight = frozenMaxRef.current;
|
|
100
106
|
pop.style.top = `${top + window.scrollY}px`;
|
|
101
107
|
pop.style.left = `${left + window.scrollX}px`;
|
|
102
108
|
pop.style.maxHeight = maxHeight === null ? "" : `${maxHeight}px`;
|
|
@@ -115,6 +121,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
115
121
|
sizeRef.current = null;
|
|
116
122
|
scrollParentRef.current = null;
|
|
117
123
|
placedRef.current = false;
|
|
124
|
+
frozenMaxRef.current = void 0;
|
|
118
125
|
return;
|
|
119
126
|
}
|
|
120
127
|
if (triggerRef.current) {
|
|
@@ -103,9 +103,11 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
103
103
|
const sizeRef = import_react.default.useRef(null);
|
|
104
104
|
const scrollParentRef = import_react.default.useRef(null);
|
|
105
105
|
const placedRef = import_react.default.useRef(false);
|
|
106
|
+
const frozenMaxRef = import_react.default.useRef(void 0);
|
|
106
107
|
const calculatePosition = import_react.default.useCallback((remeasure = false) => {
|
|
107
108
|
const pop = popRef.current;
|
|
108
109
|
if (!triggerRef.current || !pop) return;
|
|
110
|
+
if (remeasure) frozenMaxRef.current = void 0;
|
|
109
111
|
if (remeasure || !sizeRef.current) {
|
|
110
112
|
sizeRef.current = {
|
|
111
113
|
w: pop.offsetWidth,
|
|
@@ -127,12 +129,16 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
127
129
|
};
|
|
128
130
|
const first = !placedRef.current;
|
|
129
131
|
if (first) pop.style.transition = "none";
|
|
130
|
-
const
|
|
132
|
+
const frozen = frozenMaxRef.current;
|
|
133
|
+
const effectiveH = frozen == null ? popH : Math.min(popH, frozen);
|
|
134
|
+
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
131
135
|
triggerRect,
|
|
132
136
|
popW,
|
|
133
|
-
|
|
137
|
+
effectiveH,
|
|
134
138
|
clip
|
|
135
139
|
);
|
|
140
|
+
if (frozenMaxRef.current === void 0) frozenMaxRef.current = suggested;
|
|
141
|
+
const maxHeight = frozenMaxRef.current;
|
|
136
142
|
pop.style.top = `${top + window.scrollY}px`;
|
|
137
143
|
pop.style.left = `${left + window.scrollX}px`;
|
|
138
144
|
pop.style.maxHeight = maxHeight === null ? "" : `${maxHeight}px`;
|
|
@@ -151,6 +157,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
151
157
|
sizeRef.current = null;
|
|
152
158
|
scrollParentRef.current = null;
|
|
153
159
|
placedRef.current = false;
|
|
160
|
+
frozenMaxRef.current = void 0;
|
|
154
161
|
return;
|
|
155
162
|
}
|
|
156
163
|
if (triggerRef.current) {
|
|
@@ -67,9 +67,11 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
67
67
|
const sizeRef = React.useRef(null);
|
|
68
68
|
const scrollParentRef = React.useRef(null);
|
|
69
69
|
const placedRef = React.useRef(false);
|
|
70
|
+
const frozenMaxRef = React.useRef(void 0);
|
|
70
71
|
const calculatePosition = React.useCallback((remeasure = false) => {
|
|
71
72
|
const pop = popRef.current;
|
|
72
73
|
if (!triggerRef.current || !pop) return;
|
|
74
|
+
if (remeasure) frozenMaxRef.current = void 0;
|
|
73
75
|
if (remeasure || !sizeRef.current) {
|
|
74
76
|
sizeRef.current = {
|
|
75
77
|
w: pop.offsetWidth,
|
|
@@ -91,12 +93,16 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
91
93
|
};
|
|
92
94
|
const first = !placedRef.current;
|
|
93
95
|
if (first) pop.style.transition = "none";
|
|
94
|
-
const
|
|
96
|
+
const frozen = frozenMaxRef.current;
|
|
97
|
+
const effectiveH = frozen == null ? popH : Math.min(popH, frozen);
|
|
98
|
+
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
95
99
|
triggerRect,
|
|
96
100
|
popW,
|
|
97
|
-
|
|
101
|
+
effectiveH,
|
|
98
102
|
clip
|
|
99
103
|
);
|
|
104
|
+
if (frozenMaxRef.current === void 0) frozenMaxRef.current = suggested;
|
|
105
|
+
const maxHeight = frozenMaxRef.current;
|
|
100
106
|
pop.style.top = `${top + window.scrollY}px`;
|
|
101
107
|
pop.style.left = `${left + window.scrollX}px`;
|
|
102
108
|
pop.style.maxHeight = maxHeight === null ? "" : `${maxHeight}px`;
|
|
@@ -115,6 +121,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
115
121
|
sizeRef.current = null;
|
|
116
122
|
scrollParentRef.current = null;
|
|
117
123
|
placedRef.current = false;
|
|
124
|
+
frozenMaxRef.current = void 0;
|
|
118
125
|
return;
|
|
119
126
|
}
|
|
120
127
|
if (triggerRef.current) {
|
|
@@ -3289,9 +3289,11 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
3289
3289
|
const sizeRef = import_react10.default.useRef(null);
|
|
3290
3290
|
const scrollParentRef = import_react10.default.useRef(null);
|
|
3291
3291
|
const placedRef = import_react10.default.useRef(false);
|
|
3292
|
+
const frozenMaxRef = import_react10.default.useRef(void 0);
|
|
3292
3293
|
const calculatePosition = import_react10.default.useCallback((remeasure = false) => {
|
|
3293
3294
|
const pop = popRef.current;
|
|
3294
3295
|
if (!triggerRef.current || !pop) return;
|
|
3296
|
+
if (remeasure) frozenMaxRef.current = void 0;
|
|
3295
3297
|
if (remeasure || !sizeRef.current) {
|
|
3296
3298
|
sizeRef.current = {
|
|
3297
3299
|
w: pop.offsetWidth,
|
|
@@ -3313,12 +3315,16 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
3313
3315
|
};
|
|
3314
3316
|
const first = !placedRef.current;
|
|
3315
3317
|
if (first) pop.style.transition = "none";
|
|
3316
|
-
const
|
|
3318
|
+
const frozen = frozenMaxRef.current;
|
|
3319
|
+
const effectiveH = frozen == null ? popH : Math.min(popH, frozen);
|
|
3320
|
+
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
3317
3321
|
triggerRect,
|
|
3318
3322
|
popW,
|
|
3319
|
-
|
|
3323
|
+
effectiveH,
|
|
3320
3324
|
clip
|
|
3321
3325
|
);
|
|
3326
|
+
if (frozenMaxRef.current === void 0) frozenMaxRef.current = suggested;
|
|
3327
|
+
const maxHeight = frozenMaxRef.current;
|
|
3322
3328
|
pop.style.top = `${top + window.scrollY}px`;
|
|
3323
3329
|
pop.style.left = `${left + window.scrollX}px`;
|
|
3324
3330
|
pop.style.maxHeight = maxHeight === null ? "" : `${maxHeight}px`;
|
|
@@ -3337,6 +3343,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
3337
3343
|
sizeRef.current = null;
|
|
3338
3344
|
scrollParentRef.current = null;
|
|
3339
3345
|
placedRef.current = false;
|
|
3346
|
+
frozenMaxRef.current = void 0;
|
|
3340
3347
|
return;
|
|
3341
3348
|
}
|
|
3342
3349
|
if (triggerRef.current) {
|
package/dist/components/index.js
CHANGED
|
@@ -3187,9 +3187,11 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
3187
3187
|
const sizeRef = React10.useRef(null);
|
|
3188
3188
|
const scrollParentRef = React10.useRef(null);
|
|
3189
3189
|
const placedRef = React10.useRef(false);
|
|
3190
|
+
const frozenMaxRef = React10.useRef(void 0);
|
|
3190
3191
|
const calculatePosition = React10.useCallback((remeasure = false) => {
|
|
3191
3192
|
const pop = popRef.current;
|
|
3192
3193
|
if (!triggerRef.current || !pop) return;
|
|
3194
|
+
if (remeasure) frozenMaxRef.current = void 0;
|
|
3193
3195
|
if (remeasure || !sizeRef.current) {
|
|
3194
3196
|
sizeRef.current = {
|
|
3195
3197
|
w: pop.offsetWidth,
|
|
@@ -3211,12 +3213,16 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
3211
3213
|
};
|
|
3212
3214
|
const first = !placedRef.current;
|
|
3213
3215
|
if (first) pop.style.transition = "none";
|
|
3214
|
-
const
|
|
3216
|
+
const frozen = frozenMaxRef.current;
|
|
3217
|
+
const effectiveH = frozen == null ? popH : Math.min(popH, frozen);
|
|
3218
|
+
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
3215
3219
|
triggerRect,
|
|
3216
3220
|
popW,
|
|
3217
|
-
|
|
3221
|
+
effectiveH,
|
|
3218
3222
|
clip
|
|
3219
3223
|
);
|
|
3224
|
+
if (frozenMaxRef.current === void 0) frozenMaxRef.current = suggested;
|
|
3225
|
+
const maxHeight = frozenMaxRef.current;
|
|
3220
3226
|
pop.style.top = `${top + window.scrollY}px`;
|
|
3221
3227
|
pop.style.left = `${left + window.scrollX}px`;
|
|
3222
3228
|
pop.style.maxHeight = maxHeight === null ? "" : `${maxHeight}px`;
|
|
@@ -3235,6 +3241,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
3235
3241
|
sizeRef.current = null;
|
|
3236
3242
|
scrollParentRef.current = null;
|
|
3237
3243
|
placedRef.current = false;
|
|
3244
|
+
frozenMaxRef.current = void 0;
|
|
3238
3245
|
return;
|
|
3239
3246
|
}
|
|
3240
3247
|
if (triggerRef.current) {
|
package/dist/index.cjs
CHANGED
|
@@ -7701,9 +7701,11 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
7701
7701
|
const sizeRef = import_react10.default.useRef(null);
|
|
7702
7702
|
const scrollParentRef = import_react10.default.useRef(null);
|
|
7703
7703
|
const placedRef = import_react10.default.useRef(false);
|
|
7704
|
+
const frozenMaxRef = import_react10.default.useRef(void 0);
|
|
7704
7705
|
const calculatePosition = import_react10.default.useCallback((remeasure = false) => {
|
|
7705
7706
|
const pop = popRef.current;
|
|
7706
7707
|
if (!triggerRef.current || !pop) return;
|
|
7708
|
+
if (remeasure) frozenMaxRef.current = void 0;
|
|
7707
7709
|
if (remeasure || !sizeRef.current) {
|
|
7708
7710
|
sizeRef.current = {
|
|
7709
7711
|
w: pop.offsetWidth,
|
|
@@ -7725,12 +7727,16 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
7725
7727
|
};
|
|
7726
7728
|
const first = !placedRef.current;
|
|
7727
7729
|
if (first) pop.style.transition = "none";
|
|
7728
|
-
const
|
|
7730
|
+
const frozen = frozenMaxRef.current;
|
|
7731
|
+
const effectiveH = frozen == null ? popH : Math.min(popH, frozen);
|
|
7732
|
+
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
7729
7733
|
triggerRect,
|
|
7730
7734
|
popW,
|
|
7731
|
-
|
|
7735
|
+
effectiveH,
|
|
7732
7736
|
clip
|
|
7733
7737
|
);
|
|
7738
|
+
if (frozenMaxRef.current === void 0) frozenMaxRef.current = suggested;
|
|
7739
|
+
const maxHeight = frozenMaxRef.current;
|
|
7734
7740
|
pop.style.top = `${top + window.scrollY}px`;
|
|
7735
7741
|
pop.style.left = `${left + window.scrollX}px`;
|
|
7736
7742
|
pop.style.maxHeight = maxHeight === null ? "" : `${maxHeight}px`;
|
|
@@ -7749,6 +7755,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
7749
7755
|
sizeRef.current = null;
|
|
7750
7756
|
scrollParentRef.current = null;
|
|
7751
7757
|
placedRef.current = false;
|
|
7758
|
+
frozenMaxRef.current = void 0;
|
|
7752
7759
|
return;
|
|
7753
7760
|
}
|
|
7754
7761
|
if (triggerRef.current) {
|
package/dist/index.js
CHANGED
|
@@ -7290,9 +7290,11 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
7290
7290
|
const sizeRef = React10.useRef(null);
|
|
7291
7291
|
const scrollParentRef = React10.useRef(null);
|
|
7292
7292
|
const placedRef = React10.useRef(false);
|
|
7293
|
+
const frozenMaxRef = React10.useRef(void 0);
|
|
7293
7294
|
const calculatePosition = React10.useCallback((remeasure = false) => {
|
|
7294
7295
|
const pop = popRef.current;
|
|
7295
7296
|
if (!triggerRef.current || !pop) return;
|
|
7297
|
+
if (remeasure) frozenMaxRef.current = void 0;
|
|
7296
7298
|
if (remeasure || !sizeRef.current) {
|
|
7297
7299
|
sizeRef.current = {
|
|
7298
7300
|
w: pop.offsetWidth,
|
|
@@ -7314,12 +7316,16 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
7314
7316
|
};
|
|
7315
7317
|
const first = !placedRef.current;
|
|
7316
7318
|
if (first) pop.style.transition = "none";
|
|
7317
|
-
const
|
|
7319
|
+
const frozen = frozenMaxRef.current;
|
|
7320
|
+
const effectiveH = frozen == null ? popH : Math.min(popH, frozen);
|
|
7321
|
+
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
7318
7322
|
triggerRect,
|
|
7319
7323
|
popW,
|
|
7320
|
-
|
|
7324
|
+
effectiveH,
|
|
7321
7325
|
clip
|
|
7322
7326
|
);
|
|
7327
|
+
if (frozenMaxRef.current === void 0) frozenMaxRef.current = suggested;
|
|
7328
|
+
const maxHeight = frozenMaxRef.current;
|
|
7323
7329
|
pop.style.top = `${top + window.scrollY}px`;
|
|
7324
7330
|
pop.style.left = `${left + window.scrollX}px`;
|
|
7325
7331
|
pop.style.maxHeight = maxHeight === null ? "" : `${maxHeight}px`;
|
|
@@ -7338,6 +7344,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
7338
7344
|
sizeRef.current = null;
|
|
7339
7345
|
scrollParentRef.current = null;
|
|
7340
7346
|
placedRef.current = false;
|
|
7347
|
+
frozenMaxRef.current = void 0;
|
|
7341
7348
|
return;
|
|
7342
7349
|
}
|
|
7343
7350
|
if (triggerRef.current) {
|