diff --git a/CHANGELOG.md b/CHANGELOG.md index 074471925..ca17e115f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ### 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)) +- `SplitButton`: `processing` prop equivalent to processing on the regular button. ([@lorgan3](https://github.com/lorgan3)) in [#2370](https://github.com/teamleadercrm/ui/pull/2370)) ### Changed diff --git a/src/components/splitButton/SplitButton.tsx b/src/components/splitButton/SplitButton.tsx index 7665891af..85e7a3297 100644 --- a/src/components/splitButton/SplitButton.tsx +++ b/src/components/splitButton/SplitButton.tsx @@ -9,6 +9,7 @@ import { BoxProps } from '../box/Box'; import { GenericComponent } from '../../@types/types'; import isReactElement from '../utils/is-react-element'; import { SIZES } from '../../constants'; +import theme from './theme.css'; interface SplitButtonProps extends Omit { /** The MenuItems we pass to our component. */ @@ -23,6 +24,8 @@ interface SplitButtonProps extends Omit { onSecondaryButtonClick?: (event: MouseEvent) => void; /** If true, component will be disabled. */ disabled?: boolean; + /** If true, component will show a loading spinner instead of label. */ + processing?: 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. */ @@ -41,6 +44,7 @@ const SplitButton: GenericComponent = ({ onButtonClick, onSecondaryButtonClick, disabled, + processing, popoverProps, ...others }) => { @@ -82,16 +86,26 @@ const SplitButton: GenericComponent = ({ return ( - -