Skip to content

Commit

Permalink
fix: review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
amje committed Dec 4, 2024
1 parent 034ce3d commit e15cc1e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 15 deletions.
7 changes: 4 additions & 3 deletions src/components/Popup/Popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import {getOffsetValue, isAutoPlacement} from './utils';
import './Popup.scss';

export interface PopupProps extends DOMProps, LayerExtendableProps, QAProps {
ref?: React.Ref<HTMLDivElement>;
children?: React.ReactNode;
/** Manages `Popup` visibility */
open?: boolean;
Expand All @@ -64,6 +63,8 @@ export interface PopupProps extends DOMProps, LayerExtendableProps, QAProps {
floatingContext?: FloatingRootContext<ReferenceType>;
/** Additional floating element props to provide interactions */
floatingProps?: Record<string, unknown>;
/** React ref floating element is attached to */
floatingRef?: React.Ref<HTMLDivElement>;
/** Do not use `LayerManager` on stacking popups */
disableLayer?: boolean;
/** @deprecated Add onClick handler to children */
Expand Down Expand Up @@ -113,7 +114,7 @@ export interface PopupProps extends DOMProps, LayerExtendableProps, QAProps {
const b = block('popup');

export function Popup({
ref,
floatingRef,
keepMounted = false,
hasArrow = false,
open,
Expand Down Expand Up @@ -236,7 +237,7 @@ export function Popup({
}

const handleRef = useForkRef<HTMLDivElement>(
ref,
floatingRef,
refs.setFloating,
containerRef,
useParentFocusTrap(),
Expand Down
6 changes: 3 additions & 3 deletions src/components/lab/Popover/Popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export interface PopoverProps
onOpenChange?: (open: boolean) => void;
disabled?: boolean;
content?: React.ReactNode;
trigger?: 'hover' | 'click';
trigger?: 'click';
delay?: number | {open?: number; close?: number};
enableSafePolygon?: boolean;
}
Expand Down Expand Up @@ -89,7 +89,7 @@ export function Popover({
move: false,
handleClose: enableSafePolygon ? safePolygon() : undefined,
});
const click = useClick(context, {enabled: !disabled && trigger !== 'hover'});
const click = useClick(context, {enabled: !disabled});
const dismiss = useDismiss(context, {
escapeKey: !disableEscapeKeyDown,
outsidePress: !disableOutsideClick,
Expand All @@ -103,9 +103,9 @@ export function Popover({
{React.cloneElement(child, {ref: anchorRef, ...getReferenceProps(child.props)})}
<Popup
{...restProps}
ref={setFloatingElement}
open={isOpen}
floatingContext={context}
floatingRef={setFloatingElement}
floatingProps={getFloatingProps()}
className={b(null, className)}
contentClassName={b('content', contentClassName)}
Expand Down
2 changes: 1 addition & 1 deletion src/components/lab/Popover/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ import {Button, Popover} from '@gravity-ui/uikit';
| qa | Test attribute (`data-qa`) | `string` | |
| strategy | `Floating UI` positioning strategy | `"absolute"` `"fixed"` | `"absolute"` |
| style | HTML `style` attribute for root node | `string` | |
| trigger | Which only event should open the `Popover`. By default, both `click` and `hover` do | `"click"` `"hover"` | |
| trigger | Which event should open the `Popover`. By default, `click` and `hover` both do | `"click"` | |
8 changes: 0 additions & 8 deletions src/components/lab/Popover/__stories__/Popover.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,6 @@ export const Delay: Story = {
},
};

export const OnlyHover: Story = {
...Default,
args: {
...Default.args,
trigger: 'hover',
},
};

export const OnlyClick: Story = {
...Default,
args: {
Expand Down

0 comments on commit e15cc1e

Please sign in to comment.