@jetbrains/ring-ui 5.0.99 → 5.1.1
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/components/popup/position.d.ts +1 -1
- package/components/popup/position.js +33 -43
- package/components/select/select__popup.js +1 -1
- package/components/user-card/card.js +18 -16
- package/components/user-card/user-card.css +4 -0
- package/dist/_helpers/card.js +4 -2
- package/dist/analytics/analytics.js +2 -2
- package/dist/popup/position.d.ts +1 -1
- package/dist/popup/position.js +39 -61
- package/dist/select/select__popup.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +5 -5
- package/components/analytics-ng/analytics-ng.examples.js +0 -61
- package/components/analytics-ng/analytics-ng.js +0 -87
- package/components/analytics-ng/analytics-ng.test.js +0 -82
- package/dist/analytics-ng/analytics-ng.js +0 -89
|
@@ -23,7 +23,7 @@ export interface PositionAttrs {
|
|
|
23
23
|
autoCorrectTopOverflow: boolean;
|
|
24
24
|
}
|
|
25
25
|
export declare const positionPropKeys: readonly ["directions", "autoPositioning", "autoCorrectTopOverflow", "sidePadding", "top", "left", "offset", "maxHeight", "minWidth"];
|
|
26
|
-
export declare function maxHeightForDirection(direction: Directions, anchorNode: Element,
|
|
26
|
+
export declare function maxHeightForDirection(direction: Directions, anchorNode: Element, container?: Element): number;
|
|
27
27
|
export default function position(attrs: PositionAttrs): {
|
|
28
28
|
styles: PositionStyles;
|
|
29
29
|
direction: Directions | null;
|
|
@@ -46,7 +46,9 @@ function verticalOverflow(styles, scrollingCoordinates, attrs) {
|
|
|
46
46
|
const viewportMinX = scrollingCoordinates.top + attrs.sidePadding;
|
|
47
47
|
const viewportMaxX = scrollingCoordinates.top + containerHeight - attrs.sidePadding;
|
|
48
48
|
const topOverflow = Math.max(viewportMinX - styles.top, 0);
|
|
49
|
-
const popupHeight = attrs.
|
|
49
|
+
const popupHeight = attrs.maxHeight && typeof attrs.maxHeight === 'number'
|
|
50
|
+
? Math.min(attrs.popup.scrollHeight, attrs.maxHeight)
|
|
51
|
+
: attrs.popup.scrollHeight;
|
|
50
52
|
const verticalDiff = styles.top + popupHeight - viewportMaxX;
|
|
51
53
|
const bottomOverflow = Math.max(verticalDiff, 0);
|
|
52
54
|
return topOverflow + bottomOverflow;
|
|
@@ -76,37 +78,26 @@ const defaultcontainerRect = {
|
|
|
76
78
|
top: 0,
|
|
77
79
|
left: 0
|
|
78
80
|
};
|
|
79
|
-
function
|
|
80
|
-
const
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
export function maxHeightForDirection(direction, anchorNode, container = document.documentElement) {
|
|
82
|
+
const MIN_POPUP_SIZE = 8;
|
|
83
|
+
const domRect = anchorNode.getBoundingClientRect();
|
|
84
|
+
let topMaxHeight;
|
|
85
|
+
let bottomMaxHeight;
|
|
86
|
+
if (container === document.documentElement) {
|
|
87
|
+
topMaxHeight = Math.max(domRect.top, MIN_POPUP_SIZE);
|
|
88
|
+
bottomMaxHeight = Math.max(getWindowHeight() - domRect.top - domRect.height, MIN_POPUP_SIZE);
|
|
85
89
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
else {
|
|
91
|
+
const containerRect = container.getBoundingClientRect();
|
|
92
|
+
topMaxHeight = Math.max(domRect.top - containerRect.top, 0);
|
|
93
|
+
const containerHeight = Math.max(containerRect.height,
|
|
94
|
+
// XXX
|
|
95
|
+
// If container is the document element
|
|
96
|
+
// then we check client height too because we may have situation when
|
|
97
|
+
// "height" from "getBoundingClientRect" less than "clientHeight".
|
|
98
|
+
container === document.documentElement ? container.clientHeight : 0);
|
|
99
|
+
bottomMaxHeight = Math.max(containerHeight - (topMaxHeight + domRect.height), 0);
|
|
95
100
|
}
|
|
96
|
-
return styles;
|
|
97
|
-
}
|
|
98
|
-
export function maxHeightForDirection(direction, anchorNode, containerNode) {
|
|
99
|
-
const container = containerNode || document.documentElement;
|
|
100
|
-
const domRect = anchorNode.getBoundingClientRect();
|
|
101
|
-
const containerRect = container.getBoundingClientRect();
|
|
102
|
-
const topMaxHeight = Math.max(domRect.top - containerRect.top, 0);
|
|
103
|
-
const containerHeight = Math.max(containerRect.height,
|
|
104
|
-
// XXX
|
|
105
|
-
// If container is the document element
|
|
106
|
-
// then we check client height too because we may have situation when
|
|
107
|
-
// "height" from "getBoundingClientRect" less then "clientHeight".
|
|
108
|
-
container === document.documentElement ? container.clientHeight : 0);
|
|
109
|
-
const bottomMaxHeight = Math.max(containerHeight - (topMaxHeight + domRect.height), 0);
|
|
110
101
|
switch (direction) {
|
|
111
102
|
case Directions.TOP_LEFT:
|
|
112
103
|
case Directions.TOP_CENTER:
|
|
@@ -126,7 +117,8 @@ export function maxHeightForDirection(direction, anchorNode, containerNode) {
|
|
|
126
117
|
case Directions.LEFT_CENTER:
|
|
127
118
|
return (domRect.height / 2) + Math.min(bottomMaxHeight / 2, topMaxHeight / 2);
|
|
128
119
|
default:
|
|
129
|
-
|
|
120
|
+
const exhaustiveCheck = direction;
|
|
121
|
+
throw new Error(exhaustiveCheck);
|
|
130
122
|
}
|
|
131
123
|
}
|
|
132
124
|
export default function position(attrs) {
|
|
@@ -146,7 +138,7 @@ export default function position(attrs) {
|
|
|
146
138
|
const overflowAttrs = { ...attrs, popup };
|
|
147
139
|
const directionsMatrix = getPositionStyles(popup, anchorRect, anchorLeft, anchorTop, offset);
|
|
148
140
|
if (!autoPositioning || directions.length === 1) {
|
|
149
|
-
styles = directionsMatrix[directions[0]];
|
|
141
|
+
styles = { ...directionsMatrix[directions[0]] };
|
|
150
142
|
chosenDirection = directions[0];
|
|
151
143
|
}
|
|
152
144
|
else {
|
|
@@ -161,7 +153,7 @@ export default function position(attrs) {
|
|
|
161
153
|
horizontalOverflow(stylesB, scroll, overflowAttrs);
|
|
162
154
|
return overflowA - overflowB;
|
|
163
155
|
});
|
|
164
|
-
styles = sortedByIncreasingOverflow[0].styles;
|
|
156
|
+
styles = { ...sortedByIncreasingOverflow[0].styles };
|
|
165
157
|
chosenDirection = sortedByIncreasingOverflow[0].direction;
|
|
166
158
|
}
|
|
167
159
|
// because of the anchor negative margin top and left also may become negative
|
|
@@ -178,16 +170,14 @@ export default function position(attrs) {
|
|
|
178
170
|
else if (maxHeight) {
|
|
179
171
|
styles.maxHeight = maxHeight;
|
|
180
172
|
}
|
|
181
|
-
if (autoCorrectTopOverflow) {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
styles
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
scroll
|
|
190
|
-
});
|
|
173
|
+
if (autoCorrectTopOverflow && chosenDirection && anchor) {
|
|
174
|
+
const maxForDirection = maxHeightForDirection(chosenDirection, anchor) - sidePadding;
|
|
175
|
+
if (!styles.maxHeight || styles.maxHeight > maxForDirection) {
|
|
176
|
+
styles.maxHeight = maxForDirection;
|
|
177
|
+
if (styles.top === 0) {
|
|
178
|
+
styles.top = sidePadding;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
191
181
|
}
|
|
192
182
|
if (minWidth === MinWidth.TARGET || minWidth === 'target') {
|
|
193
183
|
styles.minWidth = anchorRect.width;
|
|
@@ -278,7 +278,7 @@ export default class SelectPopup extends PureComponent {
|
|
|
278
278
|
const anchorNode = this.props.anchorElement;
|
|
279
279
|
const containerNode = getPopupContainer(ringPopupTarget) || document.documentElement;
|
|
280
280
|
return anchorNode != null
|
|
281
|
-
? Math.min(directions.reduce((maxHeight, direction) => (Math.max(maxHeight, maxHeightForDirection(direction, anchorNode, getStyles(containerNode).position !== 'static' ? containerNode :
|
|
281
|
+
? Math.min(directions.reduce((maxHeight, direction) => (Math.max(maxHeight, maxHeightForDirection(direction, anchorNode, getStyles(containerNode).position !== 'static' ? containerNode : undefined) ?? 0)), minMaxHeight), userDefinedMaxHeight)
|
|
282
282
|
: userDefinedMaxHeight;
|
|
283
283
|
});
|
|
284
284
|
popupRef = (el) => {
|
|
@@ -60,25 +60,27 @@ export default class UserCard extends PureComponent {
|
|
|
60
60
|
{!!avatarInfo && avatarInfo}
|
|
61
61
|
</div>
|
|
62
62
|
<div className={styles.userInformation}>
|
|
63
|
-
<div className={styles.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
<div className={styles.userInformationGeneral}>
|
|
64
|
+
<div className={styles.userNameLine}>
|
|
65
|
+
{user.href && (<Link href={user.href} className={styles.userName}>
|
|
66
|
+
{user.name}
|
|
67
|
+
</Link>)}
|
|
68
|
+
{!user.href && <span className={styles.userName}>{user.name}</span>}
|
|
69
|
+
{typeof user.online === 'boolean' &&
|
|
69
70
|
(<span className={userActiveStatusClasses} title={user.online ? wording.online : wording.offline}/>)}
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
{!!info && <span className={styles.userNameInfo}>{info}</span>}
|
|
72
|
+
{user.banned &&
|
|
72
73
|
(<span className={classNames(badgeStyles.badge, badgeStyles.invalid)} title={user.banReason}>{wording.banned}</span>)}
|
|
74
|
+
</div>
|
|
75
|
+
<div className={styles.userLogin}>{user.login}</div>
|
|
76
|
+
{user.email && (<span className={styles.userEmailWrapper}>
|
|
77
|
+
<Link pseudo onClick={this.copyEmail} className={styles.userEmail}>
|
|
78
|
+
{user.email}
|
|
79
|
+
</Link>
|
|
80
|
+
{user.unverifiedEmail && (<span className={styles.unverifiedLabel}>{wording.unverified}</span>)}
|
|
81
|
+
<Icon title={wording.copyToClipboard} className={styles.userCopyIcon} onClick={this.copyEmail} glyph={copyIcon} size={IconSize.Size14} suppressSizeWarning/>
|
|
82
|
+
</span>)}
|
|
73
83
|
</div>
|
|
74
|
-
<div className={styles.userLogin}>{user.login}</div>
|
|
75
|
-
{user.email && (<span className={styles.userEmailWrapper}>
|
|
76
|
-
<Link pseudo onClick={this.copyEmail} className={styles.userEmail}>
|
|
77
|
-
{user.email}
|
|
78
|
-
</Link>
|
|
79
|
-
{user.unverifiedEmail && (<span className={styles.unverifiedLabel}>{wording.unverified}</span>)}
|
|
80
|
-
<Icon title={wording.copyToClipboard} className={styles.userCopyIcon} onClick={this.copyEmail} glyph={copyIcon} size={IconSize.Size14} suppressSizeWarning/>
|
|
81
|
-
</span>)}
|
|
82
84
|
{children}
|
|
83
85
|
</div>
|
|
84
86
|
</div>
|
package/dist/_helpers/card.js
CHANGED
|
@@ -10,7 +10,7 @@ import { m as modules_6c9187df } from './badge.js';
|
|
|
10
10
|
import Icon from '../icon/icon.js';
|
|
11
11
|
import { Size as Size$1 } from '../icon/icon__constants.js';
|
|
12
12
|
|
|
13
|
-
var modules_a4196c17 = {"unit":"8px","light":"light_rui_6e59","userCardSpaced":"userCardSpaced_rui_6e59","userInformationContainer":"userInformationContainer_rui_6e59","userAvatar":"userAvatar_rui_6e59","userInformation":"userInformation_rui_6e59","userNameLine":"userNameLine_rui_6e59","userName":"userName_rui_6e59","userLogin":"userLogin_rui_6e59","userEmail":"userEmail_rui_6e59","userCopyIcon":"userCopyIcon_rui_6e59","userEmailWrapper":"userEmailWrapper_rui_6e59","unverifiedLabel":"unverifiedLabel_rui_6e59","userNameInfo":"userNameInfo_rui_6e59","userActiveStatus":"userActiveStatus_rui_6e59","online":"online_rui_6e59"};
|
|
13
|
+
var modules_a4196c17 = {"unit":"8px","light":"light_rui_6e59","userCardSpaced":"userCardSpaced_rui_6e59","userInformationContainer":"userInformationContainer_rui_6e59","userAvatar":"userAvatar_rui_6e59","userInformation":"userInformation_rui_6e59","userInformationGeneral":"userInformationGeneral_rui_6e59","userNameLine":"userNameLine_rui_6e59","userName":"userName_rui_6e59","userLogin":"userLogin_rui_6e59","userEmail":"userEmail_rui_6e59","userCopyIcon":"userCopyIcon_rui_6e59","userEmailWrapper":"userEmailWrapper_rui_6e59","unverifiedLabel":"unverifiedLabel_rui_6e59","userNameInfo":"userNameInfo_rui_6e59","userActiveStatus":"userActiveStatus_rui_6e59","online":"online_rui_6e59"};
|
|
14
14
|
|
|
15
15
|
class UserCard extends PureComponent {
|
|
16
16
|
constructor() {
|
|
@@ -46,6 +46,8 @@ class UserCard extends PureComponent {
|
|
|
46
46
|
url: user.avatarUrl
|
|
47
47
|
}), !!avatarInfo && avatarInfo), /*#__PURE__*/React.createElement("div", {
|
|
48
48
|
className: modules_a4196c17.userInformation
|
|
49
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
50
|
+
className: modules_a4196c17.userInformationGeneral
|
|
49
51
|
}, /*#__PURE__*/React.createElement("div", {
|
|
50
52
|
className: modules_a4196c17.userNameLine
|
|
51
53
|
}, user.href && /*#__PURE__*/React.createElement(Link, {
|
|
@@ -78,7 +80,7 @@ class UserCard extends PureComponent {
|
|
|
78
80
|
glyph: copyIcon,
|
|
79
81
|
size: Size$1.Size14,
|
|
80
82
|
suppressSizeWarning: true
|
|
81
|
-
})), children)));
|
|
83
|
+
}))), children)));
|
|
82
84
|
}
|
|
83
85
|
}
|
|
84
86
|
_defineProperty(UserCard, "propTypes", {
|
package/dist/popup/position.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export interface PositionAttrs {
|
|
|
23
23
|
autoCorrectTopOverflow: boolean;
|
|
24
24
|
}
|
|
25
25
|
export declare const positionPropKeys: readonly ["directions", "autoPositioning", "autoCorrectTopOverflow", "sidePadding", "top", "left", "offset", "maxHeight", "minWidth"];
|
|
26
|
-
export declare function maxHeightForDirection(direction: Directions, anchorNode: Element,
|
|
26
|
+
export declare function maxHeightForDirection(direction: Directions, anchorNode: Element, container?: Element): number;
|
|
27
27
|
export default function position(attrs: PositionAttrs): {
|
|
28
28
|
styles: PositionStyles;
|
|
29
29
|
direction: Directions | null;
|
package/dist/popup/position.js
CHANGED
|
@@ -81,7 +81,7 @@ function verticalOverflow(styles, scrollingCoordinates, attrs) {
|
|
|
81
81
|
const viewportMinX = scrollingCoordinates.top + attrs.sidePadding;
|
|
82
82
|
const viewportMaxX = scrollingCoordinates.top + containerHeight - attrs.sidePadding;
|
|
83
83
|
const topOverflow = Math.max(viewportMinX - styles.top, 0);
|
|
84
|
-
const popupHeight = attrs.popup.
|
|
84
|
+
const popupHeight = attrs.maxHeight && typeof attrs.maxHeight === 'number' ? Math.min(attrs.popup.scrollHeight, attrs.maxHeight) : attrs.popup.scrollHeight;
|
|
85
85
|
const verticalDiff = styles.top + popupHeight - viewportMaxX;
|
|
86
86
|
const bottomOverflow = Math.max(verticalDiff, 0);
|
|
87
87
|
return topOverflow + bottomOverflow;
|
|
@@ -101,50 +101,26 @@ const defaultcontainerRect = {
|
|
|
101
101
|
top: 0,
|
|
102
102
|
left: 0
|
|
103
103
|
};
|
|
104
|
-
function
|
|
105
|
-
let
|
|
106
|
-
|
|
107
|
-
styles,
|
|
108
|
-
anchorRect,
|
|
109
|
-
maxHeight,
|
|
110
|
-
popupScrollHeight,
|
|
111
|
-
direction,
|
|
112
|
-
scroll
|
|
113
|
-
} = _ref;
|
|
114
|
-
const BORDER_COMPENSATION = 1;
|
|
115
|
-
const {
|
|
116
|
-
TOP_LEFT,
|
|
117
|
-
TOP_RIGHT,
|
|
118
|
-
TOP_CENTER,
|
|
119
|
-
RIGHT_TOP,
|
|
120
|
-
LEFT_TOP
|
|
121
|
-
} = Directions;
|
|
122
|
-
const openedToTop = direction != null && [TOP_LEFT, TOP_RIGHT, TOP_CENTER, RIGHT_TOP, LEFT_TOP].includes(direction);
|
|
123
|
-
if (!openedToTop) {
|
|
124
|
-
return styles;
|
|
125
|
-
}
|
|
126
|
-
const isAttachedToAnchorTop = direction != null && [TOP_LEFT, TOP_CENTER, TOP_RIGHT].includes(direction);
|
|
127
|
-
const attachingPointY = isAttachedToAnchorTop ? anchorRect.top : anchorRect.bottom;
|
|
128
|
-
const effectiveHeight = maxHeight && typeof maxHeight === 'number' ? Math.min(popupScrollHeight, maxHeight) : popupScrollHeight;
|
|
129
|
-
const hypotheticalTop = attachingPointY - effectiveHeight;
|
|
130
|
-
if (hypotheticalTop <= sidePadding) {
|
|
131
|
-
styles.top = sidePadding + scroll.top;
|
|
132
|
-
styles.maxHeight = attachingPointY - sidePadding + BORDER_COMPENSATION;
|
|
133
|
-
}
|
|
134
|
-
return styles;
|
|
135
|
-
}
|
|
136
|
-
function maxHeightForDirection(direction, anchorNode, containerNode) {
|
|
137
|
-
const container = containerNode || document.documentElement;
|
|
104
|
+
function maxHeightForDirection(direction, anchorNode) {
|
|
105
|
+
let container = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : document.documentElement;
|
|
106
|
+
const MIN_POPUP_SIZE = 8;
|
|
138
107
|
const domRect = anchorNode.getBoundingClientRect();
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
108
|
+
let topMaxHeight;
|
|
109
|
+
let bottomMaxHeight;
|
|
110
|
+
if (container === document.documentElement) {
|
|
111
|
+
topMaxHeight = Math.max(domRect.top, MIN_POPUP_SIZE);
|
|
112
|
+
bottomMaxHeight = Math.max(getWindowHeight() - domRect.top - domRect.height, MIN_POPUP_SIZE);
|
|
113
|
+
} else {
|
|
114
|
+
const containerRect = container.getBoundingClientRect();
|
|
115
|
+
topMaxHeight = Math.max(domRect.top - containerRect.top, 0);
|
|
116
|
+
const containerHeight = Math.max(containerRect.height,
|
|
117
|
+
// XXX
|
|
118
|
+
// If container is the document element
|
|
119
|
+
// then we check client height too because we may have situation when
|
|
120
|
+
// "height" from "getBoundingClientRect" less than "clientHeight".
|
|
121
|
+
container === document.documentElement ? container.clientHeight : 0);
|
|
122
|
+
bottomMaxHeight = Math.max(containerHeight - (topMaxHeight + domRect.height), 0);
|
|
123
|
+
}
|
|
148
124
|
switch (direction) {
|
|
149
125
|
case Directions.TOP_LEFT:
|
|
150
126
|
case Directions.TOP_CENTER:
|
|
@@ -164,7 +140,8 @@ function maxHeightForDirection(direction, anchorNode, containerNode) {
|
|
|
164
140
|
case Directions.LEFT_CENTER:
|
|
165
141
|
return domRect.height / 2 + Math.min(bottomMaxHeight / 2, topMaxHeight / 2);
|
|
166
142
|
default:
|
|
167
|
-
|
|
143
|
+
const exhaustiveCheck = direction;
|
|
144
|
+
throw new Error(exhaustiveCheck);
|
|
168
145
|
}
|
|
169
146
|
}
|
|
170
147
|
function position(attrs) {
|
|
@@ -200,7 +177,9 @@ function position(attrs) {
|
|
|
200
177
|
};
|
|
201
178
|
const directionsMatrix = getPositionStyles(popup, anchorRect, anchorLeft, anchorTop, offset);
|
|
202
179
|
if (!autoPositioning || directions.length === 1) {
|
|
203
|
-
styles =
|
|
180
|
+
styles = {
|
|
181
|
+
...directionsMatrix[directions[0]]
|
|
182
|
+
};
|
|
204
183
|
chosenDirection = directions[0];
|
|
205
184
|
} else {
|
|
206
185
|
const sortedByIncreasingOverflow = directions.
|
|
@@ -208,18 +187,20 @@ function position(attrs) {
|
|
|
208
187
|
concat(directions[0]).filter(direction => directionsMatrix[direction]).map(direction => ({
|
|
209
188
|
styles: directionsMatrix[direction],
|
|
210
189
|
direction
|
|
211
|
-
})).sort((
|
|
190
|
+
})).sort((_ref, _ref2) => {
|
|
212
191
|
let {
|
|
213
192
|
styles: stylesA
|
|
214
|
-
} =
|
|
193
|
+
} = _ref;
|
|
215
194
|
let {
|
|
216
195
|
styles: stylesB
|
|
217
|
-
} =
|
|
196
|
+
} = _ref2;
|
|
218
197
|
const overflowA = verticalOverflow(stylesA, scroll, overflowAttrs) + horizontalOverflow(stylesA, scroll, overflowAttrs);
|
|
219
198
|
const overflowB = verticalOverflow(stylesB, scroll, overflowAttrs) + horizontalOverflow(stylesB, scroll, overflowAttrs);
|
|
220
199
|
return overflowA - overflowB;
|
|
221
200
|
});
|
|
222
|
-
styles =
|
|
201
|
+
styles = {
|
|
202
|
+
...sortedByIncreasingOverflow[0].styles
|
|
203
|
+
};
|
|
223
204
|
chosenDirection = sortedByIncreasingOverflow[0].direction;
|
|
224
205
|
}
|
|
225
206
|
// because of the anchor negative margin top and left also may become negative
|
|
@@ -235,17 +216,14 @@ function position(attrs) {
|
|
|
235
216
|
} else if (maxHeight) {
|
|
236
217
|
styles.maxHeight = maxHeight;
|
|
237
218
|
}
|
|
238
|
-
if (autoCorrectTopOverflow) {
|
|
239
|
-
|
|
240
|
-
styles
|
|
241
|
-
|
|
242
|
-
styles
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
popupScrollHeight: (_popup$scrollHeight = popup?.scrollHeight) !== null && _popup$scrollHeight !== void 0 ? _popup$scrollHeight : 0,
|
|
247
|
-
scroll
|
|
248
|
-
});
|
|
219
|
+
if (autoCorrectTopOverflow && chosenDirection && anchor) {
|
|
220
|
+
const maxForDirection = maxHeightForDirection(chosenDirection, anchor) - sidePadding;
|
|
221
|
+
if (!styles.maxHeight || styles.maxHeight > maxForDirection) {
|
|
222
|
+
styles.maxHeight = maxForDirection;
|
|
223
|
+
if (styles.top === 0) {
|
|
224
|
+
styles.top = sidePadding;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
249
227
|
}
|
|
250
228
|
if (minWidth === MinWidth.TARGET || minWidth === 'target') {
|
|
251
229
|
styles.minWidth = anchorRect.width;
|
|
@@ -166,7 +166,7 @@ class SelectPopup extends PureComponent {
|
|
|
166
166
|
const containerNode = getPopupContainer(ringPopupTarget) || document.documentElement;
|
|
167
167
|
return anchorNode != null ? Math.min(directions.reduce((maxHeight, direction) => {
|
|
168
168
|
var _maxHeightForDirectio;
|
|
169
|
-
return Math.max(maxHeight, (_maxHeightForDirectio = maxHeightForDirection(direction, anchorNode, getStyles(containerNode).position !== 'static' ? containerNode :
|
|
169
|
+
return Math.max(maxHeight, (_maxHeightForDirectio = maxHeightForDirection(direction, anchorNode, getStyles(containerNode).position !== 'static' ? containerNode : undefined)) !== null && _maxHeightForDirectio !== void 0 ? _maxHeightForDirectio : 0);
|
|
170
170
|
}, minMaxHeight), userDefinedMaxHeight) : userDefinedMaxHeight;
|
|
171
171
|
}));
|
|
172
172
|
_defineProperty(this, "popupRef", el => {
|