Skip to content

Commit

Permalink
feat(popover): add container property (#3812)
Browse files Browse the repository at this point in the history
closes #3795
  • Loading branch information
ZettZet authored Nov 13, 2024
1 parent fa45902 commit 00c224a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/Popover/Popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export type PopoverProps = PropsWithJsxAttributes<
onClickOutside?: ClickOutsideHandler;
onSetDirection?: (direction: Direction) => void;
viewportRef?: React.RefObject<HTMLElement>;
container?: Element;
} & PositioningProps
>;

Expand Down Expand Up @@ -194,6 +195,7 @@ export const Popover = forwardRef<HTMLDivElement, PopoverProps>(
equalAnchorWidth,
onSetDirection,
viewportRef,
container = window.document.body,
...otherProps
} = props;

Expand Down Expand Up @@ -308,7 +310,7 @@ export const Popover = forwardRef<HTMLDivElement, PopoverProps>(
{...otherProps}
preset={theme}
className={cnPopover({ direction, notVisible }, [className])}
container={window.document.body}
container={container}
ref={useForkRef([ref, componentRef])}
style={{
...style,
Expand Down
1 change: 1 addition & 0 deletions src/components/Popover/__stand__/Popover.dev.stand.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -334,5 +334,6 @@ type Direction =
| [`offset?`](#отступы) | `PopoverPropOffset` | `0` | Отступ от якоря или позиции |
| [`arrowOffset?`](#отступы) | `number` | - | Сдвиг в нецентральных позициях (используется для центровки стрелочки у тултипа) |
| [`viewportRef?`](#viewport) | `React.RefObject<HTMLElement>` | - | Ссылка на вьюпорт |
| `container?` | `Element` | `window.document.body` | Родительский контейнер для поповера |
| `isInteractive?` | `boolean` | `true` | Можно ли взаимодействовать с содержимым поповера |
| `onClickOutside?` | `(event: MouseEvent) => void` | - | Действие по клику за пределами поповера и его якоря (если есть) |

0 comments on commit 00c224a

Please sign in to comment.