@x-plat/design-system 0.14.18 → 0.14.19
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 +10 -1
- package/dist/components/Dropdown/index.js +10 -1
- package/dist/components/PopOver/index.cjs +10 -1
- package/dist/components/PopOver/index.js +10 -1
- package/dist/components/Select/index.cjs +10 -1
- package/dist/components/Select/index.js +10 -1
- package/dist/components/TimePicker/index.cjs +10 -1
- package/dist/components/TimePicker/index.js +10 -1
- package/dist/components/index.cjs +10 -1
- package/dist/components/index.js +10 -1
- package/dist/index.cjs +10 -1
- package/dist/index.js +10 -1
- package/package.json +1 -1
|
@@ -104,10 +104,16 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
104
104
|
const scrollParentRef = import_react.default.useRef(null);
|
|
105
105
|
const placedRef = import_react.default.useRef(false);
|
|
106
106
|
const frozenMaxRef = import_react.default.useRef(void 0);
|
|
107
|
+
const cssCapRef = 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;
|
|
110
111
|
if (remeasure) frozenMaxRef.current = void 0;
|
|
112
|
+
if (cssCapRef.current === void 0) {
|
|
113
|
+
pop.style.maxHeight = "";
|
|
114
|
+
const raw = getComputedStyle(pop).maxHeight;
|
|
115
|
+
cssCapRef.current = raw === "none" ? null : Number.parseFloat(raw) || null;
|
|
116
|
+
}
|
|
111
117
|
if (remeasure || !sizeRef.current) {
|
|
112
118
|
sizeRef.current = {
|
|
113
119
|
w: pop.offsetWidth,
|
|
@@ -129,8 +135,10 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
129
135
|
};
|
|
130
136
|
const first = !placedRef.current;
|
|
131
137
|
if (first) pop.style.transition = "none";
|
|
138
|
+
const cap = cssCapRef.current;
|
|
139
|
+
const desiredH = cap == null ? popH : Math.min(popH, cap);
|
|
132
140
|
const frozen = frozenMaxRef.current;
|
|
133
|
-
const effectiveH = frozen == null ?
|
|
141
|
+
const effectiveH = frozen == null ? desiredH : Math.min(desiredH, frozen);
|
|
134
142
|
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
135
143
|
triggerRect,
|
|
136
144
|
popW,
|
|
@@ -158,6 +166,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
158
166
|
scrollParentRef.current = null;
|
|
159
167
|
placedRef.current = false;
|
|
160
168
|
frozenMaxRef.current = void 0;
|
|
169
|
+
cssCapRef.current = void 0;
|
|
161
170
|
return;
|
|
162
171
|
}
|
|
163
172
|
if (triggerRef.current) {
|
|
@@ -68,10 +68,16 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
68
68
|
const scrollParentRef = React.useRef(null);
|
|
69
69
|
const placedRef = React.useRef(false);
|
|
70
70
|
const frozenMaxRef = React.useRef(void 0);
|
|
71
|
+
const cssCapRef = React.useRef(void 0);
|
|
71
72
|
const calculatePosition = React.useCallback((remeasure = false) => {
|
|
72
73
|
const pop = popRef.current;
|
|
73
74
|
if (!triggerRef.current || !pop) return;
|
|
74
75
|
if (remeasure) frozenMaxRef.current = void 0;
|
|
76
|
+
if (cssCapRef.current === void 0) {
|
|
77
|
+
pop.style.maxHeight = "";
|
|
78
|
+
const raw = getComputedStyle(pop).maxHeight;
|
|
79
|
+
cssCapRef.current = raw === "none" ? null : Number.parseFloat(raw) || null;
|
|
80
|
+
}
|
|
75
81
|
if (remeasure || !sizeRef.current) {
|
|
76
82
|
sizeRef.current = {
|
|
77
83
|
w: pop.offsetWidth,
|
|
@@ -93,8 +99,10 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
93
99
|
};
|
|
94
100
|
const first = !placedRef.current;
|
|
95
101
|
if (first) pop.style.transition = "none";
|
|
102
|
+
const cap = cssCapRef.current;
|
|
103
|
+
const desiredH = cap == null ? popH : Math.min(popH, cap);
|
|
96
104
|
const frozen = frozenMaxRef.current;
|
|
97
|
-
const effectiveH = frozen == null ?
|
|
105
|
+
const effectiveH = frozen == null ? desiredH : Math.min(desiredH, frozen);
|
|
98
106
|
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
99
107
|
triggerRect,
|
|
100
108
|
popW,
|
|
@@ -122,6 +130,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
122
130
|
scrollParentRef.current = null;
|
|
123
131
|
placedRef.current = false;
|
|
124
132
|
frozenMaxRef.current = void 0;
|
|
133
|
+
cssCapRef.current = void 0;
|
|
125
134
|
return;
|
|
126
135
|
}
|
|
127
136
|
if (triggerRef.current) {
|
|
@@ -104,10 +104,16 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
104
104
|
const scrollParentRef = import_react.default.useRef(null);
|
|
105
105
|
const placedRef = import_react.default.useRef(false);
|
|
106
106
|
const frozenMaxRef = import_react.default.useRef(void 0);
|
|
107
|
+
const cssCapRef = 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;
|
|
110
111
|
if (remeasure) frozenMaxRef.current = void 0;
|
|
112
|
+
if (cssCapRef.current === void 0) {
|
|
113
|
+
pop.style.maxHeight = "";
|
|
114
|
+
const raw = getComputedStyle(pop).maxHeight;
|
|
115
|
+
cssCapRef.current = raw === "none" ? null : Number.parseFloat(raw) || null;
|
|
116
|
+
}
|
|
111
117
|
if (remeasure || !sizeRef.current) {
|
|
112
118
|
sizeRef.current = {
|
|
113
119
|
w: pop.offsetWidth,
|
|
@@ -129,8 +135,10 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
129
135
|
};
|
|
130
136
|
const first = !placedRef.current;
|
|
131
137
|
if (first) pop.style.transition = "none";
|
|
138
|
+
const cap = cssCapRef.current;
|
|
139
|
+
const desiredH = cap == null ? popH : Math.min(popH, cap);
|
|
132
140
|
const frozen = frozenMaxRef.current;
|
|
133
|
-
const effectiveH = frozen == null ?
|
|
141
|
+
const effectiveH = frozen == null ? desiredH : Math.min(desiredH, frozen);
|
|
134
142
|
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
135
143
|
triggerRect,
|
|
136
144
|
popW,
|
|
@@ -158,6 +166,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
158
166
|
scrollParentRef.current = null;
|
|
159
167
|
placedRef.current = false;
|
|
160
168
|
frozenMaxRef.current = void 0;
|
|
169
|
+
cssCapRef.current = void 0;
|
|
161
170
|
return;
|
|
162
171
|
}
|
|
163
172
|
if (triggerRef.current) {
|
|
@@ -68,10 +68,16 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
68
68
|
const scrollParentRef = React.useRef(null);
|
|
69
69
|
const placedRef = React.useRef(false);
|
|
70
70
|
const frozenMaxRef = React.useRef(void 0);
|
|
71
|
+
const cssCapRef = React.useRef(void 0);
|
|
71
72
|
const calculatePosition = React.useCallback((remeasure = false) => {
|
|
72
73
|
const pop = popRef.current;
|
|
73
74
|
if (!triggerRef.current || !pop) return;
|
|
74
75
|
if (remeasure) frozenMaxRef.current = void 0;
|
|
76
|
+
if (cssCapRef.current === void 0) {
|
|
77
|
+
pop.style.maxHeight = "";
|
|
78
|
+
const raw = getComputedStyle(pop).maxHeight;
|
|
79
|
+
cssCapRef.current = raw === "none" ? null : Number.parseFloat(raw) || null;
|
|
80
|
+
}
|
|
75
81
|
if (remeasure || !sizeRef.current) {
|
|
76
82
|
sizeRef.current = {
|
|
77
83
|
w: pop.offsetWidth,
|
|
@@ -93,8 +99,10 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
93
99
|
};
|
|
94
100
|
const first = !placedRef.current;
|
|
95
101
|
if (first) pop.style.transition = "none";
|
|
102
|
+
const cap = cssCapRef.current;
|
|
103
|
+
const desiredH = cap == null ? popH : Math.min(popH, cap);
|
|
96
104
|
const frozen = frozenMaxRef.current;
|
|
97
|
-
const effectiveH = frozen == null ?
|
|
105
|
+
const effectiveH = frozen == null ? desiredH : Math.min(desiredH, frozen);
|
|
98
106
|
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
99
107
|
triggerRect,
|
|
100
108
|
popW,
|
|
@@ -122,6 +130,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
122
130
|
scrollParentRef.current = null;
|
|
123
131
|
placedRef.current = false;
|
|
124
132
|
frozenMaxRef.current = void 0;
|
|
133
|
+
cssCapRef.current = void 0;
|
|
125
134
|
return;
|
|
126
135
|
}
|
|
127
136
|
if (triggerRef.current) {
|
|
@@ -105,10 +105,16 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
105
105
|
const scrollParentRef = import_react.default.useRef(null);
|
|
106
106
|
const placedRef = import_react.default.useRef(false);
|
|
107
107
|
const frozenMaxRef = import_react.default.useRef(void 0);
|
|
108
|
+
const cssCapRef = import_react.default.useRef(void 0);
|
|
108
109
|
const calculatePosition = import_react.default.useCallback((remeasure = false) => {
|
|
109
110
|
const pop = popRef.current;
|
|
110
111
|
if (!triggerRef.current || !pop) return;
|
|
111
112
|
if (remeasure) frozenMaxRef.current = void 0;
|
|
113
|
+
if (cssCapRef.current === void 0) {
|
|
114
|
+
pop.style.maxHeight = "";
|
|
115
|
+
const raw = getComputedStyle(pop).maxHeight;
|
|
116
|
+
cssCapRef.current = raw === "none" ? null : Number.parseFloat(raw) || null;
|
|
117
|
+
}
|
|
112
118
|
if (remeasure || !sizeRef.current) {
|
|
113
119
|
sizeRef.current = {
|
|
114
120
|
w: pop.offsetWidth,
|
|
@@ -130,8 +136,10 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
130
136
|
};
|
|
131
137
|
const first = !placedRef.current;
|
|
132
138
|
if (first) pop.style.transition = "none";
|
|
139
|
+
const cap = cssCapRef.current;
|
|
140
|
+
const desiredH = cap == null ? popH : Math.min(popH, cap);
|
|
133
141
|
const frozen = frozenMaxRef.current;
|
|
134
|
-
const effectiveH = frozen == null ?
|
|
142
|
+
const effectiveH = frozen == null ? desiredH : Math.min(desiredH, frozen);
|
|
135
143
|
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
136
144
|
triggerRect,
|
|
137
145
|
popW,
|
|
@@ -159,6 +167,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
159
167
|
scrollParentRef.current = null;
|
|
160
168
|
placedRef.current = false;
|
|
161
169
|
frozenMaxRef.current = void 0;
|
|
170
|
+
cssCapRef.current = void 0;
|
|
162
171
|
return;
|
|
163
172
|
}
|
|
164
173
|
if (triggerRef.current) {
|
|
@@ -68,10 +68,16 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
68
68
|
const scrollParentRef = React.useRef(null);
|
|
69
69
|
const placedRef = React.useRef(false);
|
|
70
70
|
const frozenMaxRef = React.useRef(void 0);
|
|
71
|
+
const cssCapRef = React.useRef(void 0);
|
|
71
72
|
const calculatePosition = React.useCallback((remeasure = false) => {
|
|
72
73
|
const pop = popRef.current;
|
|
73
74
|
if (!triggerRef.current || !pop) return;
|
|
74
75
|
if (remeasure) frozenMaxRef.current = void 0;
|
|
76
|
+
if (cssCapRef.current === void 0) {
|
|
77
|
+
pop.style.maxHeight = "";
|
|
78
|
+
const raw = getComputedStyle(pop).maxHeight;
|
|
79
|
+
cssCapRef.current = raw === "none" ? null : Number.parseFloat(raw) || null;
|
|
80
|
+
}
|
|
75
81
|
if (remeasure || !sizeRef.current) {
|
|
76
82
|
sizeRef.current = {
|
|
77
83
|
w: pop.offsetWidth,
|
|
@@ -93,8 +99,10 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
93
99
|
};
|
|
94
100
|
const first = !placedRef.current;
|
|
95
101
|
if (first) pop.style.transition = "none";
|
|
102
|
+
const cap = cssCapRef.current;
|
|
103
|
+
const desiredH = cap == null ? popH : Math.min(popH, cap);
|
|
96
104
|
const frozen = frozenMaxRef.current;
|
|
97
|
-
const effectiveH = frozen == null ?
|
|
105
|
+
const effectiveH = frozen == null ? desiredH : Math.min(desiredH, frozen);
|
|
98
106
|
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
99
107
|
triggerRect,
|
|
100
108
|
popW,
|
|
@@ -122,6 +130,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
122
130
|
scrollParentRef.current = null;
|
|
123
131
|
placedRef.current = false;
|
|
124
132
|
frozenMaxRef.current = void 0;
|
|
133
|
+
cssCapRef.current = void 0;
|
|
125
134
|
return;
|
|
126
135
|
}
|
|
127
136
|
if (triggerRef.current) {
|
|
@@ -104,10 +104,16 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
104
104
|
const scrollParentRef = import_react.default.useRef(null);
|
|
105
105
|
const placedRef = import_react.default.useRef(false);
|
|
106
106
|
const frozenMaxRef = import_react.default.useRef(void 0);
|
|
107
|
+
const cssCapRef = 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;
|
|
110
111
|
if (remeasure) frozenMaxRef.current = void 0;
|
|
112
|
+
if (cssCapRef.current === void 0) {
|
|
113
|
+
pop.style.maxHeight = "";
|
|
114
|
+
const raw = getComputedStyle(pop).maxHeight;
|
|
115
|
+
cssCapRef.current = raw === "none" ? null : Number.parseFloat(raw) || null;
|
|
116
|
+
}
|
|
111
117
|
if (remeasure || !sizeRef.current) {
|
|
112
118
|
sizeRef.current = {
|
|
113
119
|
w: pop.offsetWidth,
|
|
@@ -129,8 +135,10 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
129
135
|
};
|
|
130
136
|
const first = !placedRef.current;
|
|
131
137
|
if (first) pop.style.transition = "none";
|
|
138
|
+
const cap = cssCapRef.current;
|
|
139
|
+
const desiredH = cap == null ? popH : Math.min(popH, cap);
|
|
132
140
|
const frozen = frozenMaxRef.current;
|
|
133
|
-
const effectiveH = frozen == null ?
|
|
141
|
+
const effectiveH = frozen == null ? desiredH : Math.min(desiredH, frozen);
|
|
134
142
|
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
135
143
|
triggerRect,
|
|
136
144
|
popW,
|
|
@@ -158,6 +166,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
158
166
|
scrollParentRef.current = null;
|
|
159
167
|
placedRef.current = false;
|
|
160
168
|
frozenMaxRef.current = void 0;
|
|
169
|
+
cssCapRef.current = void 0;
|
|
161
170
|
return;
|
|
162
171
|
}
|
|
163
172
|
if (triggerRef.current) {
|
|
@@ -68,10 +68,16 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
68
68
|
const scrollParentRef = React.useRef(null);
|
|
69
69
|
const placedRef = React.useRef(false);
|
|
70
70
|
const frozenMaxRef = React.useRef(void 0);
|
|
71
|
+
const cssCapRef = React.useRef(void 0);
|
|
71
72
|
const calculatePosition = React.useCallback((remeasure = false) => {
|
|
72
73
|
const pop = popRef.current;
|
|
73
74
|
if (!triggerRef.current || !pop) return;
|
|
74
75
|
if (remeasure) frozenMaxRef.current = void 0;
|
|
76
|
+
if (cssCapRef.current === void 0) {
|
|
77
|
+
pop.style.maxHeight = "";
|
|
78
|
+
const raw = getComputedStyle(pop).maxHeight;
|
|
79
|
+
cssCapRef.current = raw === "none" ? null : Number.parseFloat(raw) || null;
|
|
80
|
+
}
|
|
75
81
|
if (remeasure || !sizeRef.current) {
|
|
76
82
|
sizeRef.current = {
|
|
77
83
|
w: pop.offsetWidth,
|
|
@@ -93,8 +99,10 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
93
99
|
};
|
|
94
100
|
const first = !placedRef.current;
|
|
95
101
|
if (first) pop.style.transition = "none";
|
|
102
|
+
const cap = cssCapRef.current;
|
|
103
|
+
const desiredH = cap == null ? popH : Math.min(popH, cap);
|
|
96
104
|
const frozen = frozenMaxRef.current;
|
|
97
|
-
const effectiveH = frozen == null ?
|
|
105
|
+
const effectiveH = frozen == null ? desiredH : Math.min(desiredH, frozen);
|
|
98
106
|
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
99
107
|
triggerRect,
|
|
100
108
|
popW,
|
|
@@ -122,6 +130,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
122
130
|
scrollParentRef.current = null;
|
|
123
131
|
placedRef.current = false;
|
|
124
132
|
frozenMaxRef.current = void 0;
|
|
133
|
+
cssCapRef.current = void 0;
|
|
125
134
|
return;
|
|
126
135
|
}
|
|
127
136
|
if (triggerRef.current) {
|
|
@@ -3290,10 +3290,16 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
3290
3290
|
const scrollParentRef = import_react10.default.useRef(null);
|
|
3291
3291
|
const placedRef = import_react10.default.useRef(false);
|
|
3292
3292
|
const frozenMaxRef = import_react10.default.useRef(void 0);
|
|
3293
|
+
const cssCapRef = import_react10.default.useRef(void 0);
|
|
3293
3294
|
const calculatePosition = import_react10.default.useCallback((remeasure = false) => {
|
|
3294
3295
|
const pop = popRef.current;
|
|
3295
3296
|
if (!triggerRef.current || !pop) return;
|
|
3296
3297
|
if (remeasure) frozenMaxRef.current = void 0;
|
|
3298
|
+
if (cssCapRef.current === void 0) {
|
|
3299
|
+
pop.style.maxHeight = "";
|
|
3300
|
+
const raw = getComputedStyle(pop).maxHeight;
|
|
3301
|
+
cssCapRef.current = raw === "none" ? null : Number.parseFloat(raw) || null;
|
|
3302
|
+
}
|
|
3297
3303
|
if (remeasure || !sizeRef.current) {
|
|
3298
3304
|
sizeRef.current = {
|
|
3299
3305
|
w: pop.offsetWidth,
|
|
@@ -3315,8 +3321,10 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
3315
3321
|
};
|
|
3316
3322
|
const first = !placedRef.current;
|
|
3317
3323
|
if (first) pop.style.transition = "none";
|
|
3324
|
+
const cap = cssCapRef.current;
|
|
3325
|
+
const desiredH = cap == null ? popH : Math.min(popH, cap);
|
|
3318
3326
|
const frozen = frozenMaxRef.current;
|
|
3319
|
-
const effectiveH = frozen == null ?
|
|
3327
|
+
const effectiveH = frozen == null ? desiredH : Math.min(desiredH, frozen);
|
|
3320
3328
|
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
3321
3329
|
triggerRect,
|
|
3322
3330
|
popW,
|
|
@@ -3344,6 +3352,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
3344
3352
|
scrollParentRef.current = null;
|
|
3345
3353
|
placedRef.current = false;
|
|
3346
3354
|
frozenMaxRef.current = void 0;
|
|
3355
|
+
cssCapRef.current = void 0;
|
|
3347
3356
|
return;
|
|
3348
3357
|
}
|
|
3349
3358
|
if (triggerRef.current) {
|
package/dist/components/index.js
CHANGED
|
@@ -3188,10 +3188,16 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
3188
3188
|
const scrollParentRef = React10.useRef(null);
|
|
3189
3189
|
const placedRef = React10.useRef(false);
|
|
3190
3190
|
const frozenMaxRef = React10.useRef(void 0);
|
|
3191
|
+
const cssCapRef = React10.useRef(void 0);
|
|
3191
3192
|
const calculatePosition = React10.useCallback((remeasure = false) => {
|
|
3192
3193
|
const pop = popRef.current;
|
|
3193
3194
|
if (!triggerRef.current || !pop) return;
|
|
3194
3195
|
if (remeasure) frozenMaxRef.current = void 0;
|
|
3196
|
+
if (cssCapRef.current === void 0) {
|
|
3197
|
+
pop.style.maxHeight = "";
|
|
3198
|
+
const raw = getComputedStyle(pop).maxHeight;
|
|
3199
|
+
cssCapRef.current = raw === "none" ? null : Number.parseFloat(raw) || null;
|
|
3200
|
+
}
|
|
3195
3201
|
if (remeasure || !sizeRef.current) {
|
|
3196
3202
|
sizeRef.current = {
|
|
3197
3203
|
w: pop.offsetWidth,
|
|
@@ -3213,8 +3219,10 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
3213
3219
|
};
|
|
3214
3220
|
const first = !placedRef.current;
|
|
3215
3221
|
if (first) pop.style.transition = "none";
|
|
3222
|
+
const cap = cssCapRef.current;
|
|
3223
|
+
const desiredH = cap == null ? popH : Math.min(popH, cap);
|
|
3216
3224
|
const frozen = frozenMaxRef.current;
|
|
3217
|
-
const effectiveH = frozen == null ?
|
|
3225
|
+
const effectiveH = frozen == null ? desiredH : Math.min(desiredH, frozen);
|
|
3218
3226
|
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
3219
3227
|
triggerRect,
|
|
3220
3228
|
popW,
|
|
@@ -3242,6 +3250,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
3242
3250
|
scrollParentRef.current = null;
|
|
3243
3251
|
placedRef.current = false;
|
|
3244
3252
|
frozenMaxRef.current = void 0;
|
|
3253
|
+
cssCapRef.current = void 0;
|
|
3245
3254
|
return;
|
|
3246
3255
|
}
|
|
3247
3256
|
if (triggerRef.current) {
|
package/dist/index.cjs
CHANGED
|
@@ -7702,10 +7702,16 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
7702
7702
|
const scrollParentRef = import_react10.default.useRef(null);
|
|
7703
7703
|
const placedRef = import_react10.default.useRef(false);
|
|
7704
7704
|
const frozenMaxRef = import_react10.default.useRef(void 0);
|
|
7705
|
+
const cssCapRef = import_react10.default.useRef(void 0);
|
|
7705
7706
|
const calculatePosition = import_react10.default.useCallback((remeasure = false) => {
|
|
7706
7707
|
const pop = popRef.current;
|
|
7707
7708
|
if (!triggerRef.current || !pop) return;
|
|
7708
7709
|
if (remeasure) frozenMaxRef.current = void 0;
|
|
7710
|
+
if (cssCapRef.current === void 0) {
|
|
7711
|
+
pop.style.maxHeight = "";
|
|
7712
|
+
const raw = getComputedStyle(pop).maxHeight;
|
|
7713
|
+
cssCapRef.current = raw === "none" ? null : Number.parseFloat(raw) || null;
|
|
7714
|
+
}
|
|
7709
7715
|
if (remeasure || !sizeRef.current) {
|
|
7710
7716
|
sizeRef.current = {
|
|
7711
7717
|
w: pop.offsetWidth,
|
|
@@ -7727,8 +7733,10 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
7727
7733
|
};
|
|
7728
7734
|
const first = !placedRef.current;
|
|
7729
7735
|
if (first) pop.style.transition = "none";
|
|
7736
|
+
const cap = cssCapRef.current;
|
|
7737
|
+
const desiredH = cap == null ? popH : Math.min(popH, cap);
|
|
7730
7738
|
const frozen = frozenMaxRef.current;
|
|
7731
|
-
const effectiveH = frozen == null ?
|
|
7739
|
+
const effectiveH = frozen == null ? desiredH : Math.min(desiredH, frozen);
|
|
7732
7740
|
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
7733
7741
|
triggerRect,
|
|
7734
7742
|
popW,
|
|
@@ -7756,6 +7764,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
7756
7764
|
scrollParentRef.current = null;
|
|
7757
7765
|
placedRef.current = false;
|
|
7758
7766
|
frozenMaxRef.current = void 0;
|
|
7767
|
+
cssCapRef.current = void 0;
|
|
7759
7768
|
return;
|
|
7760
7769
|
}
|
|
7761
7770
|
if (triggerRef.current) {
|
package/dist/index.js
CHANGED
|
@@ -7291,10 +7291,16 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
7291
7291
|
const scrollParentRef = React10.useRef(null);
|
|
7292
7292
|
const placedRef = React10.useRef(false);
|
|
7293
7293
|
const frozenMaxRef = React10.useRef(void 0);
|
|
7294
|
+
const cssCapRef = React10.useRef(void 0);
|
|
7294
7295
|
const calculatePosition = React10.useCallback((remeasure = false) => {
|
|
7295
7296
|
const pop = popRef.current;
|
|
7296
7297
|
if (!triggerRef.current || !pop) return;
|
|
7297
7298
|
if (remeasure) frozenMaxRef.current = void 0;
|
|
7299
|
+
if (cssCapRef.current === void 0) {
|
|
7300
|
+
pop.style.maxHeight = "";
|
|
7301
|
+
const raw = getComputedStyle(pop).maxHeight;
|
|
7302
|
+
cssCapRef.current = raw === "none" ? null : Number.parseFloat(raw) || null;
|
|
7303
|
+
}
|
|
7298
7304
|
if (remeasure || !sizeRef.current) {
|
|
7299
7305
|
sizeRef.current = {
|
|
7300
7306
|
w: pop.offsetWidth,
|
|
@@ -7316,8 +7322,10 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
7316
7322
|
};
|
|
7317
7323
|
const first = !placedRef.current;
|
|
7318
7324
|
if (first) pop.style.transition = "none";
|
|
7325
|
+
const cap = cssCapRef.current;
|
|
7326
|
+
const desiredH = cap == null ? popH : Math.min(popH, cap);
|
|
7319
7327
|
const frozen = frozenMaxRef.current;
|
|
7320
|
-
const effectiveH = frozen == null ?
|
|
7328
|
+
const effectiveH = frozen == null ? desiredH : Math.min(desiredH, frozen);
|
|
7321
7329
|
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
7322
7330
|
triggerRect,
|
|
7323
7331
|
popW,
|
|
@@ -7345,6 +7353,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
7345
7353
|
scrollParentRef.current = null;
|
|
7346
7354
|
placedRef.current = false;
|
|
7347
7355
|
frozenMaxRef.current = void 0;
|
|
7356
|
+
cssCapRef.current = void 0;
|
|
7348
7357
|
return;
|
|
7349
7358
|
}
|
|
7350
7359
|
if (triggerRef.current) {
|