Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: move to official api #422

Merged
merged 1 commit into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/Popup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,9 @@ const Popup = React.forwardRef<HTMLDivElement, PopupProps>((props, ref) => {

// Set align style
if (ready || !open) {
const { points, _experimental } = align;
const dynamicInset = _experimental?.dynamicInset;
const { points } = align;
const dynamicInset =
align.dynamicInset || (align as any)._experimental?.dynamicInset;
const alignRight = dynamicInset && points[0][1] === 'r';
const alignBottom = dynamicInset && points[0][0] === 'b';

Expand Down
15 changes: 5 additions & 10 deletions src/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,6 @@ export interface AlignType {
* Point can be 't'(top), 'b'(bottom), 'c'(center), 'l'(left), 'r'(right) */
points?: (string | AlignPoint)[];

/**
* @private Do not use in your production code
*/
_experimental?: {
/**
* @private Do not use in your production code. Auto adjust align logic
*/
dynamicInset?: boolean;
};

/**
* offset source node by offset[0] in x and offset[1] in y.
* If offset contains percentage string value, it is relative to sourceNode region.
Expand Down Expand Up @@ -74,6 +64,11 @@ export interface AlignType {
* Similar to `visible`, but if `visible` region not satisfy, fallback to `scroll`.
*/
htmlRegion?: 'visible' | 'scroll' | 'visibleFirst';

/**
* Auto chose position with `top` or `bottom` by the align result
*/
dynamicInset?: boolean;
/**
* Whether use css right instead of left to position
*/
Expand Down