From 58b3ed96340f5a42e304e1bacc3dd327a996d781 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Wed, 20 Sep 2023 17:55:41 +0800 Subject: [PATCH] chore: move to official api --- src/Popup/index.tsx | 5 +++-- src/interface.ts | 15 +++++---------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/Popup/index.tsx b/src/Popup/index.tsx index 875a0b89..4bdc90ba 100644 --- a/src/Popup/index.tsx +++ b/src/Popup/index.tsx @@ -153,8 +153,9 @@ const Popup = React.forwardRef((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'; diff --git a/src/interface.ts b/src/interface.ts index f8301180..a5b2caa7 100644 --- a/src/interface.ts +++ b/src/interface.ts @@ -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. @@ -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 */