From 077e6f97ba5ebfb9c6a24f0ff9718241471c8438 Mon Sep 17 00:00:00 2001 From: Lennert Claeys Date: Mon, 19 Sep 2022 13:36:42 +0200 Subject: [PATCH 1/3] Allow a subset of popover props to be overwritten in the SplitButton --- src/components/splitButton/SplitButton.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/components/splitButton/SplitButton.tsx b/src/components/splitButton/SplitButton.tsx index d78979d94..7665891af 100644 --- a/src/components/splitButton/SplitButton.tsx +++ b/src/components/splitButton/SplitButton.tsx @@ -23,6 +23,15 @@ interface SplitButtonProps extends Omit { onSecondaryButtonClick?: (event: MouseEvent) => void; /** If true, component will be disabled. */ disabled?: boolean; + /** Overwrites for the popover */ + popoverProps?: { + /** The preferred direction in which the Popover is rendered, is overridden with the opposite or adjacent direction if the Popover cannot be entirely displayed in the current direction. */ + direction?: 'north' | 'south'; + /** If true, the Popover stretches to fit its content vertically */ + fullHeight?: boolean; + /** The z-index of the Popover */ + zIndex?: number; + }; } const SplitButton: GenericComponent = ({ @@ -32,6 +41,7 @@ const SplitButton: GenericComponent = ({ onButtonClick, onSecondaryButtonClick, disabled, + popoverProps, ...others }) => { const [popoverActive, setPopoverActive] = useState(false); @@ -90,6 +100,7 @@ const SplitButton: GenericComponent = ({ onEscKeyDown={handleCloseClick} onOverlayClick={handleCloseClick} position="start" + {...popoverProps} > {React.Children.map(children, (child) => { From 3af8d55ffcbf465c8fb3ee5343525cfb3ce96770 Mon Sep 17 00:00:00 2001 From: Lennert Claeys Date: Mon, 19 Sep 2022 13:36:59 +0200 Subject: [PATCH 2/3] Add extra story --- src/components/splitButton/splitButton.stories.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/components/splitButton/splitButton.stories.tsx b/src/components/splitButton/splitButton.stories.tsx index 39566f7db..61ee02c47 100644 --- a/src/components/splitButton/splitButton.stories.tsx +++ b/src/components/splitButton/splitButton.stories.tsx @@ -26,3 +26,10 @@ export const DefaultStory: ComponentStory = (args) => ( ); + +export const WithPopoverOverrides: ComponentStory = (args) => ( + + + + +); From bf075097ff5cc1e6149321cc15f9ab5006c1c56e Mon Sep 17 00:00:00 2001 From: Lennert Claeys Date: Mon, 19 Sep 2022 13:41:17 +0200 Subject: [PATCH 3/3] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f9f7fd5f3..074471925 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ### Added +- `SplitButton`: `popoverProps` prop which allows overwriting the z-index, direction and height of the popover. ([@lorgan3](https://github.com/lorgan3)) in [#2369](https://github.com/teamleadercrm/ui/pull/2369)) + ### Changed ### Deprecated