@x-plat/design-system 0.14.17 → 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 +18 -2
- package/dist/components/Dropdown/index.js +18 -2
- package/dist/components/PopOver/index.cjs +18 -2
- package/dist/components/PopOver/index.js +18 -2
- package/dist/components/Select/index.cjs +18 -2
- package/dist/components/Select/index.js +18 -2
- package/dist/components/TimePicker/index.cjs +18 -2
- package/dist/components/TimePicker/index.js +18 -2
- package/dist/components/index.cjs +18 -2
- package/dist/components/index.js +18 -2
- package/dist/index.cjs +18 -2
- package/dist/index.js +18 -2
- package/package.json +1 -1
|
@@ -103,9 +103,17 @@ 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);
|
|
107
|
+
const cssCapRef = import_react.default.useRef(void 0);
|
|
106
108
|
const calculatePosition = import_react.default.useCallback((remeasure = false) => {
|
|
107
109
|
const pop = popRef.current;
|
|
108
110
|
if (!triggerRef.current || !pop) return;
|
|
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
|
+
}
|
|
109
117
|
if (remeasure || !sizeRef.current) {
|
|
110
118
|
sizeRef.current = {
|
|
111
119
|
w: pop.offsetWidth,
|
|
@@ -127,12 +135,18 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
127
135
|
};
|
|
128
136
|
const first = !placedRef.current;
|
|
129
137
|
if (first) pop.style.transition = "none";
|
|
130
|
-
const
|
|
138
|
+
const cap = cssCapRef.current;
|
|
139
|
+
const desiredH = cap == null ? popH : Math.min(popH, cap);
|
|
140
|
+
const frozen = frozenMaxRef.current;
|
|
141
|
+
const effectiveH = frozen == null ? desiredH : Math.min(desiredH, frozen);
|
|
142
|
+
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
131
143
|
triggerRect,
|
|
132
144
|
popW,
|
|
133
|
-
|
|
145
|
+
effectiveH,
|
|
134
146
|
clip
|
|
135
147
|
);
|
|
148
|
+
if (frozenMaxRef.current === void 0) frozenMaxRef.current = suggested;
|
|
149
|
+
const maxHeight = frozenMaxRef.current;
|
|
136
150
|
pop.style.top = `${top + window.scrollY}px`;
|
|
137
151
|
pop.style.left = `${left + window.scrollX}px`;
|
|
138
152
|
pop.style.maxHeight = maxHeight === null ? "" : `${maxHeight}px`;
|
|
@@ -151,6 +165,8 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
151
165
|
sizeRef.current = null;
|
|
152
166
|
scrollParentRef.current = null;
|
|
153
167
|
placedRef.current = false;
|
|
168
|
+
frozenMaxRef.current = void 0;
|
|
169
|
+
cssCapRef.current = void 0;
|
|
154
170
|
return;
|
|
155
171
|
}
|
|
156
172
|
if (triggerRef.current) {
|
|
@@ -67,9 +67,17 @@ 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);
|
|
71
|
+
const cssCapRef = React.useRef(void 0);
|
|
70
72
|
const calculatePosition = React.useCallback((remeasure = false) => {
|
|
71
73
|
const pop = popRef.current;
|
|
72
74
|
if (!triggerRef.current || !pop) return;
|
|
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
|
+
}
|
|
73
81
|
if (remeasure || !sizeRef.current) {
|
|
74
82
|
sizeRef.current = {
|
|
75
83
|
w: pop.offsetWidth,
|
|
@@ -91,12 +99,18 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
91
99
|
};
|
|
92
100
|
const first = !placedRef.current;
|
|
93
101
|
if (first) pop.style.transition = "none";
|
|
94
|
-
const
|
|
102
|
+
const cap = cssCapRef.current;
|
|
103
|
+
const desiredH = cap == null ? popH : Math.min(popH, cap);
|
|
104
|
+
const frozen = frozenMaxRef.current;
|
|
105
|
+
const effectiveH = frozen == null ? desiredH : Math.min(desiredH, frozen);
|
|
106
|
+
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
95
107
|
triggerRect,
|
|
96
108
|
popW,
|
|
97
|
-
|
|
109
|
+
effectiveH,
|
|
98
110
|
clip
|
|
99
111
|
);
|
|
112
|
+
if (frozenMaxRef.current === void 0) frozenMaxRef.current = suggested;
|
|
113
|
+
const maxHeight = frozenMaxRef.current;
|
|
100
114
|
pop.style.top = `${top + window.scrollY}px`;
|
|
101
115
|
pop.style.left = `${left + window.scrollX}px`;
|
|
102
116
|
pop.style.maxHeight = maxHeight === null ? "" : `${maxHeight}px`;
|
|
@@ -115,6 +129,8 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
115
129
|
sizeRef.current = null;
|
|
116
130
|
scrollParentRef.current = null;
|
|
117
131
|
placedRef.current = false;
|
|
132
|
+
frozenMaxRef.current = void 0;
|
|
133
|
+
cssCapRef.current = void 0;
|
|
118
134
|
return;
|
|
119
135
|
}
|
|
120
136
|
if (triggerRef.current) {
|
|
@@ -103,9 +103,17 @@ 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);
|
|
107
|
+
const cssCapRef = import_react.default.useRef(void 0);
|
|
106
108
|
const calculatePosition = import_react.default.useCallback((remeasure = false) => {
|
|
107
109
|
const pop = popRef.current;
|
|
108
110
|
if (!triggerRef.current || !pop) return;
|
|
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
|
+
}
|
|
109
117
|
if (remeasure || !sizeRef.current) {
|
|
110
118
|
sizeRef.current = {
|
|
111
119
|
w: pop.offsetWidth,
|
|
@@ -127,12 +135,18 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
127
135
|
};
|
|
128
136
|
const first = !placedRef.current;
|
|
129
137
|
if (first) pop.style.transition = "none";
|
|
130
|
-
const
|
|
138
|
+
const cap = cssCapRef.current;
|
|
139
|
+
const desiredH = cap == null ? popH : Math.min(popH, cap);
|
|
140
|
+
const frozen = frozenMaxRef.current;
|
|
141
|
+
const effectiveH = frozen == null ? desiredH : Math.min(desiredH, frozen);
|
|
142
|
+
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
131
143
|
triggerRect,
|
|
132
144
|
popW,
|
|
133
|
-
|
|
145
|
+
effectiveH,
|
|
134
146
|
clip
|
|
135
147
|
);
|
|
148
|
+
if (frozenMaxRef.current === void 0) frozenMaxRef.current = suggested;
|
|
149
|
+
const maxHeight = frozenMaxRef.current;
|
|
136
150
|
pop.style.top = `${top + window.scrollY}px`;
|
|
137
151
|
pop.style.left = `${left + window.scrollX}px`;
|
|
138
152
|
pop.style.maxHeight = maxHeight === null ? "" : `${maxHeight}px`;
|
|
@@ -151,6 +165,8 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
151
165
|
sizeRef.current = null;
|
|
152
166
|
scrollParentRef.current = null;
|
|
153
167
|
placedRef.current = false;
|
|
168
|
+
frozenMaxRef.current = void 0;
|
|
169
|
+
cssCapRef.current = void 0;
|
|
154
170
|
return;
|
|
155
171
|
}
|
|
156
172
|
if (triggerRef.current) {
|
|
@@ -67,9 +67,17 @@ 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);
|
|
71
|
+
const cssCapRef = React.useRef(void 0);
|
|
70
72
|
const calculatePosition = React.useCallback((remeasure = false) => {
|
|
71
73
|
const pop = popRef.current;
|
|
72
74
|
if (!triggerRef.current || !pop) return;
|
|
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
|
+
}
|
|
73
81
|
if (remeasure || !sizeRef.current) {
|
|
74
82
|
sizeRef.current = {
|
|
75
83
|
w: pop.offsetWidth,
|
|
@@ -91,12 +99,18 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
91
99
|
};
|
|
92
100
|
const first = !placedRef.current;
|
|
93
101
|
if (first) pop.style.transition = "none";
|
|
94
|
-
const
|
|
102
|
+
const cap = cssCapRef.current;
|
|
103
|
+
const desiredH = cap == null ? popH : Math.min(popH, cap);
|
|
104
|
+
const frozen = frozenMaxRef.current;
|
|
105
|
+
const effectiveH = frozen == null ? desiredH : Math.min(desiredH, frozen);
|
|
106
|
+
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
95
107
|
triggerRect,
|
|
96
108
|
popW,
|
|
97
|
-
|
|
109
|
+
effectiveH,
|
|
98
110
|
clip
|
|
99
111
|
);
|
|
112
|
+
if (frozenMaxRef.current === void 0) frozenMaxRef.current = suggested;
|
|
113
|
+
const maxHeight = frozenMaxRef.current;
|
|
100
114
|
pop.style.top = `${top + window.scrollY}px`;
|
|
101
115
|
pop.style.left = `${left + window.scrollX}px`;
|
|
102
116
|
pop.style.maxHeight = maxHeight === null ? "" : `${maxHeight}px`;
|
|
@@ -115,6 +129,8 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
115
129
|
sizeRef.current = null;
|
|
116
130
|
scrollParentRef.current = null;
|
|
117
131
|
placedRef.current = false;
|
|
132
|
+
frozenMaxRef.current = void 0;
|
|
133
|
+
cssCapRef.current = void 0;
|
|
118
134
|
return;
|
|
119
135
|
}
|
|
120
136
|
if (triggerRef.current) {
|
|
@@ -104,9 +104,17 @@ 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);
|
|
108
|
+
const cssCapRef = import_react.default.useRef(void 0);
|
|
107
109
|
const calculatePosition = import_react.default.useCallback((remeasure = false) => {
|
|
108
110
|
const pop = popRef.current;
|
|
109
111
|
if (!triggerRef.current || !pop) return;
|
|
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
|
+
}
|
|
110
118
|
if (remeasure || !sizeRef.current) {
|
|
111
119
|
sizeRef.current = {
|
|
112
120
|
w: pop.offsetWidth,
|
|
@@ -128,12 +136,18 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
128
136
|
};
|
|
129
137
|
const first = !placedRef.current;
|
|
130
138
|
if (first) pop.style.transition = "none";
|
|
131
|
-
const
|
|
139
|
+
const cap = cssCapRef.current;
|
|
140
|
+
const desiredH = cap == null ? popH : Math.min(popH, cap);
|
|
141
|
+
const frozen = frozenMaxRef.current;
|
|
142
|
+
const effectiveH = frozen == null ? desiredH : Math.min(desiredH, frozen);
|
|
143
|
+
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
132
144
|
triggerRect,
|
|
133
145
|
popW,
|
|
134
|
-
|
|
146
|
+
effectiveH,
|
|
135
147
|
clip
|
|
136
148
|
);
|
|
149
|
+
if (frozenMaxRef.current === void 0) frozenMaxRef.current = suggested;
|
|
150
|
+
const maxHeight = frozenMaxRef.current;
|
|
137
151
|
pop.style.top = `${top + window.scrollY}px`;
|
|
138
152
|
pop.style.left = `${left + window.scrollX}px`;
|
|
139
153
|
pop.style.maxHeight = maxHeight === null ? "" : `${maxHeight}px`;
|
|
@@ -152,6 +166,8 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
152
166
|
sizeRef.current = null;
|
|
153
167
|
scrollParentRef.current = null;
|
|
154
168
|
placedRef.current = false;
|
|
169
|
+
frozenMaxRef.current = void 0;
|
|
170
|
+
cssCapRef.current = void 0;
|
|
155
171
|
return;
|
|
156
172
|
}
|
|
157
173
|
if (triggerRef.current) {
|
|
@@ -67,9 +67,17 @@ 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);
|
|
71
|
+
const cssCapRef = React.useRef(void 0);
|
|
70
72
|
const calculatePosition = React.useCallback((remeasure = false) => {
|
|
71
73
|
const pop = popRef.current;
|
|
72
74
|
if (!triggerRef.current || !pop) return;
|
|
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
|
+
}
|
|
73
81
|
if (remeasure || !sizeRef.current) {
|
|
74
82
|
sizeRef.current = {
|
|
75
83
|
w: pop.offsetWidth,
|
|
@@ -91,12 +99,18 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
91
99
|
};
|
|
92
100
|
const first = !placedRef.current;
|
|
93
101
|
if (first) pop.style.transition = "none";
|
|
94
|
-
const
|
|
102
|
+
const cap = cssCapRef.current;
|
|
103
|
+
const desiredH = cap == null ? popH : Math.min(popH, cap);
|
|
104
|
+
const frozen = frozenMaxRef.current;
|
|
105
|
+
const effectiveH = frozen == null ? desiredH : Math.min(desiredH, frozen);
|
|
106
|
+
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
95
107
|
triggerRect,
|
|
96
108
|
popW,
|
|
97
|
-
|
|
109
|
+
effectiveH,
|
|
98
110
|
clip
|
|
99
111
|
);
|
|
112
|
+
if (frozenMaxRef.current === void 0) frozenMaxRef.current = suggested;
|
|
113
|
+
const maxHeight = frozenMaxRef.current;
|
|
100
114
|
pop.style.top = `${top + window.scrollY}px`;
|
|
101
115
|
pop.style.left = `${left + window.scrollX}px`;
|
|
102
116
|
pop.style.maxHeight = maxHeight === null ? "" : `${maxHeight}px`;
|
|
@@ -115,6 +129,8 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
115
129
|
sizeRef.current = null;
|
|
116
130
|
scrollParentRef.current = null;
|
|
117
131
|
placedRef.current = false;
|
|
132
|
+
frozenMaxRef.current = void 0;
|
|
133
|
+
cssCapRef.current = void 0;
|
|
118
134
|
return;
|
|
119
135
|
}
|
|
120
136
|
if (triggerRef.current) {
|
|
@@ -103,9 +103,17 @@ 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);
|
|
107
|
+
const cssCapRef = import_react.default.useRef(void 0);
|
|
106
108
|
const calculatePosition = import_react.default.useCallback((remeasure = false) => {
|
|
107
109
|
const pop = popRef.current;
|
|
108
110
|
if (!triggerRef.current || !pop) return;
|
|
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
|
+
}
|
|
109
117
|
if (remeasure || !sizeRef.current) {
|
|
110
118
|
sizeRef.current = {
|
|
111
119
|
w: pop.offsetWidth,
|
|
@@ -127,12 +135,18 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
127
135
|
};
|
|
128
136
|
const first = !placedRef.current;
|
|
129
137
|
if (first) pop.style.transition = "none";
|
|
130
|
-
const
|
|
138
|
+
const cap = cssCapRef.current;
|
|
139
|
+
const desiredH = cap == null ? popH : Math.min(popH, cap);
|
|
140
|
+
const frozen = frozenMaxRef.current;
|
|
141
|
+
const effectiveH = frozen == null ? desiredH : Math.min(desiredH, frozen);
|
|
142
|
+
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
131
143
|
triggerRect,
|
|
132
144
|
popW,
|
|
133
|
-
|
|
145
|
+
effectiveH,
|
|
134
146
|
clip
|
|
135
147
|
);
|
|
148
|
+
if (frozenMaxRef.current === void 0) frozenMaxRef.current = suggested;
|
|
149
|
+
const maxHeight = frozenMaxRef.current;
|
|
136
150
|
pop.style.top = `${top + window.scrollY}px`;
|
|
137
151
|
pop.style.left = `${left + window.scrollX}px`;
|
|
138
152
|
pop.style.maxHeight = maxHeight === null ? "" : `${maxHeight}px`;
|
|
@@ -151,6 +165,8 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
151
165
|
sizeRef.current = null;
|
|
152
166
|
scrollParentRef.current = null;
|
|
153
167
|
placedRef.current = false;
|
|
168
|
+
frozenMaxRef.current = void 0;
|
|
169
|
+
cssCapRef.current = void 0;
|
|
154
170
|
return;
|
|
155
171
|
}
|
|
156
172
|
if (triggerRef.current) {
|
|
@@ -67,9 +67,17 @@ 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);
|
|
71
|
+
const cssCapRef = React.useRef(void 0);
|
|
70
72
|
const calculatePosition = React.useCallback((remeasure = false) => {
|
|
71
73
|
const pop = popRef.current;
|
|
72
74
|
if (!triggerRef.current || !pop) return;
|
|
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
|
+
}
|
|
73
81
|
if (remeasure || !sizeRef.current) {
|
|
74
82
|
sizeRef.current = {
|
|
75
83
|
w: pop.offsetWidth,
|
|
@@ -91,12 +99,18 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
91
99
|
};
|
|
92
100
|
const first = !placedRef.current;
|
|
93
101
|
if (first) pop.style.transition = "none";
|
|
94
|
-
const
|
|
102
|
+
const cap = cssCapRef.current;
|
|
103
|
+
const desiredH = cap == null ? popH : Math.min(popH, cap);
|
|
104
|
+
const frozen = frozenMaxRef.current;
|
|
105
|
+
const effectiveH = frozen == null ? desiredH : Math.min(desiredH, frozen);
|
|
106
|
+
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
95
107
|
triggerRect,
|
|
96
108
|
popW,
|
|
97
|
-
|
|
109
|
+
effectiveH,
|
|
98
110
|
clip
|
|
99
111
|
);
|
|
112
|
+
if (frozenMaxRef.current === void 0) frozenMaxRef.current = suggested;
|
|
113
|
+
const maxHeight = frozenMaxRef.current;
|
|
100
114
|
pop.style.top = `${top + window.scrollY}px`;
|
|
101
115
|
pop.style.left = `${left + window.scrollX}px`;
|
|
102
116
|
pop.style.maxHeight = maxHeight === null ? "" : `${maxHeight}px`;
|
|
@@ -115,6 +129,8 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
115
129
|
sizeRef.current = null;
|
|
116
130
|
scrollParentRef.current = null;
|
|
117
131
|
placedRef.current = false;
|
|
132
|
+
frozenMaxRef.current = void 0;
|
|
133
|
+
cssCapRef.current = void 0;
|
|
118
134
|
return;
|
|
119
135
|
}
|
|
120
136
|
if (triggerRef.current) {
|
|
@@ -3289,9 +3289,17 @@ 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);
|
|
3293
|
+
const cssCapRef = import_react10.default.useRef(void 0);
|
|
3292
3294
|
const calculatePosition = import_react10.default.useCallback((remeasure = false) => {
|
|
3293
3295
|
const pop = popRef.current;
|
|
3294
3296
|
if (!triggerRef.current || !pop) return;
|
|
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
|
+
}
|
|
3295
3303
|
if (remeasure || !sizeRef.current) {
|
|
3296
3304
|
sizeRef.current = {
|
|
3297
3305
|
w: pop.offsetWidth,
|
|
@@ -3313,12 +3321,18 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
3313
3321
|
};
|
|
3314
3322
|
const first = !placedRef.current;
|
|
3315
3323
|
if (first) pop.style.transition = "none";
|
|
3316
|
-
const
|
|
3324
|
+
const cap = cssCapRef.current;
|
|
3325
|
+
const desiredH = cap == null ? popH : Math.min(popH, cap);
|
|
3326
|
+
const frozen = frozenMaxRef.current;
|
|
3327
|
+
const effectiveH = frozen == null ? desiredH : Math.min(desiredH, frozen);
|
|
3328
|
+
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
3317
3329
|
triggerRect,
|
|
3318
3330
|
popW,
|
|
3319
|
-
|
|
3331
|
+
effectiveH,
|
|
3320
3332
|
clip
|
|
3321
3333
|
);
|
|
3334
|
+
if (frozenMaxRef.current === void 0) frozenMaxRef.current = suggested;
|
|
3335
|
+
const maxHeight = frozenMaxRef.current;
|
|
3322
3336
|
pop.style.top = `${top + window.scrollY}px`;
|
|
3323
3337
|
pop.style.left = `${left + window.scrollX}px`;
|
|
3324
3338
|
pop.style.maxHeight = maxHeight === null ? "" : `${maxHeight}px`;
|
|
@@ -3337,6 +3351,8 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
3337
3351
|
sizeRef.current = null;
|
|
3338
3352
|
scrollParentRef.current = null;
|
|
3339
3353
|
placedRef.current = false;
|
|
3354
|
+
frozenMaxRef.current = void 0;
|
|
3355
|
+
cssCapRef.current = void 0;
|
|
3340
3356
|
return;
|
|
3341
3357
|
}
|
|
3342
3358
|
if (triggerRef.current) {
|
package/dist/components/index.js
CHANGED
|
@@ -3187,9 +3187,17 @@ 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);
|
|
3191
|
+
const cssCapRef = React10.useRef(void 0);
|
|
3190
3192
|
const calculatePosition = React10.useCallback((remeasure = false) => {
|
|
3191
3193
|
const pop = popRef.current;
|
|
3192
3194
|
if (!triggerRef.current || !pop) return;
|
|
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
|
+
}
|
|
3193
3201
|
if (remeasure || !sizeRef.current) {
|
|
3194
3202
|
sizeRef.current = {
|
|
3195
3203
|
w: pop.offsetWidth,
|
|
@@ -3211,12 +3219,18 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
3211
3219
|
};
|
|
3212
3220
|
const first = !placedRef.current;
|
|
3213
3221
|
if (first) pop.style.transition = "none";
|
|
3214
|
-
const
|
|
3222
|
+
const cap = cssCapRef.current;
|
|
3223
|
+
const desiredH = cap == null ? popH : Math.min(popH, cap);
|
|
3224
|
+
const frozen = frozenMaxRef.current;
|
|
3225
|
+
const effectiveH = frozen == null ? desiredH : Math.min(desiredH, frozen);
|
|
3226
|
+
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
3215
3227
|
triggerRect,
|
|
3216
3228
|
popW,
|
|
3217
|
-
|
|
3229
|
+
effectiveH,
|
|
3218
3230
|
clip
|
|
3219
3231
|
);
|
|
3232
|
+
if (frozenMaxRef.current === void 0) frozenMaxRef.current = suggested;
|
|
3233
|
+
const maxHeight = frozenMaxRef.current;
|
|
3220
3234
|
pop.style.top = `${top + window.scrollY}px`;
|
|
3221
3235
|
pop.style.left = `${left + window.scrollX}px`;
|
|
3222
3236
|
pop.style.maxHeight = maxHeight === null ? "" : `${maxHeight}px`;
|
|
@@ -3235,6 +3249,8 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
3235
3249
|
sizeRef.current = null;
|
|
3236
3250
|
scrollParentRef.current = null;
|
|
3237
3251
|
placedRef.current = false;
|
|
3252
|
+
frozenMaxRef.current = void 0;
|
|
3253
|
+
cssCapRef.current = void 0;
|
|
3238
3254
|
return;
|
|
3239
3255
|
}
|
|
3240
3256
|
if (triggerRef.current) {
|
package/dist/index.cjs
CHANGED
|
@@ -7701,9 +7701,17 @@ 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);
|
|
7705
|
+
const cssCapRef = import_react10.default.useRef(void 0);
|
|
7704
7706
|
const calculatePosition = import_react10.default.useCallback((remeasure = false) => {
|
|
7705
7707
|
const pop = popRef.current;
|
|
7706
7708
|
if (!triggerRef.current || !pop) return;
|
|
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
|
+
}
|
|
7707
7715
|
if (remeasure || !sizeRef.current) {
|
|
7708
7716
|
sizeRef.current = {
|
|
7709
7717
|
w: pop.offsetWidth,
|
|
@@ -7725,12 +7733,18 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
7725
7733
|
};
|
|
7726
7734
|
const first = !placedRef.current;
|
|
7727
7735
|
if (first) pop.style.transition = "none";
|
|
7728
|
-
const
|
|
7736
|
+
const cap = cssCapRef.current;
|
|
7737
|
+
const desiredH = cap == null ? popH : Math.min(popH, cap);
|
|
7738
|
+
const frozen = frozenMaxRef.current;
|
|
7739
|
+
const effectiveH = frozen == null ? desiredH : Math.min(desiredH, frozen);
|
|
7740
|
+
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
7729
7741
|
triggerRect,
|
|
7730
7742
|
popW,
|
|
7731
|
-
|
|
7743
|
+
effectiveH,
|
|
7732
7744
|
clip
|
|
7733
7745
|
);
|
|
7746
|
+
if (frozenMaxRef.current === void 0) frozenMaxRef.current = suggested;
|
|
7747
|
+
const maxHeight = frozenMaxRef.current;
|
|
7734
7748
|
pop.style.top = `${top + window.scrollY}px`;
|
|
7735
7749
|
pop.style.left = `${left + window.scrollX}px`;
|
|
7736
7750
|
pop.style.maxHeight = maxHeight === null ? "" : `${maxHeight}px`;
|
|
@@ -7749,6 +7763,8 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
7749
7763
|
sizeRef.current = null;
|
|
7750
7764
|
scrollParentRef.current = null;
|
|
7751
7765
|
placedRef.current = false;
|
|
7766
|
+
frozenMaxRef.current = void 0;
|
|
7767
|
+
cssCapRef.current = void 0;
|
|
7752
7768
|
return;
|
|
7753
7769
|
}
|
|
7754
7770
|
if (triggerRef.current) {
|
package/dist/index.js
CHANGED
|
@@ -7290,9 +7290,17 @@ 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);
|
|
7294
|
+
const cssCapRef = React10.useRef(void 0);
|
|
7293
7295
|
const calculatePosition = React10.useCallback((remeasure = false) => {
|
|
7294
7296
|
const pop = popRef.current;
|
|
7295
7297
|
if (!triggerRef.current || !pop) return;
|
|
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
|
+
}
|
|
7296
7304
|
if (remeasure || !sizeRef.current) {
|
|
7297
7305
|
sizeRef.current = {
|
|
7298
7306
|
w: pop.offsetWidth,
|
|
@@ -7314,12 +7322,18 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
7314
7322
|
};
|
|
7315
7323
|
const first = !placedRef.current;
|
|
7316
7324
|
if (first) pop.style.transition = "none";
|
|
7317
|
-
const
|
|
7325
|
+
const cap = cssCapRef.current;
|
|
7326
|
+
const desiredH = cap == null ? popH : Math.min(popH, cap);
|
|
7327
|
+
const frozen = frozenMaxRef.current;
|
|
7328
|
+
const effectiveH = frozen == null ? desiredH : Math.min(desiredH, frozen);
|
|
7329
|
+
const { direction: next, top, left, over, maxHeight: suggested } = computePlacement(
|
|
7318
7330
|
triggerRect,
|
|
7319
7331
|
popW,
|
|
7320
|
-
|
|
7332
|
+
effectiveH,
|
|
7321
7333
|
clip
|
|
7322
7334
|
);
|
|
7335
|
+
if (frozenMaxRef.current === void 0) frozenMaxRef.current = suggested;
|
|
7336
|
+
const maxHeight = frozenMaxRef.current;
|
|
7323
7337
|
pop.style.top = `${top + window.scrollY}px`;
|
|
7324
7338
|
pop.style.left = `${left + window.scrollX}px`;
|
|
7325
7339
|
pop.style.maxHeight = maxHeight === null ? "" : `${maxHeight}px`;
|
|
@@ -7338,6 +7352,8 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
7338
7352
|
sizeRef.current = null;
|
|
7339
7353
|
scrollParentRef.current = null;
|
|
7340
7354
|
placedRef.current = false;
|
|
7355
|
+
frozenMaxRef.current = void 0;
|
|
7356
|
+
cssCapRef.current = void 0;
|
|
7341
7357
|
return;
|
|
7342
7358
|
}
|
|
7343
7359
|
if (triggerRef.current) {
|