From 04d9d9566f295df005e9558f46563f6aa59fcb63 Mon Sep 17 00:00:00 2001 From: Yan Wang Date: Mon, 23 Oct 2023 15:22:58 +0800 Subject: [PATCH] fix type error on Popover close --- packages/design-system/src/components/Popover/Popover.tsx | 7 +++++-- .../src/stories/messaging/Popover.stories.tsx | 2 +- .../src/components/BasicSearch/BasicSearch.component.js | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/design-system/src/components/Popover/Popover.tsx b/packages/design-system/src/components/Popover/Popover.tsx index d99117659ad..a0a7eb1d643 100644 --- a/packages/design-system/src/components/Popover/Popover.tsx +++ b/packages/design-system/src/components/Popover/Popover.tsx @@ -27,7 +27,7 @@ export type PopoverProps = { } & PopoverOptions; export type PopoverStateReturn = { - hide: () => void; + setOpen: () => void; }; export function Popover({ @@ -70,7 +70,10 @@ export function Popover({ fill={tokens.coralColorNeutralBackground} /> {typeof children === 'function' - ? children({ ...popover.getFloatingProps(), setOpen: popover.setOpen }) + ? children({ + ...popover.getFloatingProps(), + setOpen: popover.setOpen, + }) : children} diff --git a/packages/design-system/src/stories/messaging/Popover.stories.tsx b/packages/design-system/src/stories/messaging/Popover.stories.tsx index 002f824495a..0b1528ee04c 100644 --- a/packages/design-system/src/stories/messaging/Popover.stories.tsx +++ b/packages/design-system/src/stories/messaging/Popover.stories.tsx @@ -76,7 +76,7 @@ export const WithFunctionAsChildren = () => ( {(popover: PopoverStateReturn) => ( There is some content - popover?.hide()}>Close Me please + popover?.setOpen(false)}>Close Me please )} diff --git a/packages/faceted-search/src/components/BasicSearch/BasicSearch.component.js b/packages/faceted-search/src/components/BasicSearch/BasicSearch.component.js index 846833afe4a..1ade1e1f15b 100644 --- a/packages/faceted-search/src/components/BasicSearch/BasicSearch.component.js +++ b/packages/faceted-search/src/components/BasicSearch/BasicSearch.component.js @@ -169,7 +169,7 @@ const BasicSearch = ({ initialFilterValue={initialFilterValue} onClick={(...args) => { onClickOverlayRow(...args); - popover?.hide(); + popover?.setOpen(false); }} t={t} />