Skip to content

Commit a63602c

Browse files
committed
rename min height to min visible block size
1 parent 53b6d89 commit a63602c

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

src/internal/components/chart-popover/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ function ChartPopover(
129129
trackRef={trackRef}
130130
getTrack={getTrack}
131131
trackKey={trackKey}
132-
minHeight={minHeight}
132+
minVisibleBlockSize={minHeight}
133133
arrow={position => (
134134
<div className={clsx(popoverStyles.arrow, popoverStyles[`arrow-position-${position}`])}>
135135
<div className={popoverStyles['arrow-outer']} />

src/popover/__tests__/positions.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ describe('calculatePosition', () => {
4545
trigger,
4646
arrow,
4747
body: { inlineSize: 250, blockSize: 1000 },
48-
minHeight: 250,
48+
minVisibleBlockSize: 250,
4949
container: viewport,
5050
viewport,
5151
});

src/popover/container.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ interface PopoverContainerProps {
2626
</>)
2727
*/
2828
trackKey?: string | number;
29-
minHeight?: number;
29+
minVisibleBlockSize?: number;
3030
position: PopoverProps.Position;
3131
zIndex?: React.CSSProperties['zIndex'];
3232
arrow: (position: InternalPosition | null) => React.ReactNode;
@@ -52,7 +52,7 @@ export default function PopoverContainer({
5252
trackRef,
5353
getTrack: externalGetTrack,
5454
trackKey,
55-
minHeight,
55+
minVisibleBlockSize,
5656
arrow,
5757
children,
5858
zIndex,
@@ -98,7 +98,7 @@ export default function PopoverContainer({
9898
renderWithPortal,
9999
keepPosition,
100100
hideOnOverscroll,
101-
minHeight,
101+
minVisibleBlockSize,
102102
});
103103

104104
// Recalculate position when properties change.

src/popover/use-popover-position.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default function usePopoverPosition({
2727
renderWithPortal,
2828
keepPosition,
2929
hideOnOverscroll,
30-
minHeight,
30+
minVisibleBlockSize,
3131
}: {
3232
popoverRef: React.RefObject<HTMLDivElement | null>;
3333
bodyRef: React.RefObject<HTMLDivElement | null>;
@@ -40,7 +40,7 @@ export default function usePopoverPosition({
4040
renderWithPortal?: boolean;
4141
keepPosition?: boolean;
4242
hideOnOverscroll?: boolean;
43-
minHeight?: number;
43+
minVisibleBlockSize?: number;
4444
}) {
4545
const previousInternalPositionRef = useRef<InternalPosition | null>(null);
4646
const [popoverStyle, setPopoverStyle] = useState<Partial<Offset>>({});
@@ -132,7 +132,7 @@ export default function usePopoverPosition({
132132
viewport: viewportRect,
133133
renderWithPortal,
134134
allowVerticalOverflow,
135-
minHeight,
135+
minVisibleBlockSize,
136136
});
137137

138138
// Get the position of the popover relative to the containing block.
@@ -215,7 +215,7 @@ export default function usePopoverPosition({
215215
allowVerticalOverflow,
216216
allowScrollToFit,
217217
hideOnOverscroll,
218-
minHeight,
218+
minVisibleBlockSize,
219219
]
220220
);
221221
return { updatePositionHandler, popoverStyle, internalPosition, positionHandlerRef, isOverscrolling };

src/popover/utils/positions.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ export function calculatePosition({
239239
// the popover is only bound by the viewport if it is rendered in a portal
240240
renderWithPortal,
241241
allowVerticalOverflow,
242-
minHeight,
242+
minVisibleBlockSize,
243243
}: {
244244
preferredPosition: PopoverProps.Position;
245245
fixedInternalPosition?: InternalPosition;
@@ -251,7 +251,7 @@ export function calculatePosition({
251251
// the popover is only bound by the viewport if it is rendered in a portal
252252
renderWithPortal?: boolean;
253253
allowVerticalOverflow?: boolean;
254-
minHeight?: number;
254+
minVisibleBlockSize?: number;
255255
}): CalculatedPosition {
256256
let bestOption: CandidatePosition | null = null;
257257

@@ -267,12 +267,12 @@ export function calculatePosition({
267267
? getIntersection([rect, viewport])
268268
: getIntersection([rect, viewport, container]);
269269

270-
// When min height is set, the popover is considered fitting the container if the available space
271-
// is the same or larger than min height, even if it means the scrollbar is needed.
270+
// When min visible block size is set, the popover is considered fitting the container if the available space
271+
// is the same or larger than min allowed, even if it means the scrollbar is needed.
272272
const fitsBlockSize =
273-
minHeight === undefined
273+
minVisibleBlockSize === undefined
274274
? visibleArea && visibleArea.blockSize === body.blockSize
275-
: visibleArea && visibleArea.blockSize >= Math.min(body.blockSize, minHeight);
275+
: visibleArea && visibleArea.blockSize >= Math.min(body.blockSize, minVisibleBlockSize);
276276
const fitsInlineSize = visibleArea && visibleArea.inlineSize === body.inlineSize;
277277

278278
if (fitsBlockSize && fitsInlineSize) {

0 commit comments

Comments
 (0)